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

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

Issue 13874004: Also treat new background tabs as pop-ups. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test Created 7 years, 8 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
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/browser_tabstrip.h" 5 #include "chrome/browser/ui/browser_tabstrip.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" 9 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // Handle blocking of tabs. 63 // Handle blocking of tabs.
64 if (source_blocked_content->all_contents_blocked()) { 64 if (source_blocked_content->all_contents_blocked()) {
65 source_blocked_content->AddWebContents( 65 source_blocked_content->AddWebContents(
66 new_contents, disposition, initial_pos, user_gesture); 66 new_contents, disposition, initial_pos, user_gesture);
67 if (was_blocked) 67 if (was_blocked)
68 *was_blocked = true; 68 *was_blocked = true;
69 return; 69 return;
70 } 70 }
71 71
72 // Handle blocking of popups. 72 // Handle blocking of popups.
73 if ((disposition == NEW_POPUP || disposition == NEW_FOREGROUND_TAB) && 73 if ((disposition == NEW_POPUP || disposition == NEW_FOREGROUND_TAB ||
74 !user_gesture && 74 disposition == NEW_BACKGROUND_TAB) && !user_gesture &&
75 !CommandLine::ForCurrentProcess()->HasSwitch( 75 !CommandLine::ForCurrentProcess()->HasSwitch(
76 switches::kDisablePopupBlocking)) { 76 switches::kDisablePopupBlocking)) {
77 // Unrequested popups from normal pages are constrained unless they're in 77 // Unrequested popups from normal pages are constrained unless they're in
78 // the white list. The popup owner will handle checking this. 78 // the white list. The popup owner will handle checking this.
79 source_blocked_content->AddPopup( 79 source_blocked_content->AddPopup(
80 new_contents, disposition, initial_pos, user_gesture); 80 new_contents, disposition, initial_pos, user_gesture);
81 if (was_blocked) 81 if (was_blocked)
82 *was_blocked = true; 82 *was_blocked = true;
83 return; 83 return;
84 } 84 }
(...skipping 19 matching lines...) Expand all
104 return; 104 return;
105 } 105 }
106 106
107 browser->tab_strip_model()->CloseWebContentsAt( 107 browser->tab_strip_model()->CloseWebContentsAt(
108 index, 108 index,
109 add_to_history ? TabStripModel::CLOSE_CREATE_HISTORICAL_TAB 109 add_to_history ? TabStripModel::CLOSE_CREATE_HISTORICAL_TAB
110 : TabStripModel::CLOSE_NONE); 110 : TabStripModel::CLOSE_NONE);
111 } 111 }
112 112
113 } // namespace chrome 113 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/popup_blocker_browsertest.cc ('k') | chrome/test/data/popup_blocker/popup-fake-click-on-anchor.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698