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

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: adding comments 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, DetachType type);
596 598
597 private: 599 private:
598 void CallOnReady(); 600 void CallOnReady();
599 void ResizeForPrinting(); 601 void ResizeForPrinting();
600 void RestoreSize(); 602 void RestoreSize();
601 void CopySelection(const WebPreferences& preferences); 603 void CopySelection(const WebPreferences& preferences);
602 604
603 FrameReference frame_; 605 FrameReference frame_;
604 blink::WebNode node_to_print_; 606 blink::WebNode node_to_print_;
605 bool owns_web_view_; 607 bool owns_web_view_;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 blink::WebLocalFrame* parent, 738 blink::WebLocalFrame* parent,
737 blink::WebTreeScopeType scope, 739 blink::WebTreeScopeType scope,
738 const blink::WebString& name, 740 const blink::WebString& name,
739 blink::WebSandboxFlags sandboxFlags) { 741 blink::WebSandboxFlags sandboxFlags) {
740 blink::WebFrame* frame = blink::WebLocalFrame::create(scope, this); 742 blink::WebFrame* frame = blink::WebLocalFrame::create(scope, this);
741 parent->appendChild(frame); 743 parent->appendChild(frame);
742 return frame; 744 return frame;
743 } 745 }
744 746
745 void PrepareFrameAndViewForPrint::frameDetached(blink::WebFrame* frame) { 747 void PrepareFrameAndViewForPrint::frameDetached(blink::WebFrame* frame) {
748 frameDetached(frame, DetachType::Remove);
749 }
750
751 void PrepareFrameAndViewForPrint::frameDetached(blink::WebFrame* frame,
752 DetachType type) {
753 DCHECK(type == DetachType::Remove);
746 if (frame->parent()) 754 if (frame->parent())
747 frame->parent()->removeChild(frame); 755 frame->parent()->removeChild(frame);
748 frame->close(); 756 frame->close();
749 } 757 }
750 758
751 void PrepareFrameAndViewForPrint::CallOnReady() { 759 void PrepareFrameAndViewForPrint::CallOnReady() {
752 return on_ready_.Run(); // Can delete |this|. 760 return on_ready_.Run(); // Can delete |this|.
753 } 761 }
754 762
755 void PrepareFrameAndViewForPrint::RestoreSize() { 763 void PrepareFrameAndViewForPrint::RestoreSize() {
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 blink::WebConsoleMessage::LevelWarning, message)); 2076 blink::WebConsoleMessage::LevelWarning, message));
2069 return false; 2077 return false;
2070 } 2078 }
2071 2079
2072 void PrintWebViewHelper::ScriptingThrottler::Reset() { 2080 void PrintWebViewHelper::ScriptingThrottler::Reset() {
2073 // Reset counter on successful print. 2081 // Reset counter on successful print.
2074 count_ = 0; 2082 count_ = 0;
2075 } 2083 }
2076 2084
2077 } // namespace printing 2085 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698