| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 content::SiteInstance* GetGuestSiteInstance( | 86 content::SiteInstance* GetGuestSiteInstance( |
| 87 const GURL& guest_site); | 87 const GURL& guest_site); |
| 88 | 88 |
| 89 // BrowserPluginGuestManager implementation. | 89 // BrowserPluginGuestManager implementation. |
| 90 content::WebContents* GetGuestByInstanceID( | 90 content::WebContents* GetGuestByInstanceID( |
| 91 int owner_process_id, | 91 int owner_process_id, |
| 92 int element_instance_id) override; | 92 int element_instance_id) override; |
| 93 bool ForEachGuest(content::WebContents* owner_web_contents, | 93 bool ForEachGuest(content::WebContents* owner_web_contents, |
| 94 const GuestCallback& callback) override; | 94 const GuestCallback& callback) override; |
| 95 content::WebContents* GetFullPageGuest( |
| 96 content::WebContents* embedder_web_contents) override; |
| 95 | 97 |
| 96 protected: | 98 protected: |
| 97 friend class GuestViewBase; | 99 friend class GuestViewBase; |
| 98 FRIEND_TEST_ALL_PREFIXES(GuestViewManagerTest, AddRemove); | 100 FRIEND_TEST_ALL_PREFIXES(GuestViewManagerTest, AddRemove); |
| 99 | 101 |
| 100 // Can be overriden in tests. | 102 // Can be overriden in tests. |
| 101 virtual void AddGuest(int guest_instance_id, | 103 virtual void AddGuest(int guest_instance_id, |
| 102 content::WebContents* guest_web_contents); | 104 content::WebContents* guest_web_contents); |
| 103 | 105 |
| 104 // Can be overriden in tests. | 106 // Can be overriden in tests. |
| 105 virtual void RemoveGuest(int guest_instance_id); | 107 virtual void RemoveGuest(int guest_instance_id); |
| 106 | 108 |
| 107 content::WebContents* GetGuestByInstanceID(int guest_instance_id); | 109 content::WebContents* GetGuestByInstanceID(int guest_instance_id); |
| 108 | 110 |
| 109 bool CanEmbedderAccessInstanceIDMaybeKill( | 111 bool CanEmbedderAccessInstanceIDMaybeKill( |
| 110 int embedder_render_process_id, | 112 int embedder_render_process_id, |
| 111 int guest_instance_id); | 113 int guest_instance_id); |
| 112 | 114 |
| 113 bool CanEmbedderAccessInstanceID(int embedder_render_process_id, | 115 bool CanEmbedderAccessInstanceID(int embedder_render_process_id, |
| 114 int guest_instance_id); | 116 int guest_instance_id); |
| 115 | 117 |
| 116 // Returns true if |guest_instance_id| can be used to add a new guest to this | 118 // Returns true if |guest_instance_id| can be used to add a new guest to this |
| 117 // manager. | 119 // manager. |
| 118 // We disallow adding new guest with instance IDs that were previously removed | 120 // We disallow adding new guest with instance IDs that were previously removed |
| 119 // from this manager using RemoveGuest. | 121 // from this manager using RemoveGuest. |
| 120 bool CanUseGuestInstanceID(int guest_instance_id); | 122 bool CanUseGuestInstanceID(int guest_instance_id); |
| 121 | 123 |
| 124 static bool GetFullPageGuestHelper(content::WebContents** result, |
| 125 content::WebContents* guest_web_contents); |
| 126 |
| 122 // Static factory instance (always NULL for non-test). | 127 // Static factory instance (always NULL for non-test). |
| 123 static GuestViewManagerFactory* factory_; | 128 static GuestViewManagerFactory* factory_; |
| 124 | 129 |
| 125 // Contains guests' WebContents, mapping from their instance ids. | 130 // Contains guests' WebContents, mapping from their instance ids. |
| 126 using GuestInstanceMap = std::map<int, content::WebContents*>; | 131 using GuestInstanceMap = std::map<int, content::WebContents*>; |
| 127 GuestInstanceMap guest_web_contents_by_instance_id_; | 132 GuestInstanceMap guest_web_contents_by_instance_id_; |
| 128 | 133 |
| 129 struct ElementInstanceKey { | 134 struct ElementInstanceKey { |
| 130 int embedder_process_id; | 135 int embedder_process_id; |
| 131 int element_instance_id; | 136 int element_instance_id; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 157 std::set<int> removed_instance_ids_; | 162 std::set<int> removed_instance_ids_; |
| 158 | 163 |
| 159 content::BrowserContext* context_; | 164 content::BrowserContext* context_; |
| 160 | 165 |
| 161 DISALLOW_COPY_AND_ASSIGN(GuestViewManager); | 166 DISALLOW_COPY_AND_ASSIGN(GuestViewManager); |
| 162 }; | 167 }; |
| 163 | 168 |
| 164 } // namespace extensions | 169 } // namespace extensions |
| 165 | 170 |
| 166 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ | 171 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ |
| OLD | NEW |