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 13 matching lines...) Expand all Loading... |
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 ~GuestViewManager() override; | 32 ~GuestViewManager() override; |
33 | 33 |
| 34 // Returns the GuestViewManager associated with |context|. If one isn't |
| 35 // available, then it is created and returned. |
34 static GuestViewManager* FromBrowserContext(content::BrowserContext* context); | 36 static GuestViewManager* FromBrowserContext(content::BrowserContext* context); |
35 | 37 |
| 38 // Returns the GuestViewManager associated with |context|. If one isn't |
| 39 // available, then nullptr is returned. |
| 40 static GuestViewManager* FromBrowserContextIfAvailable( |
| 41 content::BrowserContext* context); |
| 42 |
36 // Overrides factory for testing. Default (NULL) value indicates regular | 43 // Overrides factory for testing. Default (NULL) value indicates regular |
37 // (non-test) environment. | 44 // (non-test) environment. |
38 static void set_factory_for_testing(GuestViewManagerFactory* factory) { | 45 static void set_factory_for_testing(GuestViewManagerFactory* factory) { |
39 GuestViewManager::factory_ = factory; | 46 GuestViewManager::factory_ = factory; |
40 } | 47 } |
41 // Returns the guest WebContents associated with the given |guest_instance_id| | 48 // Returns the guest WebContents associated with the given |guest_instance_id| |
42 // if the provided |embedder_render_process_id| is allowed to access it. | 49 // if the provided |embedder_render_process_id| is allowed to access it. |
43 // If the embedder is not allowed access, the embedder will be killed, and | 50 // If the embedder is not allowed access, the embedder will be killed, and |
44 // this method will return NULL. If no WebContents exists with the given | 51 // this method will return NULL. If no WebContents exists with the given |
45 // instance ID, then NULL will also be returned. | 52 // instance ID, then NULL will also be returned. |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 std::set<int> removed_instance_ids_; | 171 std::set<int> removed_instance_ids_; |
165 | 172 |
166 content::BrowserContext* context_; | 173 content::BrowserContext* context_; |
167 | 174 |
168 DISALLOW_COPY_AND_ASSIGN(GuestViewManager); | 175 DISALLOW_COPY_AND_ASSIGN(GuestViewManager); |
169 }; | 176 }; |
170 | 177 |
171 } // namespace extensions | 178 } // namespace extensions |
172 | 179 |
173 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ | 180 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ |
OLD | NEW |