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

Side by Side Diff: components/printing/renderer/print_web_view_helper.cc

Issue 2125263002: Explicitly set a requestor origin when calling into WebLocalFrame::loadRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: blink:: Created 4 years, 5 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
« no previous file with comments | « chrome/renderer/net/net_error_helper.cc ('k') | content/public/test/render_view_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/printing/renderer/print_web_view_helper.h" 5 #include "components/printing/renderer/print_web_view_helper.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 14 matching lines...) Expand all
25 #include "components/printing/common/print_messages.h" 25 #include "components/printing/common/print_messages.h"
26 #include "content/public/common/web_preferences.h" 26 #include "content/public/common/web_preferences.h"
27 #include "content/public/renderer/render_frame.h" 27 #include "content/public/renderer/render_frame.h"
28 #include "content/public/renderer/render_thread.h" 28 #include "content/public/renderer/render_thread.h"
29 #include "content/public/renderer/render_view.h" 29 #include "content/public/renderer/render_view.h"
30 #include "grit/components_resources.h" 30 #include "grit/components_resources.h"
31 #include "net/base/escape.h" 31 #include "net/base/escape.h"
32 #include "printing/metafile_skia_wrapper.h" 32 #include "printing/metafile_skia_wrapper.h"
33 #include "printing/pdf_metafile_skia.h" 33 #include "printing/pdf_metafile_skia.h"
34 #include "printing/units.h" 34 #include "printing/units.h"
35 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
35 #include "third_party/WebKit/public/platform/WebSize.h" 36 #include "third_party/WebKit/public/platform/WebSize.h"
36 #include "third_party/WebKit/public/platform/WebURLRequest.h" 37 #include "third_party/WebKit/public/platform/WebURLRequest.h"
37 #include "third_party/WebKit/public/web/WebConsoleMessage.h" 38 #include "third_party/WebKit/public/web/WebConsoleMessage.h"
38 #include "third_party/WebKit/public/web/WebDocument.h" 39 #include "third_party/WebKit/public/web/WebDocument.h"
39 #include "third_party/WebKit/public/web/WebElement.h" 40 #include "third_party/WebKit/public/web/WebElement.h"
40 #include "third_party/WebKit/public/web/WebFrameClient.h" 41 #include "third_party/WebKit/public/web/WebFrameClient.h"
41 #include "third_party/WebKit/public/web/WebFrameOwnerProperties.h" 42 #include "third_party/WebKit/public/web/WebFrameOwnerProperties.h"
42 #include "third_party/WebKit/public/web/WebLocalFrame.h" 43 #include "third_party/WebKit/public/web/WebLocalFrame.h"
43 #include "third_party/WebKit/public/web/WebPlugin.h" 44 #include "third_party/WebKit/public/web/WebPlugin.h"
44 #include "third_party/WebKit/public/web/WebPluginDocument.h" 45 #include "third_party/WebKit/public/web/WebPluginDocument.h"
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 blink::WebView::create(this, blink::WebPageVisibilityStateVisible); 745 blink::WebView::create(this, blink::WebPageVisibilityStateVisible);
745 owns_web_view_ = true; 746 owns_web_view_ = true;
746 content::RenderView::ApplyWebPreferences(prefs, web_view); 747 content::RenderView::ApplyWebPreferences(prefs, web_view);
747 web_view->setMainFrame( 748 web_view->setMainFrame(
748 blink::WebLocalFrame::create(blink::WebTreeScopeType::Document, this)); 749 blink::WebLocalFrame::create(blink::WebTreeScopeType::Document, this));
749 frame_.Reset(web_view->mainFrame()->toWebLocalFrame()); 750 frame_.Reset(web_view->mainFrame()->toWebLocalFrame());
750 node_to_print_.reset(); 751 node_to_print_.reset();
751 752
752 // When loading is done this will call didStopLoading() and that will do the 753 // When loading is done this will call didStopLoading() and that will do the
753 // actual printing. 754 // actual printing.
754 frame()->loadRequest(blink::WebURLRequest(GURL(url_str))); 755 blink::WebURLRequest request = blink::WebURLRequest(GURL(url_str));
756 request.setRequestorOrigin(blink::WebSecurityOrigin::createUnique());
757 frame()->loadRequest(request);
755 } 758 }
756 759
757 bool PrepareFrameAndViewForPrint::allowsBrokenNullLayerTreeView() const { 760 bool PrepareFrameAndViewForPrint::allowsBrokenNullLayerTreeView() const {
758 return true; 761 return true;
759 } 762 }
760 763
761 void PrepareFrameAndViewForPrint::didStopLoading() { 764 void PrepareFrameAndViewForPrint::didStopLoading() {
762 DCHECK(!on_ready_.is_null()); 765 DCHECK(!on_ready_.is_null());
763 // Don't call callback here, because it can delete |this| and WebView that is 766 // Don't call callback here, because it can delete |this| and WebView that is
764 // called didStopLoading. 767 // called didStopLoading.
(...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after
2252 blink::WebConsoleMessage::LevelWarning, message)); 2255 blink::WebConsoleMessage::LevelWarning, message));
2253 return false; 2256 return false;
2254 } 2257 }
2255 2258
2256 void PrintWebViewHelper::ScriptingThrottler::Reset() { 2259 void PrintWebViewHelper::ScriptingThrottler::Reset() {
2257 // Reset counter on successful print. 2260 // Reset counter on successful print.
2258 count_ = 0; 2261 count_ = 0;
2259 } 2262 }
2260 2263
2261 } // namespace printing 2264 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/renderer/net/net_error_helper.cc ('k') | content/public/test/render_view_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698