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

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

Issue 1149793002: Detach old frame on WebFrame::swap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: renaming enum Created 5 years, 6 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 (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 <string> 7 #include <string>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 protected: 585 protected:
586 // blink::WebViewClient override: 586 // blink::WebViewClient override:
587 virtual void didStopLoading(); 587 virtual void didStopLoading();
588 588
589 // blink::WebFrameClient override: 589 // blink::WebFrameClient override:
590 virtual blink::WebFrame* createChildFrame( 590 virtual blink::WebFrame* createChildFrame(
591 blink::WebLocalFrame* parent, 591 blink::WebLocalFrame* parent,
592 blink::WebTreeScopeType scope, 592 blink::WebTreeScopeType scope,
593 const blink::WebString& name, 593 const blink::WebString& name,
594 blink::WebSandboxFlags sandboxFlags); 594 blink::WebSandboxFlags sandboxFlags);
595 // TODO(lfg): Remove this method once the blink patch lands.
595 virtual void frameDetached(blink::WebFrame* frame); 596 virtual void frameDetached(blink::WebFrame* frame);
597 virtual void frameDetached(blink::WebFrame* frame,
598 blink::WebFrameClient::DetachType type);
596 599
597 private: 600 private:
598 void CallOnReady(); 601 void CallOnReady();
599 void ResizeForPrinting(); 602 void ResizeForPrinting();
600 void RestoreSize(); 603 void RestoreSize();
601 void CopySelection(const WebPreferences& preferences); 604 void CopySelection(const WebPreferences& preferences);
602 605
603 FrameReference frame_; 606 FrameReference frame_;
604 blink::WebNode node_to_print_; 607 blink::WebNode node_to_print_;
605 bool owns_web_view_; 608 bool owns_web_view_;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 blink::WebLocalFrame* parent, 739 blink::WebLocalFrame* parent,
737 blink::WebTreeScopeType scope, 740 blink::WebTreeScopeType scope,
738 const blink::WebString& name, 741 const blink::WebString& name,
739 blink::WebSandboxFlags sandboxFlags) { 742 blink::WebSandboxFlags sandboxFlags) {
740 blink::WebFrame* frame = blink::WebLocalFrame::create(scope, this); 743 blink::WebFrame* frame = blink::WebLocalFrame::create(scope, this);
741 parent->appendChild(frame); 744 parent->appendChild(frame);
742 return frame; 745 return frame;
743 } 746 }
744 747
745 void PrepareFrameAndViewForPrint::frameDetached(blink::WebFrame* frame) { 748 void PrepareFrameAndViewForPrint::frameDetached(blink::WebFrame* frame) {
749 frameDetached(frame, blink::DetachType::Remove);
750 }
751
752 void PrepareFrameAndViewForPrint::frameDetached(blink::WebFrame* frame,
753 blink::DetachType type) {
754 DCHECK(type == blink::DetachType::Remove);
746 if (frame->parent()) 755 if (frame->parent())
747 frame->parent()->removeChild(frame); 756 frame->parent()->removeChild(frame);
748 frame->close(); 757 frame->close();
749 } 758 }
750 759
751 void PrepareFrameAndViewForPrint::CallOnReady() { 760 void PrepareFrameAndViewForPrint::CallOnReady() {
752 return on_ready_.Run(); // Can delete |this|. 761 return on_ready_.Run(); // Can delete |this|.
753 } 762 }
754 763
755 void PrepareFrameAndViewForPrint::RestoreSize() { 764 void PrepareFrameAndViewForPrint::RestoreSize() {
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 blink::WebConsoleMessage::LevelWarning, message)); 2077 blink::WebConsoleMessage::LevelWarning, message));
2069 return false; 2078 return false;
2070 } 2079 }
2071 2080
2072 void PrintWebViewHelper::ScriptingThrottler::Reset() { 2081 void PrintWebViewHelper::ScriptingThrottler::Reset() {
2073 // Reset counter on successful print. 2082 // Reset counter on successful print.
2074 count_ = 0; 2083 count_ = 0;
2075 } 2084 }
2076 2085
2077 } // namespace printing 2086 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698