| 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_commands.h" | 5 #include "chrome/browser/ui/browser_commands.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" |
| 12 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 12 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 14 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 15 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 15 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 16 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
| 17 #include "chrome/browser/devtools/devtools_window.h" | 17 #include "chrome/browser/devtools/devtools_window.h" |
| 18 #include "chrome/browser/dom_distiller/tab_utils.h" | 18 #include "chrome/browser/dom_distiller/tab_utils.h" |
| 19 #include "chrome/browser/lifetime/application_lifetime.h" | 19 #include "chrome/browser/lifetime/application_lifetime.h" |
| 20 #include "chrome/browser/platform_util.h" | 20 #include "chrome/browser/platform_util.h" |
| 21 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 21 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/rlz/rlz.h" | |
| 24 #include "chrome/browser/search/search.h" | 23 #include "chrome/browser/search/search.h" |
| 25 #include "chrome/browser/sessions/session_service_factory.h" | 24 #include "chrome/browser/sessions/session_service_factory.h" |
| 26 #include "chrome/browser/sessions/tab_restore_service.h" | 25 #include "chrome/browser/sessions/tab_restore_service.h" |
| 27 #include "chrome/browser/sessions/tab_restore_service_delegate.h" | 26 #include "chrome/browser/sessions/tab_restore_service_delegate.h" |
| 28 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 27 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 29 #include "chrome/browser/signin/signin_header_helper.h" | 28 #include "chrome/browser/signin/signin_header_helper.h" |
| 30 #include "chrome/browser/translate/chrome_translate_client.h" | 29 #include "chrome/browser/translate/chrome_translate_client.h" |
| 31 #include "chrome/browser/ui/accelerator_utils.h" | 30 #include "chrome/browser/ui/accelerator_utils.h" |
| 32 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" | 31 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" |
| 33 #include "chrome/browser/ui/browser.h" | 32 #include "chrome/browser/ui/browser.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 #include "extensions/common/extension_set.h" | 96 #include "extensions/common/extension_set.h" |
| 98 #endif | 97 #endif |
| 99 | 98 |
| 100 #if defined(ENABLE_PRINTING) | 99 #if defined(ENABLE_PRINTING) |
| 101 #include "chrome/browser/printing/print_view_manager_common.h" | 100 #include "chrome/browser/printing/print_view_manager_common.h" |
| 102 #if defined(ENABLE_PRINT_PREVIEW) | 101 #if defined(ENABLE_PRINT_PREVIEW) |
| 103 #include "chrome/browser/printing/print_preview_dialog_controller.h" | 102 #include "chrome/browser/printing/print_preview_dialog_controller.h" |
| 104 #endif // defined(ENABLE_PRINT_PREVIEW) | 103 #endif // defined(ENABLE_PRINT_PREVIEW) |
| 105 #endif // defined(ENABLE_PRINTING) | 104 #endif // defined(ENABLE_PRINTING) |
| 106 | 105 |
| 106 #if defined(ENABLE_RLZ) |
| 107 #include "components/rlz/rlz_tracker.h" |
| 108 #endif |
| 109 |
| 107 namespace { | 110 namespace { |
| 108 const char kOsOverrideForTabletSite[] = "Linux; Android 4.0.3"; | 111 const char kOsOverrideForTabletSite[] = "Linux; Android 4.0.3"; |
| 109 } | 112 } |
| 110 | 113 |
| 111 using base::UserMetricsAction; | 114 using base::UserMetricsAction; |
| 112 using bookmarks::BookmarkModel; | 115 using bookmarks::BookmarkModel; |
| 113 using content::NavigationController; | 116 using content::NavigationController; |
| 114 using content::NavigationEntry; | 117 using content::NavigationEntry; |
| 115 using content::OpenURLParams; | 118 using content::OpenURLParams; |
| 116 using content::Referrer; | 119 using content::Referrer; |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 void Home(Browser* browser, WindowOpenDisposition disposition) { | 429 void Home(Browser* browser, WindowOpenDisposition disposition) { |
| 427 content::RecordAction(UserMetricsAction("Home")); | 430 content::RecordAction(UserMetricsAction("Home")); |
| 428 | 431 |
| 429 std::string extra_headers; | 432 std::string extra_headers; |
| 430 #if defined(ENABLE_RLZ) && !defined(OS_IOS) | 433 #if defined(ENABLE_RLZ) && !defined(OS_IOS) |
| 431 // If the home page is a Google home page, add the RLZ header to the request. | 434 // If the home page is a Google home page, add the RLZ header to the request. |
| 432 PrefService* pref_service = browser->profile()->GetPrefs(); | 435 PrefService* pref_service = browser->profile()->GetPrefs(); |
| 433 if (pref_service) { | 436 if (pref_service) { |
| 434 if (google_util::IsGoogleHomePageUrl( | 437 if (google_util::IsGoogleHomePageUrl( |
| 435 GURL(pref_service->GetString(prefs::kHomePage)))) { | 438 GURL(pref_service->GetString(prefs::kHomePage)))) { |
| 436 extra_headers = RLZTracker::GetAccessPointHttpHeader( | 439 extra_headers = rlz::RLZTracker::GetAccessPointHttpHeader( |
| 437 RLZTracker::ChromeHomePage()); | 440 rlz::RLZTracker::ChromeHomePage()); |
| 438 } | 441 } |
| 439 } | 442 } |
| 440 #endif // defined(ENABLE_RLZ) && !defined(OS_IOS) | 443 #endif // defined(ENABLE_RLZ) && !defined(OS_IOS) |
| 441 | 444 |
| 442 GURL url = browser->profile()->GetHomePage(); | 445 GURL url = browser->profile()->GetHomePage(); |
| 443 | 446 |
| 444 #if defined(ENABLE_EXTENSIONS) | 447 #if defined(ENABLE_EXTENSIONS) |
| 445 // With bookmark apps enabled, hosted apps should return to their launch page | 448 // With bookmark apps enabled, hosted apps should return to their launch page |
| 446 // when the home button is pressed. | 449 // when the home button is pressed. |
| 447 if (browser->is_app()) { | 450 if (browser->is_app()) { |
| (...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1277 browser->host_desktop_type())); | 1280 browser->host_desktop_type())); |
| 1278 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1281 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
| 1279 | 1282 |
| 1280 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1283 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
| 1281 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1284 contents->GetRenderViewHost()->SyncRendererPrefs(); |
| 1282 app_browser->window()->Show(); | 1285 app_browser->window()->Show(); |
| 1283 } | 1286 } |
| 1284 #endif // defined(ENABLE_EXTENSIONS) | 1287 #endif // defined(ENABLE_EXTENSIONS) |
| 1285 | 1288 |
| 1286 } // namespace chrome | 1289 } // namespace chrome |
| OLD | NEW |