Chromium Code Reviews| 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 COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_MANAGER_H_ | 5 #ifndef COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_MANAGER_H_ |
| 6 #define COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_MANAGER_H_ | 6 #define COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 } | 55 } |
| 56 // Returns the guest WebContents associated with the given |guest_instance_id| | 56 // Returns the guest WebContents associated with the given |guest_instance_id| |
| 57 // if the provided |embedder_render_process_id| is allowed to access it. | 57 // if the provided |embedder_render_process_id| is allowed to access it. |
| 58 // If the embedder is not allowed access, the embedder will be killed, and | 58 // If the embedder is not allowed access, the embedder will be killed, and |
| 59 // this method will return NULL. If no WebContents exists with the given | 59 // this method will return NULL. If no WebContents exists with the given |
| 60 // instance ID, then NULL will also be returned. | 60 // instance ID, then NULL will also be returned. |
| 61 content::WebContents* GetGuestByInstanceIDSafely( | 61 content::WebContents* GetGuestByInstanceIDSafely( |
| 62 int guest_instance_id, | 62 int guest_instance_id, |
| 63 int embedder_render_process_id); | 63 int embedder_render_process_id); |
| 64 | 64 |
| 65 // Associates the Browser Plugin with |element_instance_id| to a | 65 // Associates the Browser Plugin with |element_instance_id| to a guest that |
| 66 // guest that has ID of |guest_instance_id| and sets initialization | 66 // has ID of |guest_instance_id| and sets initialization parameters, |params| |
| 67 // parameters, |params| for it. | 67 // for it. The embedder frame is identified by the pair of |
| 68 // |embedder_process_id| and |embedder_routing_id|. | |
| 68 void AttachGuest(int embedder_process_id, | 69 void AttachGuest(int embedder_process_id, |
| 70 int embedder_routing_id, | |
| 69 int element_instance_id, | 71 int element_instance_id, |
| 70 int guest_instance_id, | 72 int guest_instance_id, |
| 71 const base::DictionaryValue& attach_params); | 73 const base::DictionaryValue& attach_params); |
| 72 | 74 |
| 73 // Removes the association between |element_instance_id| and a guest instance | 75 // Removes the association between |element_instance_id| and a guest instance |
| 74 // ID if one exists. | 76 // ID if one exists. |
| 75 void DetachGuest(GuestViewBase* guest); | 77 void DetachGuest(GuestViewBase* guest); |
| 76 | 78 |
| 77 // Indicates whether the |guest| is owned by an extension or Chrome App. | 79 // Indicates whether the |guest| is owned by an extension or Chrome App. |
| 78 bool IsOwnedByExtension(GuestViewBase* guest); | 80 bool IsOwnedByExtension(GuestViewBase* guest); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 259 // This tracks which GuestView embedders are currently being observed. | 261 // This tracks which GuestView embedders are currently being observed. |
| 260 std::set<int> embedders_observed_; | 262 std::set<int> embedders_observed_; |
| 261 | 263 |
| 262 // |view_destruction_callback_map_| maps from embedder process ID to view ID | 264 // |view_destruction_callback_map_| maps from embedder process ID to view ID |
| 263 // to a vector of callback functions to be called when that view is destroyed. | 265 // to a vector of callback functions to be called when that view is destroyed. |
| 264 using Callbacks = std::vector<base::Closure>; | 266 using Callbacks = std::vector<base::Closure>; |
| 265 using CallbacksForEachViewID = std::map<int, Callbacks>; | 267 using CallbacksForEachViewID = std::map<int, Callbacks>; |
| 266 using CallbacksForEachEmbedderID = std::map<int, CallbacksForEachViewID>; | 268 using CallbacksForEachEmbedderID = std::map<int, CallbacksForEachViewID>; |
| 267 CallbacksForEachEmbedderID view_destruction_callback_map_; | 269 CallbacksForEachEmbedderID view_destruction_callback_map_; |
| 268 | 270 |
| 271 // The routing ID of the embedder which most recently sent an attach request. | |
| 272 // We use this value to later identify the RenderFrameHost and WebContents | |
| 273 // which embed the guest. This is mainly used for MimeHandlerViewGuest and | |
| 274 // specifically when the guest is embedded inside a cross origin frame. | |
| 275 int attaching_guest_embedder_routing_id_; | |
|
Charlie Reis
2016/10/18 22:52:20
Routing IDs can only be used in conjunction with a
EhsanK
2016/10/20 21:41:17
It comes later when the attach request arrives (wh
| |
| 276 | |
| 269 // This is used to ensure that an EmbedderRenderProcessHostObserver will not | 277 // This is used to ensure that an EmbedderRenderProcessHostObserver will not |
| 270 // call into this GuestViewManager after it has been destroyed. | 278 // call into this GuestViewManager after it has been destroyed. |
| 271 base::WeakPtrFactory<GuestViewManager> weak_ptr_factory_; | 279 base::WeakPtrFactory<GuestViewManager> weak_ptr_factory_; |
| 272 | 280 |
| 273 private: | 281 private: |
| 274 DISALLOW_COPY_AND_ASSIGN(GuestViewManager); | 282 DISALLOW_COPY_AND_ASSIGN(GuestViewManager); |
| 275 }; | 283 }; |
| 276 | 284 |
| 277 } // namespace guest_view | 285 } // namespace guest_view |
| 278 | 286 |
| 279 #endif // COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_MANAGER_H_ | 287 #endif // COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_MANAGER_H_ |
| OLD | NEW |