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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // Associates the Browser Plugin with |element_instance_id| to a | 50 // Associates the Browser Plugin with |element_instance_id| to a |
51 // guest that has ID of |guest_instance_id| and sets initialization | 51 // guest that has ID of |guest_instance_id| and sets initialization |
52 // parameters, |params| for it. | 52 // parameters, |params| for it. |
53 void AttachGuest(int embedder_render_process_id, | 53 void AttachGuest(int embedder_render_process_id, |
54 int embedder_routing_id, | 54 int embedder_routing_id, |
55 int element_instance_id, | 55 int element_instance_id, |
56 int guest_instance_id, | 56 int guest_instance_id, |
57 const base::DictionaryValue& attach_params); | 57 const base::DictionaryValue& attach_params); |
58 | 58 |
59 int GetNextInstanceID(); | 59 int GetNextInstanceID(); |
60 int GetGuestInstanceIDForPluginID( | 60 int GetGuestInstanceIDForElementID( |
61 content::WebContents* embedder_web_contents, | 61 content::WebContents* embedder_web_contents, |
62 int element_instance_id); | 62 int element_instance_id); |
63 | 63 |
64 | |
65 typedef base::Callback<void(content::WebContents*)> | 64 typedef base::Callback<void(content::WebContents*)> |
66 WebContentsCreatedCallback; | 65 WebContentsCreatedCallback; |
67 void CreateGuest(const std::string& view_type, | 66 void CreateGuest(const std::string& view_type, |
68 const std::string& embedder_extension_id, | 67 const std::string& embedder_extension_id, |
69 content::WebContents* embedder_web_contents, | 68 content::WebContents* embedder_web_contents, |
70 const base::DictionaryValue& create_params, | 69 const base::DictionaryValue& create_params, |
71 const WebContentsCreatedCallback& callback); | 70 const WebContentsCreatedCallback& callback); |
72 | 71 |
73 content::WebContents* CreateGuestWithWebContentsParams( | 72 content::WebContents* CreateGuestWithWebContentsParams( |
74 const std::string& view_type, | 73 const std::string& view_type, |
75 const std::string& embedder_extension_id, | 74 const std::string& embedder_extension_id, |
76 int embedder_render_process_id, | 75 int embedder_render_process_id, |
77 const content::WebContents::CreateParams& create_params); | 76 const content::WebContents::CreateParams& create_params); |
78 | 77 |
79 content::SiteInstance* GetGuestSiteInstance( | 78 content::SiteInstance* GetGuestSiteInstance( |
80 const GURL& guest_site); | 79 const GURL& guest_site); |
81 | 80 |
82 // BrowserPluginGuestManager implementation. | 81 // BrowserPluginGuestManager implementation. |
83 virtual void MaybeGetGuestByInstanceIDOrKill( | 82 virtual content::WebContents* GetGuestByInstanceID( |
84 content::WebContents* embedder_web_contents, | 83 content::WebContents* embedder_web_contents, |
85 int element_instance_id, | 84 int element_instance_id) OVERRIDE; |
86 const GuestByInstanceIDCallback& callback) OVERRIDE; | |
87 virtual bool ForEachGuest(content::WebContents* embedder_web_contents, | 85 virtual bool ForEachGuest(content::WebContents* embedder_web_contents, |
88 const GuestCallback& callback) OVERRIDE; | 86 const GuestCallback& callback) OVERRIDE; |
89 protected: | 87 protected: |
90 friend class GuestViewBase; | 88 friend class GuestViewBase; |
91 FRIEND_TEST_ALL_PREFIXES(GuestViewManagerTest, AddRemove); | 89 FRIEND_TEST_ALL_PREFIXES(GuestViewManagerTest, AddRemove); |
92 | 90 |
93 // Can be overriden in tests. | 91 // Can be overriden in tests. |
94 virtual void AddGuest(int guest_instance_id, | 92 virtual void AddGuest(int guest_instance_id, |
95 content::WebContents* guest_web_contents); | 93 content::WebContents* guest_web_contents); |
96 | 94 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 std::set<int> removed_instance_ids_; | 148 std::set<int> removed_instance_ids_; |
151 | 149 |
152 content::BrowserContext* context_; | 150 content::BrowserContext* context_; |
153 | 151 |
154 DISALLOW_COPY_AND_ASSIGN(GuestViewManager); | 152 DISALLOW_COPY_AND_ASSIGN(GuestViewManager); |
155 }; | 153 }; |
156 | 154 |
157 } // namespace extensions | 155 } // namespace extensions |
158 | 156 |
159 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ | 157 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ |
OLD | NEW |