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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
194 #include "ui/base/window_open_disposition.h" | 194 #include "ui/base/window_open_disposition.h" |
195 #include "ui/gfx/point.h" | 195 #include "ui/gfx/point.h" |
196 #include "ui/shell_dialogs/selected_file_info.h" | 196 #include "ui/shell_dialogs/selected_file_info.h" |
197 | 197 |
198 #if defined(OS_WIN) | 198 #if defined(OS_WIN) |
199 #include "base/win/metro.h" | 199 #include "base/win/metro.h" |
200 #include "chrome/browser/ssl/ssl_error_info.h" | 200 #include "chrome/browser/ssl/ssl_error_info.h" |
201 #include "chrome/browser/task_manager/task_manager.h" | 201 #include "chrome/browser/task_manager/task_manager.h" |
202 #include "chrome/browser/ui/view_ids.h" | 202 #include "chrome/browser/ui/view_ids.h" |
203 #include "components/autofill/core/browser/autofill_ie_toolbar_import_win.h" | 203 #include "components/autofill/core/browser/autofill_ie_toolbar_import_win.h" |
204 #include "ui/base/touch/touch_device.h" | |
204 #include "ui/base/win/shell.h" | 205 #include "ui/base/win/shell.h" |
205 #endif // OS_WIN | 206 #endif // OS_WIN |
206 | 207 |
207 #if defined(OS_CHROMEOS) | 208 #if defined(OS_CHROMEOS) |
208 #include "chrome/browser/chromeos/drive/file_system_util.h" | 209 #include "chrome/browser/chromeos/drive/file_system_util.h" |
209 #endif | 210 #endif |
210 | 211 |
211 #if defined(USE_ASH) | 212 #if defined(USE_ASH) |
212 #include "ash/ash_switches.h" | 213 #include "ash/ash_switches.h" |
213 #endif | 214 #endif |
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1120 // still present. | 1121 // still present. |
1121 base::MessageLoop::current()->PostTask( | 1122 base::MessageLoop::current()->PostTask( |
1122 FROM_HERE, base::Bind(&Browser::CloseFrame, weak_factory_.GetWeakPtr())); | 1123 FROM_HERE, base::Bind(&Browser::CloseFrame, weak_factory_.GetWeakPtr())); |
1123 | 1124 |
1124 // Instant may have visible WebContents that need to be detached before the | 1125 // Instant may have visible WebContents that need to be detached before the |
1125 // window system closes. | 1126 // window system closes. |
1126 instant_controller_.reset(); | 1127 instant_controller_.reset(); |
1127 } | 1128 } |
1128 | 1129 |
1129 bool Browser::CanOverscrollContent() const { | 1130 bool Browser::CanOverscrollContent() const { |
1130 #if defined(USE_AURA) | 1131 #if defined(USE_AURA) |
sky
2014/09/30 21:46:05
Oy, this is hard to read with all the ifdefs. How
mfomitchev
2014/09/30 22:32:29
Hmm.. how can I put the win implementation into br
| |
1132 #if defined(OS_WIN) | |
1133 // Don't enable overscroll on Windows machines unless they have a touch | |
1134 // screen as these machines typically don't have a touchpad capable of | |
1135 // horizontal scrolling. We are purposefully biased towards "no" here, | |
1136 // so that we don't waste resources capturing screenshots for horizontal | |
1137 // overscroll navigation unnecessarily. | |
1138 bool allow_overscroll = ui::IsTouchDevicePresent(); | |
1139 #else | |
1140 bool allow_overscroll = true; | |
1141 #endif | |
1142 #else | |
1143 bool allow_overscroll = false; | |
1144 #endif | |
1145 | |
1146 if (!allow_overscroll) | |
1147 return false; | |
1148 | |
1131 const std::string value = CommandLine::ForCurrentProcess()-> | 1149 const std::string value = CommandLine::ForCurrentProcess()-> |
1132 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation); | 1150 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation); |
1133 bool overscroll_enabled = value != "0"; | 1151 bool overscroll_enabled = value != "0"; |
1134 if (!overscroll_enabled) | 1152 if (!overscroll_enabled) |
1135 return false; | 1153 return false; |
1136 if (is_app() || is_devtools() || !is_type_tabbed()) | 1154 if (is_app() || is_devtools() || !is_type_tabbed()) |
1137 return false; | 1155 return false; |
1138 | 1156 |
1139 // The detached bookmark bar has appearance of floating above the | 1157 // The detached bookmark bar has appearance of floating above the |
1140 // web-contents. This does not play nicely with overscroll navigation | 1158 // web-contents. This does not play nicely with overscroll navigation |
1141 // gestures. So disable overscroll navigation when the bookmark bar is in the | 1159 // gestures. So disable overscroll navigation when the bookmark bar is in the |
1142 // detached state and the overscroll effect moves the layers. | 1160 // detached state and the overscroll effect moves the layers. |
1143 if (value == "1" && bookmark_bar_state_ == BookmarkBar::DETACHED) | 1161 if (value == "1" && bookmark_bar_state_ == BookmarkBar::DETACHED) |
1144 return false; | 1162 return false; |
1145 return true; | 1163 return true; |
1146 #else | |
1147 return false; | |
1148 #endif | |
1149 } | 1164 } |
1150 | 1165 |
1151 bool Browser::ShouldPreserveAbortedURLs(WebContents* source) { | 1166 bool Browser::ShouldPreserveAbortedURLs(WebContents* source) { |
1152 // Allow failed URLs to stick around in the omnibox on the NTP, but not when | 1167 // Allow failed URLs to stick around in the omnibox on the NTP, but not when |
1153 // other pages have committed. | 1168 // other pages have committed. |
1154 Profile* profile = Profile::FromBrowserContext(source->GetBrowserContext()); | 1169 Profile* profile = Profile::FromBrowserContext(source->GetBrowserContext()); |
1155 if (!profile || !source->GetController().GetLastCommittedEntry()) | 1170 if (!profile || !source->GetController().GetLastCommittedEntry()) |
1156 return false; | 1171 return false; |
1157 GURL committed_url(source->GetController().GetLastCommittedEntry()->GetURL()); | 1172 GURL committed_url(source->GetController().GetLastCommittedEntry()->GetURL()); |
1158 return chrome::IsNTPURL(committed_url, profile); | 1173 return chrome::IsNTPURL(committed_url, profile); |
(...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2476 if (contents && !allow_js_access) { | 2491 if (contents && !allow_js_access) { |
2477 contents->web_contents()->GetController().LoadURL( | 2492 contents->web_contents()->GetController().LoadURL( |
2478 target_url, | 2493 target_url, |
2479 content::Referrer(), | 2494 content::Referrer(), |
2480 ui::PAGE_TRANSITION_LINK, | 2495 ui::PAGE_TRANSITION_LINK, |
2481 std::string()); // No extra headers. | 2496 std::string()); // No extra headers. |
2482 } | 2497 } |
2483 | 2498 |
2484 return contents != NULL; | 2499 return contents != NULL; |
2485 } | 2500 } |
OLD | NEW |