Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(598)

Side by Side Diff: extensions/browser/guest_view/web_view/web_view_guest.cc

Issue 2399853003: [M54 merge] Lock down creation of blob:chrome-extension URLs from non-extension processes. (Closed)
Patch Set: Rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 1517 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
1508 DispatchEventToView(base::MakeUnique<GuestViewEvent>( 1518 DispatchEventToView(base::MakeUnique<GuestViewEvent>(
1509 webview::kEventExitFullscreen, std::move(args))); 1519 webview::kEventExitFullscreen, std::move(args)));
1510 } 1520 }
1511 // Since we changed fullscreen state, sending a Resize message ensures that 1521 // Since we changed fullscreen state, sending a Resize message ensures that
1512 // renderer/ sees the change. 1522 // renderer/ sees the change.
1513 web_contents()->GetRenderViewHost()->GetWidget()->WasResized(); 1523 web_contents()->GetRenderViewHost()->GetWidget()->WasResized();
1514 } 1524 }
1515 1525
1516 } // namespace extensions 1526 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698