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

Side by Side Diff: chrome/browser/blocked_popup_container.cc

Issue 3832005: Don't display the file select dialog from invisible windows.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 2 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 | « no previous file | chrome/renderer/render_view.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/blocked_popup_container.h" 5 #include "chrome/browser/blocked_popup_container.h"
6 6
7 #include "chrome/browser/tab_contents/tab_contents.h" 7 #include "chrome/browser/tab_contents/tab_contents.h"
8 #include "gfx/rect.h" 8 #include "gfx/rect.h"
9 9
10 // static 10 // static
(...skipping 17 matching lines...) Expand all
28 const gfx::Rect& bounds) { 28 const gfx::Rect& bounds) {
29 if (blocked_popups_.size() == (kImpossibleNumberOfPopups - 1)) { 29 if (blocked_popups_.size() == (kImpossibleNumberOfPopups - 1)) {
30 delete tab_contents; 30 delete tab_contents;
31 LOG(INFO) << "Warning: Renderer is sending more popups to us than should " 31 LOG(INFO) << "Warning: Renderer is sending more popups to us than should "
32 "be possible. Renderer compromised?"; 32 "be possible. Renderer compromised?";
33 return; 33 return;
34 } 34 }
35 35
36 blocked_popups_.push_back(BlockedPopup(tab_contents, bounds)); 36 blocked_popups_.push_back(BlockedPopup(tab_contents, bounds));
37 tab_contents->set_delegate(this); 37 tab_contents->set_delegate(this);
38 // Since the new tab_contents will not be showed, call WasHidden to change
39 // its status on both RenderViewHost and RenderView.
40 tab_contents->WasHidden();
38 if (blocked_popups_.size() == 1) 41 if (blocked_popups_.size() == 1)
39 owner_->PopupNotificationVisibilityChanged(true); 42 owner_->PopupNotificationVisibilityChanged(true);
40 } 43 }
41 44
42 void BlockedPopupContainer::LaunchPopupForContents(TabContents* tab_contents) { 45 void BlockedPopupContainer::LaunchPopupForContents(TabContents* tab_contents) {
43 // Open the popup. 46 // Open the popup.
44 for (BlockedPopups::iterator i(blocked_popups_.begin()); 47 for (BlockedPopups::iterator i(blocked_popups_.begin());
45 i != blocked_popups_.end(); ++i) { 48 i != blocked_popups_.end(); ++i) {
46 if (i->tab_contents == tab_contents) { 49 if (i->tab_contents == tab_contents) {
47 tab_contents->set_delegate(NULL); 50 tab_contents->set_delegate(NULL);
51 // We needn't call WasRestored to change its status because the
52 // TabContents::AddNewContents will do it.
48 owner_->AddNewContents(tab_contents, NEW_POPUP, i->bounds, true); 53 owner_->AddNewContents(tab_contents, NEW_POPUP, i->bounds, true);
49 blocked_popups_.erase(i); 54 blocked_popups_.erase(i);
50 break; 55 break;
51 } 56 }
52 } 57 }
53 58
54 if (blocked_popups_.empty()) 59 if (blocked_popups_.empty())
55 Destroy(); 60 Destroy();
56 } 61 }
57 62
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } 127 }
123 128
124 bool BlockedPopupContainer::IsPopup(const TabContents* source) const { 129 bool BlockedPopupContainer::IsPopup(const TabContents* source) const {
125 return true; 130 return true;
126 } 131 }
127 132
128 TabContents* BlockedPopupContainer::GetConstrainingContents( 133 TabContents* BlockedPopupContainer::GetConstrainingContents(
129 TabContents* source) { 134 TabContents* source) {
130 return owner_; 135 return owner_;
131 } 136 }
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/render_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698