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 #include "components/guest_view/browser/guest_view_manager.h" | 5 #include "components/guest_view/browser/guest_view_manager.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "components/guest_view/browser/guest_view_base.h" | 9 #include "components/guest_view/browser/guest_view_base.h" |
10 #include "components/guest_view/browser/guest_view_manager_delegate.h" | 10 #include "components/guest_view/browser/guest_view_manager_delegate.h" |
11 #include "components/guest_view/browser/guest_view_manager_factory.h" | 11 #include "components/guest_view/browser/guest_view_manager_factory.h" |
12 #include "components/guest_view/common/guest_view_constants.h" | 12 #include "components/guest_view/common/guest_view_constants.h" |
13 #include "content/public/browser/browser_context.h" | 13 #include "content/public/browser/browser_context.h" |
14 #include "content/public/browser/render_frame_host.h" | 14 #include "content/public/browser/render_frame_host.h" |
15 #include "content/public/browser/render_process_host.h" | 15 #include "content/public/browser/render_process_host.h" |
16 #include "content/public/browser/render_view_host.h" | 16 #include "content/public/browser/render_view_host.h" |
17 #include "content/public/browser/user_metrics.h" | 17 #include "content/public/browser/user_metrics.h" |
18 #include "content/public/browser/web_contents_observer.h" | 18 #include "content/public/browser/web_contents_observer.h" |
| 19 #include "content/public/browser/web_contents_source.h" |
19 #include "content/public/common/child_process_host.h" | 20 #include "content/public/common/child_process_host.h" |
20 #include "content/public/common/result_codes.h" | 21 #include "content/public/common/result_codes.h" |
21 #include "content/public/common/url_constants.h" | 22 #include "content/public/common/url_constants.h" |
22 #include "url/gurl.h" | 23 #include "url/gurl.h" |
23 | 24 |
24 using content::BrowserContext; | 25 using content::BrowserContext; |
25 using content::RenderProcessHost; | 26 using content::RenderProcessHost; |
26 using content::SiteInstance; | 27 using content::SiteInstance; |
27 using content::WebContents; | 28 using content::WebContents; |
28 | 29 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 content::WebContents* GuestViewManager::CreateGuestWithWebContentsParams( | 174 content::WebContents* GuestViewManager::CreateGuestWithWebContentsParams( |
174 const std::string& view_type, | 175 const std::string& view_type, |
175 content::WebContents* owner_web_contents, | 176 content::WebContents* owner_web_contents, |
176 const content::WebContents::CreateParams& create_params) { | 177 const content::WebContents::CreateParams& create_params) { |
177 auto guest = CreateGuestInternal(owner_web_contents, view_type); | 178 auto guest = CreateGuestInternal(owner_web_contents, view_type); |
178 if (!guest) | 179 if (!guest) |
179 return nullptr; | 180 return nullptr; |
180 content::WebContents::CreateParams guest_create_params(create_params); | 181 content::WebContents::CreateParams guest_create_params(create_params); |
181 guest_create_params.guest_delegate = guest; | 182 guest_create_params.guest_delegate = guest; |
182 auto guest_web_contents = WebContents::Create(guest_create_params); | 183 auto guest_web_contents = WebContents::Create(guest_create_params); |
| 184 WebContentsSource::CreateForWebContentsAndLocation(guest_web_contents, |
| 185 FROM_HERE); |
183 guest->InitWithWebContents(base::DictionaryValue(), guest_web_contents); | 186 guest->InitWithWebContents(base::DictionaryValue(), guest_web_contents); |
184 return guest_web_contents; | 187 return guest_web_contents; |
185 } | 188 } |
186 | 189 |
187 content::WebContents* GuestViewManager::GetGuestByInstanceID( | 190 content::WebContents* GuestViewManager::GetGuestByInstanceID( |
188 int owner_process_id, | 191 int owner_process_id, |
189 int element_instance_id) { | 192 int element_instance_id) { |
190 int guest_instance_id = GetGuestInstanceIDForElementID(owner_process_id, | 193 int guest_instance_id = GetGuestInstanceIDForElementID(owner_process_id, |
191 element_instance_id); | 194 element_instance_id); |
192 if (guest_instance_id == kInstanceIDNone) | 195 if (guest_instance_id == kInstanceIDNone) |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 } | 492 } |
490 | 493 |
491 GuestViewManager::GuestViewData::GuestViewData( | 494 GuestViewManager::GuestViewData::GuestViewData( |
492 const GuestViewCreateFunction& create_function, | 495 const GuestViewCreateFunction& create_function, |
493 const GuestViewCleanUpFunction& cleanup_function) | 496 const GuestViewCleanUpFunction& cleanup_function) |
494 : create_function(create_function), cleanup_function(cleanup_function) {} | 497 : create_function(create_function), cleanup_function(cleanup_function) {} |
495 | 498 |
496 GuestViewManager::GuestViewData::~GuestViewData() {} | 499 GuestViewManager::GuestViewData::~GuestViewData() {} |
497 | 500 |
498 } // namespace guest_view | 501 } // namespace guest_view |
OLD | NEW |