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