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

Side by Side Diff: android_webview/renderer/print_web_view_helper.cc

Issue 867853002: Fix prototype for WebFrameClient::createChildFrame() in android_webview. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // TODO(sgurun) copied from chrome/renderer. Remove after crbug.com/322276 5 // TODO(sgurun) copied from chrome/renderer. Remove after crbug.com/322276
6 6
7 #include "android_webview/renderer/print_web_view_helper.h" 7 #include "android_webview/renderer/print_web_view_helper.h"
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 18 matching lines...) Expand all
29 #include "third_party/WebKit/public/platform/WebURLRequest.h" 29 #include "third_party/WebKit/public/platform/WebURLRequest.h"
30 #include "third_party/WebKit/public/web/WebConsoleMessage.h" 30 #include "third_party/WebKit/public/web/WebConsoleMessage.h"
31 #include "third_party/WebKit/public/web/WebDocument.h" 31 #include "third_party/WebKit/public/web/WebDocument.h"
32 #include "third_party/WebKit/public/web/WebElement.h" 32 #include "third_party/WebKit/public/web/WebElement.h"
33 #include "third_party/WebKit/public/web/WebFrameClient.h" 33 #include "third_party/WebKit/public/web/WebFrameClient.h"
34 #include "third_party/WebKit/public/web/WebLocalFrame.h" 34 #include "third_party/WebKit/public/web/WebLocalFrame.h"
35 #include "third_party/WebKit/public/web/WebPlugin.h" 35 #include "third_party/WebKit/public/web/WebPlugin.h"
36 #include "third_party/WebKit/public/web/WebPluginDocument.h" 36 #include "third_party/WebKit/public/web/WebPluginDocument.h"
37 #include "third_party/WebKit/public/web/WebPrintParams.h" 37 #include "third_party/WebKit/public/web/WebPrintParams.h"
38 #include "third_party/WebKit/public/web/WebPrintScalingOption.h" 38 #include "third_party/WebKit/public/web/WebPrintScalingOption.h"
39 #include "third_party/WebKit/public/web/WebSandboxFlags.h"
39 #include "third_party/WebKit/public/web/WebScriptSource.h" 40 #include "third_party/WebKit/public/web/WebScriptSource.h"
40 #include "third_party/WebKit/public/web/WebSettings.h" 41 #include "third_party/WebKit/public/web/WebSettings.h"
41 #include "third_party/WebKit/public/web/WebView.h" 42 #include "third_party/WebKit/public/web/WebView.h"
42 #include "third_party/WebKit/public/web/WebViewClient.h" 43 #include "third_party/WebKit/public/web/WebViewClient.h"
43 #include "ui/base/l10n/l10n_util.h" 44 #include "ui/base/l10n/l10n_util.h"
44 #include "ui/base/resource/resource_bundle.h" 45 #include "ui/base/resource/resource_bundle.h"
45 46
46 // This code is copied from chrome/renderer/printing. Code is slightly 47 // This code is copied from chrome/renderer/printing. Code is slightly
47 // modified to run it with webview, and the modifications are marked 48 // modified to run it with webview, and the modifications are marked
48 // using OS_ANDROID. 49 // using OS_ANDROID.
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 // TODO(ojan): Remove this override and have this class use a non-null 534 // TODO(ojan): Remove this override and have this class use a non-null
534 // layerTreeView. 535 // layerTreeView.
535 // blink::WebViewClient override: 536 // blink::WebViewClient override:
536 virtual bool allowsBrokenNullLayerTreeView() const; 537 virtual bool allowsBrokenNullLayerTreeView() const;
537 538
538 protected: 539 protected:
539 // blink::WebViewClient override: 540 // blink::WebViewClient override:
540 virtual void didStopLoading(); 541 virtual void didStopLoading();
541 542
542 // blink::WebFrameClient override: 543 // blink::WebFrameClient override:
544 // TODO(alexmos): Remove once Blink is updated to use sandbox flags.
543 virtual blink::WebFrame* createChildFrame(blink::WebLocalFrame* parent, 545 virtual blink::WebFrame* createChildFrame(blink::WebLocalFrame* parent,
544 const blink::WebString& name); 546 const blink::WebString& name);
547 virtual blink::WebFrame* createChildFrame(
548 blink::WebLocalFrame* parent,
549 const blink::WebString& name,
550 blink::WebSandboxFlags sandboxFlags);
545 virtual void frameDetached(blink::WebFrame* frame); 551 virtual void frameDetached(blink::WebFrame* frame);
546 552
547 private: 553 private:
548 void CallOnReady(); 554 void CallOnReady();
549 void ResizeForPrinting(); 555 void ResizeForPrinting();
550 void RestoreSize(); 556 void RestoreSize();
551 void CopySelection(const WebPreferences& preferences); 557 void CopySelection(const WebPreferences& preferences);
552 558
553 FrameReference frame_; 559 FrameReference frame_;
554 blink::WebNode node_to_print_; 560 blink::WebNode node_to_print_;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 void PrepareFrameAndViewForPrint::didStopLoading() { 681 void PrepareFrameAndViewForPrint::didStopLoading() {
676 DCHECK(!on_ready_.is_null()); 682 DCHECK(!on_ready_.is_null());
677 // Don't call callback here, because it can delete |this| and WebView that is 683 // Don't call callback here, because it can delete |this| and WebView that is
678 // called didStopLoading. 684 // called didStopLoading.
679 base::MessageLoop::current()->PostTask( 685 base::MessageLoop::current()->PostTask(
680 FROM_HERE, 686 FROM_HERE,
681 base::Bind(&PrepareFrameAndViewForPrint::CallOnReady, 687 base::Bind(&PrepareFrameAndViewForPrint::CallOnReady,
682 weak_ptr_factory_.GetWeakPtr())); 688 weak_ptr_factory_.GetWeakPtr()));
683 } 689 }
684 690
691 // TODO(alexmos): Remove once Blink is updated to use sandbox flags.
692 blink::WebFrame* PrepareFrameAndViewForPrint::createChildFrame(
693 blink::WebLocalFrame* parent,
694 const blink::WebString& name) {
695 return createChildFrame(parent, name, blink::WebSandboxFlags::None);
696 }
697
685 blink::WebFrame* PrepareFrameAndViewForPrint::createChildFrame( 698 blink::WebFrame* PrepareFrameAndViewForPrint::createChildFrame(
686 blink::WebLocalFrame* parent, 699 blink::WebLocalFrame* parent,
687 const blink::WebString& name) { 700 const blink::WebString& name,
701 blink::WebSandboxFlags sandboxFlags) {
688 blink::WebFrame* frame = blink::WebLocalFrame::create(this); 702 blink::WebFrame* frame = blink::WebLocalFrame::create(this);
689 parent->appendChild(frame); 703 parent->appendChild(frame);
690 return frame; 704 return frame;
691 } 705 }
692 706
693 void PrepareFrameAndViewForPrint::frameDetached(blink::WebFrame* frame) { 707 void PrepareFrameAndViewForPrint::frameDetached(blink::WebFrame* frame) {
694 if (frame->parent()) 708 if (frame->parent())
695 frame->parent()->removeChild(frame); 709 frame->parent()->removeChild(frame);
696 frame->close(); 710 frame->close();
697 } 711 }
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after
2008 } 2022 }
2009 2023
2010 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { 2024 void PrintWebViewHelper::PrintPreviewContext::ClearContext() {
2011 prep_frame_view_.reset(); 2025 prep_frame_view_.reset();
2012 metafile_.reset(); 2026 metafile_.reset();
2013 pages_to_render_.clear(); 2027 pages_to_render_.clear();
2014 error_ = PREVIEW_ERROR_NONE; 2028 error_ = PREVIEW_ERROR_NONE;
2015 } 2029 }
2016 2030
2017 } // namespace printing 2031 } // namespace printing
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698