| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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.h" | 5 #include "chrome/browser/ui/browser.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #include <shellapi.h> | 9 #include <shellapi.h> |
| 10 #endif // defined(OS_WIN) | 10 #endif // defined(OS_WIN) |
| (...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1273 FillNavigateParamsFromOpenURLParams(&nav_params, params); | 1273 FillNavigateParamsFromOpenURLParams(&nav_params, params); |
| 1274 nav_params.source_contents = source; | 1274 nav_params.source_contents = source; |
| 1275 nav_params.tabstrip_add_types = TabStripModel::ADD_NONE; | 1275 nav_params.tabstrip_add_types = TabStripModel::ADD_NONE; |
| 1276 nav_params.window_action = chrome::NavigateParams::SHOW_WINDOW; | 1276 nav_params.window_action = chrome::NavigateParams::SHOW_WINDOW; |
| 1277 nav_params.user_gesture = params.user_gesture; | 1277 nav_params.user_gesture = params.user_gesture; |
| 1278 | 1278 |
| 1279 PopupBlockerTabHelper* popup_blocker_helper = NULL; | 1279 PopupBlockerTabHelper* popup_blocker_helper = NULL; |
| 1280 if (source) | 1280 if (source) |
| 1281 popup_blocker_helper = PopupBlockerTabHelper::FromWebContents(source); | 1281 popup_blocker_helper = PopupBlockerTabHelper::FromWebContents(source); |
| 1282 | 1282 |
| 1283 if (CommandLine::ForCurrentProcess()->HasSwitch( | 1283 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 1284 switches::kEnableBetterPopupBlocking) && | 1284 switches::kDisableBetterPopupBlocking) && |
| 1285 popup_blocker_helper) { | 1285 popup_blocker_helper) { |
| 1286 | 1286 |
| 1287 if ((params.disposition == NEW_POPUP || | 1287 if ((params.disposition == NEW_POPUP || |
| 1288 params.disposition == NEW_FOREGROUND_TAB || | 1288 params.disposition == NEW_FOREGROUND_TAB || |
| 1289 params.disposition == NEW_BACKGROUND_TAB) && | 1289 params.disposition == NEW_BACKGROUND_TAB) && |
| 1290 !params.user_gesture && !CommandLine::ForCurrentProcess()->HasSwitch( | 1290 !params.user_gesture && !CommandLine::ForCurrentProcess()->HasSwitch( |
| 1291 switches::kDisablePopupBlocking)) { | 1291 switches::kDisablePopupBlocking)) { |
| 1292 if (popup_blocker_helper->MaybeBlockPopup(nav_params, | 1292 if (popup_blocker_helper->MaybeBlockPopup(nav_params, |
| 1293 WebWindowFeatures())) { | 1293 WebWindowFeatures())) { |
| 1294 return NULL; | 1294 return NULL; |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1493 WindowOpenDisposition disposition, | 1493 WindowOpenDisposition disposition, |
| 1494 const WebWindowFeatures& features, | 1494 const WebWindowFeatures& features, |
| 1495 bool user_gesture, | 1495 bool user_gesture, |
| 1496 bool opener_suppressed) { | 1496 bool opener_suppressed) { |
| 1497 if (window_container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) { | 1497 if (window_container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) { |
| 1498 // If a BackgroundContents is created, suppress the normal WebContents. | 1498 // If a BackgroundContents is created, suppress the normal WebContents. |
| 1499 return !MaybeCreateBackgroundContents( | 1499 return !MaybeCreateBackgroundContents( |
| 1500 route_id, web_contents, frame_name, target_url); | 1500 route_id, web_contents, frame_name, target_url); |
| 1501 } | 1501 } |
| 1502 | 1502 |
| 1503 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 1503 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 1504 switches::kEnableBetterPopupBlocking)) { | 1504 switches::kDisableBetterPopupBlocking)) { |
| 1505 return true; | 1505 return true; |
| 1506 } | 1506 } |
| 1507 | 1507 |
| 1508 PopupBlockerTabHelper* popup_blocker_helper = | 1508 PopupBlockerTabHelper* popup_blocker_helper = |
| 1509 PopupBlockerTabHelper::FromWebContents(web_contents); | 1509 PopupBlockerTabHelper::FromWebContents(web_contents); |
| 1510 if (!popup_blocker_helper) | 1510 if (!popup_blocker_helper) |
| 1511 return true; | 1511 return true; |
| 1512 | 1512 |
| 1513 if ((disposition == NEW_POPUP || disposition == NEW_FOREGROUND_TAB || | 1513 if ((disposition == NEW_POPUP || disposition == NEW_FOREGROUND_TAB || |
| 1514 disposition == NEW_BACKGROUND_TAB) && !user_gesture && | 1514 disposition == NEW_BACKGROUND_TAB) && !user_gesture && |
| (...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2286 if (contents && !allow_js_access) { | 2286 if (contents && !allow_js_access) { |
| 2287 contents->web_contents()->GetController().LoadURL( | 2287 contents->web_contents()->GetController().LoadURL( |
| 2288 target_url, | 2288 target_url, |
| 2289 content::Referrer(), | 2289 content::Referrer(), |
| 2290 content::PAGE_TRANSITION_LINK, | 2290 content::PAGE_TRANSITION_LINK, |
| 2291 std::string()); // No extra headers. | 2291 std::string()); // No extra headers. |
| 2292 } | 2292 } |
| 2293 | 2293 |
| 2294 return contents != NULL; | 2294 return contents != NULL; |
| 2295 } | 2295 } |
| OLD | NEW |