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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 #include "extensions/browser/extension_system.h" | 184 #include "extensions/browser/extension_system.h" |
185 #include "extensions/common/constants.h" | 185 #include "extensions/common/constants.h" |
186 #include "extensions/common/extension.h" | 186 #include "extensions/common/extension.h" |
187 #include "extensions/common/manifest_handlers/background_info.h" | 187 #include "extensions/common/manifest_handlers/background_info.h" |
188 #include "net/base/filename_util.h" | 188 #include "net/base/filename_util.h" |
189 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 189 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
190 #include "net/cookies/cookie_monster.h" | 190 #include "net/cookies/cookie_monster.h" |
191 #include "net/url_request/url_request_context.h" | 191 #include "net/url_request/url_request_context.h" |
192 #include "third_party/WebKit/public/web/WebWindowFeatures.h" | 192 #include "third_party/WebKit/public/web/WebWindowFeatures.h" |
193 #include "ui/base/l10n/l10n_util.h" | 193 #include "ui/base/l10n/l10n_util.h" |
194 #include "ui/base/touch/touch_device.h" | |
sadrul
2014/09/30 16:32:15
Add this include below for OS_WIN in line ~200?
mfomitchev
2014/09/30 18:30:33
Done.
| |
194 #include "ui/base/window_open_disposition.h" | 195 #include "ui/base/window_open_disposition.h" |
195 #include "ui/gfx/point.h" | 196 #include "ui/gfx/point.h" |
196 #include "ui/shell_dialogs/selected_file_info.h" | 197 #include "ui/shell_dialogs/selected_file_info.h" |
197 | 198 |
198 #if defined(OS_WIN) | 199 #if defined(OS_WIN) |
199 #include "base/win/metro.h" | 200 #include "base/win/metro.h" |
200 #include "chrome/browser/ssl/ssl_error_info.h" | 201 #include "chrome/browser/ssl/ssl_error_info.h" |
201 #include "chrome/browser/task_manager/task_manager.h" | 202 #include "chrome/browser/task_manager/task_manager.h" |
202 #include "chrome/browser/ui/view_ids.h" | 203 #include "chrome/browser/ui/view_ids.h" |
203 #include "components/autofill/core/browser/autofill_ie_toolbar_import_win.h" | 204 #include "components/autofill/core/browser/autofill_ie_toolbar_import_win.h" |
(...skipping 916 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) && defined(OS_WIN) |
1132 // Don't enable overscroll on Windows machines unless they have a touch | |
1133 // screen as these machines typically don't have a touchpad capable of | |
1134 // horizontal scrolling. We are purposefully biased towards "no" here, | |
1135 // so that we don't waste resources capturing screenshots for horizontal | |
1136 // overscroll navigation unnecessarily. | |
1137 bool allowOverscroll = ui::IsTouchDevicePresent(); | |
sadrul
2014/09/30 16:32:15
allow_overscroll
Also, AURA is always turned on f
mfomitchev
2014/09/30 18:30:33
Done.
| |
1138 #elif defined(USE_AURA) | |
1139 bool allowOverscroll = true; | |
1140 #else | |
1141 bool allowOverscroll = false; | |
1142 #endif | |
1143 | |
1144 if (!allowOverscroll) | |
1145 return false; | |
1146 | |
1131 const std::string value = CommandLine::ForCurrentProcess()-> | 1147 const std::string value = CommandLine::ForCurrentProcess()-> |
1132 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation); | 1148 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation); |
1133 bool overscroll_enabled = value != "0"; | 1149 bool overscroll_enabled = value != "0"; |
1134 if (!overscroll_enabled) | 1150 if (!overscroll_enabled) |
1135 return false; | 1151 return false; |
1136 if (is_app() || is_devtools() || !is_type_tabbed()) | 1152 if (is_app() || is_devtools() || !is_type_tabbed()) |
1137 return false; | 1153 return false; |
1138 | 1154 |
1139 // The detached bookmark bar has appearance of floating above the | 1155 // The detached bookmark bar has appearance of floating above the |
1140 // web-contents. This does not play nicely with overscroll navigation | 1156 // web-contents. This does not play nicely with overscroll navigation |
1141 // gestures. So disable overscroll navigation when the bookmark bar is in the | 1157 // gestures. So disable overscroll navigation when the bookmark bar is in the |
1142 // detached state and the overscroll effect moves the layers. | 1158 // detached state and the overscroll effect moves the layers. |
1143 if (value == "1" && bookmark_bar_state_ == BookmarkBar::DETACHED) | 1159 if (value == "1" && bookmark_bar_state_ == BookmarkBar::DETACHED) |
1144 return false; | 1160 return false; |
1145 return true; | 1161 return true; |
1146 #else | |
1147 return false; | |
1148 #endif | |
1149 } | 1162 } |
1150 | 1163 |
1151 bool Browser::ShouldPreserveAbortedURLs(WebContents* source) { | 1164 bool Browser::ShouldPreserveAbortedURLs(WebContents* source) { |
1152 // Allow failed URLs to stick around in the omnibox on the NTP, but not when | 1165 // Allow failed URLs to stick around in the omnibox on the NTP, but not when |
1153 // other pages have committed. | 1166 // other pages have committed. |
1154 Profile* profile = Profile::FromBrowserContext(source->GetBrowserContext()); | 1167 Profile* profile = Profile::FromBrowserContext(source->GetBrowserContext()); |
1155 if (!profile || !source->GetController().GetLastCommittedEntry()) | 1168 if (!profile || !source->GetController().GetLastCommittedEntry()) |
1156 return false; | 1169 return false; |
1157 GURL committed_url(source->GetController().GetLastCommittedEntry()->GetURL()); | 1170 GURL committed_url(source->GetController().GetLastCommittedEntry()->GetURL()); |
1158 return chrome::IsNTPURL(committed_url, profile); | 1171 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) { | 2489 if (contents && !allow_js_access) { |
2477 contents->web_contents()->GetController().LoadURL( | 2490 contents->web_contents()->GetController().LoadURL( |
2478 target_url, | 2491 target_url, |
2479 content::Referrer(), | 2492 content::Referrer(), |
2480 ui::PAGE_TRANSITION_LINK, | 2493 ui::PAGE_TRANSITION_LINK, |
2481 std::string()); // No extra headers. | 2494 std::string()); // No extra headers. |
2482 } | 2495 } |
2483 | 2496 |
2484 return contents != NULL; | 2497 return contents != NULL; |
2485 } | 2498 } |
OLD | NEW |