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