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 "extensions/browser/guest_view/web_view/web_view_guest.h" | 5 #include "extensions/browser/guest_view/web_view/web_view_guest.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 // Set the attach params to use the same partition as the opener. | 537 // Set the attach params to use the same partition as the opener. |
538 // We pull the partition information from the site's URL, which is of the | 538 // We pull the partition information from the site's URL, which is of the |
539 // form guest://site/{persist}?{partition_name}. | 539 // form guest://site/{persist}?{partition_name}. |
540 const GURL& site_url = web_contents()->GetSiteInstance()->GetSiteURL(); | 540 const GURL& site_url = web_contents()->GetSiteInstance()->GetSiteURL(); |
541 const std::string storage_partition_id = | 541 const std::string storage_partition_id = |
542 GetStoragePartitionIdFromSiteURL(site_url); | 542 GetStoragePartitionIdFromSiteURL(site_url); |
543 base::DictionaryValue create_params; | 543 base::DictionaryValue create_params; |
544 create_params.SetString(webview::kStoragePartitionId, storage_partition_id); | 544 create_params.SetString(webview::kStoragePartitionId, storage_partition_id); |
545 | 545 |
546 guest_manager->CreateGuest(WebViewGuest::Type, | 546 guest_manager->CreateGuest(WebViewGuest::Type, |
547 owner_extension_id(), | |
548 embedder_web_contents(), | 547 embedder_web_contents(), |
549 create_params, | 548 create_params, |
550 base::Bind(&WebViewGuest::NewGuestWebViewCallback, | 549 base::Bind(&WebViewGuest::NewGuestWebViewCallback, |
551 weak_ptr_factory_.GetWeakPtr(), | 550 weak_ptr_factory_.GetWeakPtr(), |
552 params)); | 551 params)); |
553 } | 552 } |
554 | 553 |
555 void WebViewGuest::NewGuestWebViewCallback( | 554 void WebViewGuest::NewGuestWebViewCallback( |
556 const content::OpenURLParams& params, | 555 const content::OpenURLParams& params, |
557 content::WebContents* guest_web_contents) { | 556 content::WebContents* guest_web_contents) { |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 web_contents->GetRenderProcessHost()->GetID(), | 872 web_contents->GetRenderProcessHost()->GetID(), |
874 web_contents->GetRoutingID())); | 873 web_contents->GetRoutingID())); |
875 } | 874 } |
876 | 875 |
877 content::WebContents* WebViewGuest::CreateNewGuestWindow( | 876 content::WebContents* WebViewGuest::CreateNewGuestWindow( |
878 const content::WebContents::CreateParams& create_params) { | 877 const content::WebContents::CreateParams& create_params) { |
879 GuestViewManager* guest_manager = | 878 GuestViewManager* guest_manager = |
880 GuestViewManager::FromBrowserContext(browser_context()); | 879 GuestViewManager::FromBrowserContext(browser_context()); |
881 return guest_manager->CreateGuestWithWebContentsParams( | 880 return guest_manager->CreateGuestWithWebContentsParams( |
882 WebViewGuest::Type, | 881 WebViewGuest::Type, |
883 owner_extension_id(), | |
884 embedder_web_contents(), | 882 embedder_web_contents(), |
885 create_params); | 883 create_params); |
886 } | 884 } |
887 | 885 |
888 void WebViewGuest::RequestMediaAccessPermission( | 886 void WebViewGuest::RequestMediaAccessPermission( |
889 content::WebContents* source, | 887 content::WebContents* source, |
890 const content::MediaStreamRequest& request, | 888 const content::MediaStreamRequest& request, |
891 const content::MediaResponseCallback& callback) { | 889 const content::MediaResponseCallback& callback) { |
892 web_view_permission_helper_->RequestMediaAccessPermission(source, | 890 web_view_permission_helper_->RequestMediaAccessPermission(source, |
893 request, | 891 request, |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1273 WebViewGuest::From(owner_web_contents()->GetRenderProcessHost()->GetID(), | 1271 WebViewGuest::From(owner_web_contents()->GetRenderProcessHost()->GetID(), |
1274 new_window_instance_id); | 1272 new_window_instance_id); |
1275 if (!guest) | 1273 if (!guest) |
1276 return; | 1274 return; |
1277 | 1275 |
1278 if (!allow) | 1276 if (!allow) |
1279 guest->Destroy(); | 1277 guest->Destroy(); |
1280 } | 1278 } |
1281 | 1279 |
1282 } // namespace extensions | 1280 } // namespace extensions |
OLD | NEW |