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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 // Create the SiteInstance in a new BrowsingInstance, which will ensure | 357 // Create the SiteInstance in a new BrowsingInstance, which will ensure |
358 // that webview tags are also not allowed to send messages across | 358 // that webview tags are also not allowed to send messages across |
359 // different partitions. | 359 // different partitions. |
360 guest_site_instance = content::SiteInstance::CreateForURL( | 360 guest_site_instance = content::SiteInstance::CreateForURL( |
361 owner_render_process_host->GetBrowserContext(), guest_site); | 361 owner_render_process_host->GetBrowserContext(), guest_site); |
362 } | 362 } |
363 WebContents::CreateParams params( | 363 WebContents::CreateParams params( |
364 owner_render_process_host->GetBrowserContext(), | 364 owner_render_process_host->GetBrowserContext(), |
365 std::move(guest_site_instance)); | 365 std::move(guest_site_instance)); |
366 params.guest_delegate = this; | 366 params.guest_delegate = this; |
367 callback.Run(WebContents::Create(params)); | 367 WebContents* new_contents = WebContents::Create(params); |
| 368 |
| 369 // Grant access to the origin of the embedder to the guest process. This |
| 370 // allows blob:/filesystem: URLs with the embedder origin to be created |
| 371 // inside the guest. It is possible to do this by running embedder code |
| 372 // through webview accessible_resources. |
| 373 content::ChildProcessSecurityPolicy::GetInstance()->GrantOrigin( |
| 374 new_contents->GetMainFrame()->GetProcess()->GetID(), |
| 375 url::Origin(GetOwnerSiteURL())); |
| 376 |
| 377 callback.Run(new_contents); |
368 } | 378 } |
369 | 379 |
370 void WebViewGuest::DidAttachToEmbedder() { | 380 void WebViewGuest::DidAttachToEmbedder() { |
371 ApplyAttributes(*attach_params()); | 381 ApplyAttributes(*attach_params()); |
372 } | 382 } |
373 | 383 |
374 void WebViewGuest::DidDropLink(const GURL& url) { | 384 void WebViewGuest::DidDropLink(const GURL& url) { |
375 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 385 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
376 args->SetString(guest_view::kUrl, url.spec()); | 386 args->SetString(guest_view::kUrl, url.spec()); |
377 DispatchEventToView(base::MakeUnique<GuestViewEvent>(webview::kEventDropLink, | 387 DispatchEventToView(base::MakeUnique<GuestViewEvent>(webview::kEventDropLink, |
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1508 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 1518 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
1509 DispatchEventToView(base::MakeUnique<GuestViewEvent>( | 1519 DispatchEventToView(base::MakeUnique<GuestViewEvent>( |
1510 webview::kEventExitFullscreen, std::move(args))); | 1520 webview::kEventExitFullscreen, std::move(args))); |
1511 } | 1521 } |
1512 // Since we changed fullscreen state, sending a Resize message ensures that | 1522 // Since we changed fullscreen state, sending a Resize message ensures that |
1513 // renderer/ sees the change. | 1523 // renderer/ sees the change. |
1514 web_contents()->GetRenderViewHost()->GetWidget()->WasResized(); | 1524 web_contents()->GetRenderViewHost()->GetWidget()->WasResized(); |
1515 } | 1525 } |
1516 | 1526 |
1517 } // namespace extensions | 1527 } // namespace extensions |
OLD | NEW |