Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / extensions / api / developer_private / inspectable_views_finder.h
blob41714378a027388e0a8fc499db376087ba286732
1 // Copyright 2015 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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_INSPECTABLE_VIEWS_FINDER_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_INSPECTABLE_VIEWS_FINDER_H_
8 #include <vector>
10 #include "base/macros.h"
11 #include "base/memory/linked_ptr.h"
12 #include "extensions/common/view_type.h"
14 class Profile;
15 class GURL;
17 namespace extensions {
18 class Extension;
19 class ProcessManager;
21 namespace api {
22 namespace developer_private {
23 struct ExtensionView;
27 // Finds inspectable views for the extensions, and returns them as represented
28 // by the developerPrivate API structure and schema compiler.
29 class InspectableViewsFinder {
30 public:
31 using View = linked_ptr<api::developer_private::ExtensionView>;
32 using ViewList = std::vector<View>;
34 explicit InspectableViewsFinder(Profile* profile);
35 ~InspectableViewsFinder();
37 // Construct a view from the given parameters.
38 static View ConstructView(const GURL& url,
39 int render_process_id,
40 int render_view_id,
41 bool incognito,
42 ViewType type);
44 // Return a list of inspectable views for the given |extension|.
45 ViewList GetViewsForExtension(const Extension& extension, bool is_enabled);
47 private:
48 // Returns all inspectable views for a given |profile|.
49 void GetViewsForExtensionForProfile(const Extension& extension,
50 Profile* profile,
51 bool is_enabled,
52 bool is_incognito,
53 ViewList* result);
55 // Returns all inspectable views for the extension process.
56 void GetViewsForExtensionProcess(
57 const Extension& extension,
58 ProcessManager* process_manager,
59 bool is_incognito,
60 ViewList* result);
62 // Returns all inspectable app views for the extension.
63 void GetAppWindowViewsForExtension(const Extension& extension,
64 ViewList* result);
66 Profile* profile_;
68 DISALLOW_COPY_AND_ASSIGN(InspectableViewsFinder);
71 } // namespace extensions
73 #endif // CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_INSPECTABLE_VIEWS_FINDER_H_