1// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef EXTENSIONS_COMMON_VIEW_TYPE_H_
6#define EXTENSIONS_COMMON_VIEW_TYPE_H_
7
8#include <string>
9
10namespace extensions {
11
12// Icky RTTI used by a few systems to distinguish the host type of a given
13// WebContents.
14//
15// Do not change or reuse the the entry values in this list as this is used in
16// ExtensionViewType enum in tools/metrics/histograms/enums.xml.
17//
18// TODO(aa): Remove this and teach those systems to keep track of their own
19// data.
20enum ViewType {
21 VIEW_TYPE_INVALID = 0,
22 VIEW_TYPE_APP_WINDOW = 1,
23 VIEW_TYPE_BACKGROUND_CONTENTS = 2,
24
25 // For custom parts of Chrome if no other type applies.
26 VIEW_TYPE_COMPONENT = 3,
27
28 VIEW_TYPE_EXTENSION_BACKGROUND_PAGE = 4,
29 VIEW_TYPE_EXTENSION_DIALOG = 5,
30 VIEW_TYPE_EXTENSION_GUEST = 6,
31 VIEW_TYPE_EXTENSION_POPUP = 7,
32
33 // Panels were removed in https://crbug.com/571511.
34 // DEPRECATED_VIEW_TYPE_PANEL = 8,
35
36 VIEW_TYPE_TAB_CONTENTS = 9,
37
38 VIEW_TYPE_LAST = VIEW_TYPE_TAB_CONTENTS
39};
40
41// Matches the |view_type| to the corresponding ViewType, and populates
42// |view_type_out|. Returns true if a match is found.
43bool GetViewTypeFromString(const std::string& view_type,
44 ViewType* view_type_out);
45
46} // namespace extensions
47
48#endif // EXTENSIONS_COMMON_VIEW_TYPE_H_
49