| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 #include "chrome/common/chrome_notification_types.h" | 142 #include "chrome/common/chrome_notification_types.h" |
| 143 #include "chrome/common/chrome_switches.h" | 143 #include "chrome/common/chrome_switches.h" |
| 144 #include "chrome/common/custom_handlers/protocol_handler.h" | 144 #include "chrome/common/custom_handlers/protocol_handler.h" |
| 145 #include "chrome/common/extensions/background_info.h" | 145 #include "chrome/common/extensions/background_info.h" |
| 146 #include "chrome/common/extensions/extension.h" | 146 #include "chrome/common/extensions/extension.h" |
| 147 #include "chrome/common/extensions/extension_constants.h" | 147 #include "chrome/common/extensions/extension_constants.h" |
| 148 #include "chrome/common/pref_names.h" | 148 #include "chrome/common/pref_names.h" |
| 149 #include "chrome/common/profiling.h" | 149 #include "chrome/common/profiling.h" |
| 150 #include "chrome/common/search_types.h" | 150 #include "chrome/common/search_types.h" |
| 151 #include "chrome/common/startup_metric_utils.h" | 151 #include "chrome/common/startup_metric_utils.h" |
| 152 #include "chrome/common/url_constants.h" |
| 152 #include "chrome/common/web_apps.h" | 153 #include "chrome/common/web_apps.h" |
| 153 #include "content/public/browser/color_chooser.h" | 154 #include "content/public/browser/color_chooser.h" |
| 154 #include "content/public/browser/devtools_manager.h" | 155 #include "content/public/browser/devtools_manager.h" |
| 155 #include "content/public/browser/download_item.h" | 156 #include "content/public/browser/download_item.h" |
| 156 #include "content/public/browser/download_manager.h" | 157 #include "content/public/browser/download_manager.h" |
| 157 #include "content/public/browser/interstitial_page.h" | 158 #include "content/public/browser/interstitial_page.h" |
| 158 #include "content/public/browser/invalidate_type.h" | 159 #include "content/public/browser/invalidate_type.h" |
| 159 #include "content/public/browser/navigation_controller.h" | 160 #include "content/public/browser/navigation_controller.h" |
| 160 #include "content/public/browser/navigation_entry.h" | 161 #include "content/public/browser/navigation_entry.h" |
| 161 #include "content/public/browser/notification_details.h" | 162 #include "content/public/browser/notification_details.h" |
| (...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1393 void Browser::BeforeUnloadFired(WebContents* web_contents, | 1394 void Browser::BeforeUnloadFired(WebContents* web_contents, |
| 1394 bool proceed, | 1395 bool proceed, |
| 1395 bool* proceed_to_fire_unload) { | 1396 bool* proceed_to_fire_unload) { |
| 1396 *proceed_to_fire_unload = | 1397 *proceed_to_fire_unload = |
| 1397 unload_controller_->BeforeUnloadFired(web_contents, proceed); | 1398 unload_controller_->BeforeUnloadFired(web_contents, proceed); |
| 1398 } | 1399 } |
| 1399 | 1400 |
| 1400 bool Browser::ShouldFocusLocationBarByDefault(WebContents* source) { | 1401 bool Browser::ShouldFocusLocationBarByDefault(WebContents* source) { |
| 1401 const content::NavigationEntry* entry = | 1402 const content::NavigationEntry* entry = |
| 1402 source->GetController().GetActiveEntry(); | 1403 source->GetController().GetActiveEntry(); |
| 1404 if (entry && |
| 1405 entry->GetURL().SchemeIs(chrome::kChromeUIScheme) && |
| 1406 entry->GetURL().host() == chrome::kChromeUINewTabHost) { |
| 1407 return true; |
| 1408 } |
| 1409 |
| 1403 return chrome::NavEntryIsInstantNTP(source, entry); | 1410 return chrome::NavEntryIsInstantNTP(source, entry); |
| 1404 } | 1411 } |
| 1405 | 1412 |
| 1406 void Browser::SetFocusToLocationBar(bool select_all) { | 1413 void Browser::SetFocusToLocationBar(bool select_all) { |
| 1407 // Two differences between this and FocusLocationBar(): | 1414 // Two differences between this and FocusLocationBar(): |
| 1408 // (1) This doesn't get recorded in user metrics, since it's called | 1415 // (1) This doesn't get recorded in user metrics, since it's called |
| 1409 // internally. | 1416 // internally. |
| 1410 // (2) This checks whether the location bar can be focused, and if not, clears | 1417 // (2) This checks whether the location bar can be focused, and if not, clears |
| 1411 // the focus. FocusLocationBar() is only reached when the location bar is | 1418 // the focus. FocusLocationBar() is only reached when the location bar is |
| 1412 // focusable, but this may be reached at other times, e.g. while in | 1419 // focusable, but this may be reached at other times, e.g. while in |
| (...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2248 if (contents && !allow_js_access) { | 2255 if (contents && !allow_js_access) { |
| 2249 contents->web_contents()->GetController().LoadURL( | 2256 contents->web_contents()->GetController().LoadURL( |
| 2250 target_url, | 2257 target_url, |
| 2251 content::Referrer(), | 2258 content::Referrer(), |
| 2252 content::PAGE_TRANSITION_LINK, | 2259 content::PAGE_TRANSITION_LINK, |
| 2253 std::string()); // No extra headers. | 2260 std::string()); // No extra headers. |
| 2254 } | 2261 } |
| 2255 | 2262 |
| 2256 return contents != NULL; | 2263 return contents != NULL; |
| 2257 } | 2264 } |
| OLD | NEW |