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