| OLD | NEW |
| (Empty) | |
| 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_INSPECTABLE_VIEWS_FINDER
_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_INSPECTABLE_VIEWS_FINDER
_H_ |
| 7 |
| 8 #include <set> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "base/memory/linked_ptr.h" |
| 13 |
| 14 class Profile; |
| 15 class GURL; |
| 16 |
| 17 namespace content { |
| 18 class RenderViewHost; |
| 19 } |
| 20 |
| 21 namespace extensions { |
| 22 class Extension; |
| 23 |
| 24 namespace api { |
| 25 namespace developer_private { |
| 26 struct ExtensionView; |
| 27 } |
| 28 } |
| 29 |
| 30 // Finds inspectable views for the extensions. |
| 31 class InspectableViewsFinder { |
| 32 public: |
| 33 using View = linked_ptr<api::developer_private::ExtensionView>; |
| 34 using ViewList = std::vector<View>; |
| 35 |
| 36 // |deleting_rvh| refers to a RenderViewHost that is being deleted, and |
| 37 // should thus be omitted from any lists. |
| 38 // TODO(devlin): This is hacky. |
| 39 InspectableViewsFinder(Profile* profile, |
| 40 content::RenderViewHost* deleting_rvh); |
| 41 ~InspectableViewsFinder(); |
| 42 |
| 43 // Construct a view from the given parameters. |
| 44 static View ConstructView(const GURL& url, |
| 45 int render_process_id, |
| 46 int render_view_id, |
| 47 bool incognito, |
| 48 bool generated_background_page); |
| 49 |
| 50 // Return a list of inspectable views for the given |extension|. |
| 51 ViewList GetViewsForExtension(const Extension& extension, bool is_enabled); |
| 52 |
| 53 private: |
| 54 // Returns all inspectable views for a given |profile|. |
| 55 void GetViewsForExtensionForProfile(const Extension& extension, |
| 56 Profile* profile, |
| 57 bool is_enabled, |
| 58 bool is_incognito, |
| 59 ViewList* result); |
| 60 |
| 61 // Returns all inspectable views for the extension process. |
| 62 void GetViewsForExtensionProcess( |
| 63 const Extension& extension, |
| 64 const std::set<content::RenderViewHost*>& views, |
| 65 bool is_incognito, |
| 66 ViewList* result); |
| 67 |
| 68 // Returns all inspectable app views for the extension. |
| 69 void GetAppWindowViewsForExtension(const Extension& extension, |
| 70 ViewList* result); |
| 71 |
| 72 Profile* profile_; |
| 73 |
| 74 content::RenderViewHost* deleting_rvh_; |
| 75 |
| 76 DISALLOW_COPY_AND_ASSIGN(InspectableViewsFinder); |
| 77 }; |
| 78 |
| 79 } // namespace extensions |
| 80 |
| 81 #endif // CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_INSPECTABLE_VIEWS_FIN
DER_H_ |
| OLD | NEW |