| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ | 5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ |
| 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ | 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 } // namespace content | 22 } // namespace content |
| 23 | 23 |
| 24 namespace extensions{ | 24 namespace extensions{ |
| 25 class GuestViewBase; | 25 class GuestViewBase; |
| 26 class GuestViewManagerFactory; | 26 class GuestViewManagerFactory; |
| 27 | 27 |
| 28 class GuestViewManager : public content::BrowserPluginGuestManager, | 28 class GuestViewManager : public content::BrowserPluginGuestManager, |
| 29 public base::SupportsUserData::Data { | 29 public base::SupportsUserData::Data { |
| 30 public: | 30 public: |
| 31 explicit GuestViewManager(content::BrowserContext* context); | 31 explicit GuestViewManager(content::BrowserContext* context); |
| 32 virtual ~GuestViewManager(); | 32 ~GuestViewManager() override; |
| 33 | 33 |
| 34 static GuestViewManager* FromBrowserContext(content::BrowserContext* context); | 34 static GuestViewManager* FromBrowserContext(content::BrowserContext* context); |
| 35 | 35 |
| 36 // Overrides factory for testing. Default (NULL) value indicates regular | 36 // Overrides factory for testing. Default (NULL) value indicates regular |
| 37 // (non-test) environment. | 37 // (non-test) environment. |
| 38 static void set_factory_for_testing(GuestViewManagerFactory* factory) { | 38 static void set_factory_for_testing(GuestViewManagerFactory* factory) { |
| 39 GuestViewManager::factory_ = factory; | 39 GuestViewManager::factory_ = factory; |
| 40 } | 40 } |
| 41 // Returns the guest WebContents associated with the given |guest_instance_id| | 41 // Returns the guest WebContents associated with the given |guest_instance_id| |
| 42 // if the provided |embedder_render_process_id| is allowed to access it. | 42 // if the provided |embedder_render_process_id| is allowed to access it. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 72 content::WebContents* CreateGuestWithWebContentsParams( | 72 content::WebContents* CreateGuestWithWebContentsParams( |
| 73 const std::string& view_type, | 73 const std::string& view_type, |
| 74 const std::string& embedder_extension_id, | 74 const std::string& embedder_extension_id, |
| 75 content::WebContents* embedder_web_contents, | 75 content::WebContents* embedder_web_contents, |
| 76 const content::WebContents::CreateParams& create_params); | 76 const content::WebContents::CreateParams& create_params); |
| 77 | 77 |
| 78 content::SiteInstance* GetGuestSiteInstance( | 78 content::SiteInstance* GetGuestSiteInstance( |
| 79 const GURL& guest_site); | 79 const GURL& guest_site); |
| 80 | 80 |
| 81 // BrowserPluginGuestManager implementation. | 81 // BrowserPluginGuestManager implementation. |
| 82 virtual content::WebContents* GetGuestByInstanceID( | 82 content::WebContents* GetGuestByInstanceID( |
| 83 content::WebContents* embedder_web_contents, | 83 content::WebContents* embedder_web_contents, |
| 84 int element_instance_id) override; | 84 int element_instance_id) override; |
| 85 virtual bool ForEachGuest(content::WebContents* embedder_web_contents, | 85 bool ForEachGuest(content::WebContents* embedder_web_contents, |
| 86 const GuestCallback& callback) override; | 86 const GuestCallback& callback) override; |
| 87 |
| 87 protected: | 88 protected: |
| 88 friend class GuestViewBase; | 89 friend class GuestViewBase; |
| 89 FRIEND_TEST_ALL_PREFIXES(GuestViewManagerTest, AddRemove); | 90 FRIEND_TEST_ALL_PREFIXES(GuestViewManagerTest, AddRemove); |
| 90 | 91 |
| 91 // Can be overriden in tests. | 92 // Can be overriden in tests. |
| 92 virtual void AddGuest(int guest_instance_id, | 93 virtual void AddGuest(int guest_instance_id, |
| 93 content::WebContents* guest_web_contents); | 94 content::WebContents* guest_web_contents); |
| 94 | 95 |
| 95 // Can be overriden in tests. | 96 // Can be overriden in tests. |
| 96 virtual void RemoveGuest(int guest_instance_id); | 97 virtual void RemoveGuest(int guest_instance_id); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 std::set<int> removed_instance_ids_; | 150 std::set<int> removed_instance_ids_; |
| 150 | 151 |
| 151 content::BrowserContext* context_; | 152 content::BrowserContext* context_; |
| 152 | 153 |
| 153 DISALLOW_COPY_AND_ASSIGN(GuestViewManager); | 154 DISALLOW_COPY_AND_ASSIGN(GuestViewManager); |
| 154 }; | 155 }; |
| 155 | 156 |
| 156 } // namespace extensions | 157 } // namespace extensions |
| 157 | 158 |
| 158 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ | 159 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ |
| OLD | NEW |