| 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 237 |
| 238 // How long we wait before updating the browser chrome while loading a page. | 238 // How long we wait before updating the browser chrome while loading a page. |
| 239 const int kUIUpdateCoalescingTimeMS = 200; | 239 const int kUIUpdateCoalescingTimeMS = 200; |
| 240 | 240 |
| 241 BrowserWindow* CreateBrowserWindow(Browser* browser) { | 241 BrowserWindow* CreateBrowserWindow(Browser* browser) { |
| 242 return BrowserWindow::CreateBrowserWindow(browser); | 242 return BrowserWindow::CreateBrowserWindow(browser); |
| 243 } | 243 } |
| 244 | 244 |
| 245 // Is the fast tab unload experiment enabled? | 245 // Is the fast tab unload experiment enabled? |
| 246 bool IsFastTabUnloadEnabled() { | 246 bool IsFastTabUnloadEnabled() { |
| 247 return CommandLine::ForCurrentProcess()->HasSwitch( | 247 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 248 switches::kEnableFastUnload); | 248 switches::kEnableFastUnload); |
| 249 } | 249 } |
| 250 | 250 |
| 251 bool IsWebAppFrameEnabled() { | 251 bool IsWebAppFrameEnabled() { |
| 252 return CommandLine::ForCurrentProcess()->HasSwitch( | 252 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 253 switches::kEnableWebAppFrame); | 253 switches::kEnableWebAppFrame); |
| 254 } | 254 } |
| 255 | 255 |
| 256 } // namespace | 256 } // namespace |
| 257 | 257 |
| 258 //////////////////////////////////////////////////////////////////////////////// | 258 //////////////////////////////////////////////////////////////////////////////// |
| 259 // Browser, CreateParams: | 259 // Browser, CreateParams: |
| 260 | 260 |
| 261 Browser::CreateParams::CreateParams(Profile* profile, | 261 Browser::CreateParams::CreateParams(Profile* profile, |
| 262 chrome::HostDesktopType host_desktop_type) | 262 chrome::HostDesktopType host_desktop_type) |
| 263 : type(TYPE_TABBED), | 263 : type(TYPE_TABBED), |
| (...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1144 bool allow_overscroll = ui::IsTouchDevicePresent(); | 1144 bool allow_overscroll = ui::IsTouchDevicePresent(); |
| 1145 #elif defined(USE_AURA) | 1145 #elif defined(USE_AURA) |
| 1146 bool allow_overscroll = true; | 1146 bool allow_overscroll = true; |
| 1147 #else | 1147 #else |
| 1148 bool allow_overscroll = false; | 1148 bool allow_overscroll = false; |
| 1149 #endif | 1149 #endif |
| 1150 | 1150 |
| 1151 if (!allow_overscroll) | 1151 if (!allow_overscroll) |
| 1152 return false; | 1152 return false; |
| 1153 | 1153 |
| 1154 const std::string value = CommandLine::ForCurrentProcess()-> | 1154 const std::string value = |
| 1155 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation); | 1155 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 1156 switches::kOverscrollHistoryNavigation); |
| 1156 bool overscroll_enabled = value != "0"; | 1157 bool overscroll_enabled = value != "0"; |
| 1157 if (!overscroll_enabled) | 1158 if (!overscroll_enabled) |
| 1158 return false; | 1159 return false; |
| 1159 if (is_app() || is_devtools() || !is_type_tabbed()) | 1160 if (is_app() || is_devtools() || !is_type_tabbed()) |
| 1160 return false; | 1161 return false; |
| 1161 | 1162 |
| 1162 // The detached bookmark bar has appearance of floating above the | 1163 // The detached bookmark bar has appearance of floating above the |
| 1163 // web-contents. This does not play nicely with overscroll navigation | 1164 // web-contents. This does not play nicely with overscroll navigation |
| 1164 // gestures. So disable overscroll navigation when the bookmark bar is in the | 1165 // gestures. So disable overscroll navigation when the bookmark bar is in the |
| 1165 // detached state and the overscroll effect moves the layers. | 1166 // detached state and the overscroll effect moves the layers. |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1347 | 1348 |
| 1348 PopupBlockerTabHelper* popup_blocker_helper = NULL; | 1349 PopupBlockerTabHelper* popup_blocker_helper = NULL; |
| 1349 if (source) | 1350 if (source) |
| 1350 popup_blocker_helper = PopupBlockerTabHelper::FromWebContents(source); | 1351 popup_blocker_helper = PopupBlockerTabHelper::FromWebContents(source); |
| 1351 | 1352 |
| 1352 if (popup_blocker_helper) { | 1353 if (popup_blocker_helper) { |
| 1353 if ((params.disposition == NEW_POPUP || | 1354 if ((params.disposition == NEW_POPUP || |
| 1354 params.disposition == NEW_FOREGROUND_TAB || | 1355 params.disposition == NEW_FOREGROUND_TAB || |
| 1355 params.disposition == NEW_BACKGROUND_TAB || | 1356 params.disposition == NEW_BACKGROUND_TAB || |
| 1356 params.disposition == NEW_WINDOW) && | 1357 params.disposition == NEW_WINDOW) && |
| 1357 !params.user_gesture && !CommandLine::ForCurrentProcess()->HasSwitch( | 1358 !params.user_gesture && |
| 1358 switches::kDisablePopupBlocking)) { | 1359 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1360 switches::kDisablePopupBlocking)) { |
| 1359 if (popup_blocker_helper->MaybeBlockPopup(nav_params, | 1361 if (popup_blocker_helper->MaybeBlockPopup(nav_params, |
| 1360 WebWindowFeatures())) { | 1362 WebWindowFeatures())) { |
| 1361 return NULL; | 1363 return NULL; |
| 1362 } | 1364 } |
| 1363 } | 1365 } |
| 1364 } | 1366 } |
| 1365 | 1367 |
| 1366 chrome::Navigate(&nav_params); | 1368 chrome::Navigate(&nav_params); |
| 1367 | 1369 |
| 1368 return nav_params.target_contents; | 1370 return nav_params.target_contents; |
| (...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2509 if (contents && !allow_js_access) { | 2511 if (contents && !allow_js_access) { |
| 2510 contents->web_contents()->GetController().LoadURL( | 2512 contents->web_contents()->GetController().LoadURL( |
| 2511 target_url, | 2513 target_url, |
| 2512 content::Referrer(), | 2514 content::Referrer(), |
| 2513 ui::PAGE_TRANSITION_LINK, | 2515 ui::PAGE_TRANSITION_LINK, |
| 2514 std::string()); // No extra headers. | 2516 std::string()); // No extra headers. |
| 2515 } | 2517 } |
| 2516 | 2518 |
| 2517 return contents != NULL; | 2519 return contents != NULL; |
| 2518 } | 2520 } |
| OLD | NEW |