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

Side by Side Diff: chrome/browser/ui/constrained_window_tab_helper.cc

Issue 10870094: Constrained window sheet controller (test patch) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rename Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/constrained_window.cc ('k') | chrome/browser/ui/gtk/browser_window_gtk.h » ('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 "chrome/browser/ui/constrained_window_tab_helper.h" 5 #include "chrome/browser/ui/constrained_window_tab_helper.h"
6 6
7 #include "chrome/browser/ui/constrained_window.h" 7 #include "chrome/browser/ui/constrained_window.h"
8 #include "chrome/browser/ui/constrained_window_tab_helper_delegate.h" 8 #include "chrome/browser/ui/constrained_window_tab_helper_delegate.h"
9 #include "chrome/browser/ui/tab_contents/tab_contents.h" 9 #include "chrome/browser/ui/tab_contents/tab_contents.h"
10 #include "chrome/common/render_messages.h" 10 #include "chrome/common/render_messages.h"
(...skipping 14 matching lines...) Expand all
25 } 25 }
26 26
27 ConstrainedWindowTabHelper::~ConstrainedWindowTabHelper() { 27 ConstrainedWindowTabHelper::~ConstrainedWindowTabHelper() {
28 DCHECK(child_windows_.empty()); 28 DCHECK(child_windows_.empty());
29 } 29 }
30 30
31 void ConstrainedWindowTabHelper::AddConstrainedDialog( 31 void ConstrainedWindowTabHelper::AddConstrainedDialog(
32 ConstrainedWindow* window) { 32 ConstrainedWindow* window) {
33 child_windows_.push_back(window); 33 child_windows_.push_back(window);
34 34
35 if (child_windows_.size() == 1) { 35 if (child_windows_.size() == 1 && window->GetCanShowConstrainedWindow()) {
36 window->ShowConstrainedWindow(); 36 window->ShowConstrainedWindow();
37 BlockTabContent(true); 37 BlockTabContent(true);
38 } 38 }
39 } 39 }
40 40
41 void ConstrainedWindowTabHelper::CloseConstrainedWindows() { 41 void ConstrainedWindowTabHelper::CloseConstrainedWindows() {
42 // Clear out any constrained windows since we are leaving this page entirely. 42 // Clear out any constrained windows since we are leaving this page entirely.
43 // To ensure that we iterate over every element in child_windows_ we 43 // To ensure that we iterate over every element in child_windows_ we
44 // need to use a copy of child_windows_. Otherwise if 44 // need to use a copy of child_windows_. Otherwise if
45 // window->CloseConstrainedWindow() modifies child_windows_ we could end up 45 // window->CloseConstrainedWindow() modifies child_windows_ we could end up
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 } 104 }
105 } 105 }
106 106
107 void ConstrainedWindowTabHelper::WebContentsDestroyed(WebContents* tab) { 107 void ConstrainedWindowTabHelper::WebContentsDestroyed(WebContents* tab) {
108 // First cleanly close all child windows. 108 // First cleanly close all child windows.
109 // TODO(mpcomplete): handle case if MaybeCloseChildWindows() already asked 109 // TODO(mpcomplete): handle case if MaybeCloseChildWindows() already asked
110 // some of these to close. CloseWindows is async, so it might get called 110 // some of these to close. CloseWindows is async, so it might get called
111 // twice before it runs. 111 // twice before it runs.
112 CloseConstrainedWindows(); 112 CloseConstrainedWindows();
113 } 113 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/constrained_window.cc ('k') | chrome/browser/ui/gtk/browser_window_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698