| 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 COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_MANAGER_H_ |
| 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ | 6 #define COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "content/public/browser/browser_plugin_guest_manager.h" | 14 #include "content/public/browser/browser_plugin_guest_manager.h" |
| 15 #include "content/public/browser/site_instance.h" | 15 #include "content/public/browser/site_instance.h" |
| 16 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 17 | 17 |
| 18 class GURL; | 18 class GURL; |
| 19 | 19 |
| 20 namespace content { | 20 namespace content { |
| 21 class BrowserContext; | 21 class BrowserContext; |
| 22 class WebContents; | 22 class WebContents; |
| 23 } // namespace content | 23 } // namespace content |
| 24 | 24 |
| 25 namespace guestview { | 25 namespace guest_view { |
| 26 |
| 27 class GuestViewBase; |
| 26 class GuestViewManagerDelegate; | 28 class GuestViewManagerDelegate; |
| 27 } // namespace guestview | |
| 28 | |
| 29 namespace extensions{ | |
| 30 class GuestViewBase; | |
| 31 class GuestViewManagerFactory; | 29 class GuestViewManagerFactory; |
| 32 | 30 |
| 33 class GuestViewManager : public content::BrowserPluginGuestManager, | 31 class GuestViewManager : public content::BrowserPluginGuestManager, |
| 34 public base::SupportsUserData::Data { | 32 public base::SupportsUserData::Data { |
| 35 public: | 33 public: |
| 36 GuestViewManager(content::BrowserContext* context, | 34 GuestViewManager(content::BrowserContext* context, |
| 37 scoped_ptr<guestview::GuestViewManagerDelegate> delegate); | 35 scoped_ptr<GuestViewManagerDelegate> delegate); |
| 38 ~GuestViewManager() override; | 36 ~GuestViewManager() override; |
| 39 | 37 |
| 40 // Returns the GuestViewManager associated with |context|. If one isn't | 38 // Returns the GuestViewManager associated with |context|. If one isn't |
| 41 // available, then it is created and returned. | 39 // available, then it is created and returned. |
| 42 static GuestViewManager* CreateWithDelegate( | 40 static GuestViewManager* CreateWithDelegate( |
| 43 content::BrowserContext* context, | 41 content::BrowserContext* context, |
| 44 scoped_ptr<guestview::GuestViewManagerDelegate> delegate); | 42 scoped_ptr<GuestViewManagerDelegate> delegate); |
| 45 | 43 |
| 46 // Returns the GuestViewManager associated with |context|. If one isn't | 44 // Returns the GuestViewManager associated with |context|. If one isn't |
| 47 // available, then nullptr is returned. | 45 // available, then nullptr is returned. |
| 48 static GuestViewManager* FromBrowserContext(content::BrowserContext* context); | 46 static GuestViewManager* FromBrowserContext(content::BrowserContext* context); |
| 49 | 47 |
| 50 // Overrides factory for testing. Default (NULL) value indicates regular | 48 // Overrides factory for testing. Default (NULL) value indicates regular |
| 51 // (non-test) environment. | 49 // (non-test) environment. |
| 52 static void set_factory_for_testing(GuestViewManagerFactory* factory) { | 50 static void set_factory_for_testing(GuestViewManagerFactory* factory) { |
| 53 GuestViewManager::factory_ = factory; | 51 GuestViewManager::factory_ = factory; |
| 54 } | 52 } |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 // RemoveGuest. | 195 // RemoveGuest. |
| 198 // This is used so that we don't have store all removed instance IDs in | 196 // This is used so that we don't have store all removed instance IDs in |
| 199 // |removed_instance_ids_|. | 197 // |removed_instance_ids_|. |
| 200 int last_instance_id_removed_; | 198 int last_instance_id_removed_; |
| 201 // The remaining instance IDs that are greater than | 199 // The remaining instance IDs that are greater than |
| 202 // |last_instance_id_removed_| are kept here. | 200 // |last_instance_id_removed_| are kept here. |
| 203 std::set<int> removed_instance_ids_; | 201 std::set<int> removed_instance_ids_; |
| 204 | 202 |
| 205 content::BrowserContext* context_; | 203 content::BrowserContext* context_; |
| 206 | 204 |
| 207 scoped_ptr<guestview::GuestViewManagerDelegate> delegate_; | 205 scoped_ptr<GuestViewManagerDelegate> delegate_; |
| 208 | 206 |
| 209 DISALLOW_COPY_AND_ASSIGN(GuestViewManager); | 207 DISALLOW_COPY_AND_ASSIGN(GuestViewManager); |
| 210 }; | 208 }; |
| 211 | 209 |
| 212 } // namespace extensions | 210 } // namespace guest_view |
| 213 | 211 |
| 214 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ | 212 #endif // COMPONETS_GUEST_VIEW_BROWSER_GUEST_VIEW_MANAGER_H_ |
| OLD | NEW |