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_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 #include "content/public/browser/user_metrics.h" | 80 #include "content/public/browser/user_metrics.h" |
81 #include "content/public/browser/web_contents.h" | 81 #include "content/public/browser/web_contents.h" |
82 #include "content/public/common/page_state.h" | 82 #include "content/public/common/page_state.h" |
83 #include "content/public/common/renderer_preferences.h" | 83 #include "content/public/common/renderer_preferences.h" |
84 #include "content/public/common/url_constants.h" | 84 #include "content/public/common/url_constants.h" |
85 #include "content/public/common/url_utils.h" | 85 #include "content/public/common/url_utils.h" |
86 #include "content/public/common/user_agent.h" | 86 #include "content/public/common/user_agent.h" |
87 #include "extensions/features/features.h" | 87 #include "extensions/features/features.h" |
88 #include "net/base/escape.h" | 88 #include "net/base/escape.h" |
89 #include "printing/features/features.h" | 89 #include "printing/features/features.h" |
| 90 #include "rlz/features/features.h" |
90 #include "ui/events/keycodes/keyboard_codes.h" | 91 #include "ui/events/keycodes/keyboard_codes.h" |
91 | 92 |
92 #if BUILDFLAG(ENABLE_EXTENSIONS) | 93 #if BUILDFLAG(ENABLE_EXTENSIONS) |
93 #include "chrome/browser/extensions/api/commands/command_service.h" | 94 #include "chrome/browser/extensions/api/commands/command_service.h" |
94 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | 95 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
95 #include "chrome/browser/extensions/tab_helper.h" | 96 #include "chrome/browser/extensions/tab_helper.h" |
96 #include "chrome/browser/ui/extensions/settings_api_bubble_helpers.h" | 97 #include "chrome/browser/ui/extensions/settings_api_bubble_helpers.h" |
97 #include "chrome/browser/web_applications/web_app.h" | 98 #include "chrome/browser/web_applications/web_app.h" |
98 #include "chrome/common/extensions/extension_metrics.h" | 99 #include "chrome/common/extensions/extension_metrics.h" |
99 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" | 100 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
100 #include "extensions/browser/extension_registry.h" | 101 #include "extensions/browser/extension_registry.h" |
101 #include "extensions/browser/extension_system.h" | 102 #include "extensions/browser/extension_system.h" |
102 #include "extensions/common/extension.h" | 103 #include "extensions/common/extension.h" |
103 #include "extensions/common/extension_set.h" | 104 #include "extensions/common/extension_set.h" |
104 #endif | 105 #endif |
105 | 106 |
106 #if BUILDFLAG(ENABLE_PRINTING) | 107 #if BUILDFLAG(ENABLE_PRINTING) |
107 #include "chrome/browser/printing/print_view_manager_common.h" | 108 #include "chrome/browser/printing/print_view_manager_common.h" |
108 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) | 109 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
109 #include "chrome/browser/printing/print_preview_dialog_controller.h" | 110 #include "chrome/browser/printing/print_preview_dialog_controller.h" |
110 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) | 111 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) |
111 #endif // BUILDFLAG(ENABLE_PRINTING) | 112 #endif // BUILDFLAG(ENABLE_PRINTING) |
112 | 113 |
113 #if defined(ENABLE_RLZ) | 114 #if BUILDFLAG(ENABLE_RLZ) |
114 #include "components/rlz/rlz_tracker.h" // nogncheck | 115 #include "components/rlz/rlz_tracker.h" // nogncheck |
115 #endif | 116 #endif |
116 | 117 |
117 #if defined(ENABLE_MEDIA_ROUTER) | 118 #if defined(ENABLE_MEDIA_ROUTER) |
118 #include "chrome/browser/media/router/media_router_dialog_controller.h" // nogn
check | 119 #include "chrome/browser/media/router/media_router_dialog_controller.h" // nogn
check |
119 #endif | 120 #endif |
120 | 121 |
121 namespace { | 122 namespace { |
122 | 123 |
123 const char kOsOverrideForTabletSite[] = "Linux; Android 4.0.3"; | 124 const char kOsOverrideForTabletSite[] = "Linux; Android 4.0.3"; |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 } | 467 } |
467 | 468 |
468 bool CanReload(const Browser* browser) { | 469 bool CanReload(const Browser* browser) { |
469 return !browser->is_devtools(); | 470 return !browser->is_devtools(); |
470 } | 471 } |
471 | 472 |
472 void Home(Browser* browser, WindowOpenDisposition disposition) { | 473 void Home(Browser* browser, WindowOpenDisposition disposition) { |
473 content::RecordAction(UserMetricsAction("Home")); | 474 content::RecordAction(UserMetricsAction("Home")); |
474 | 475 |
475 std::string extra_headers; | 476 std::string extra_headers; |
476 #if defined(ENABLE_RLZ) | 477 #if BUILDFLAG(ENABLE_RLZ) |
477 // If the home page is a Google home page, add the RLZ header to the request. | 478 // If the home page is a Google home page, add the RLZ header to the request. |
478 PrefService* pref_service = browser->profile()->GetPrefs(); | 479 PrefService* pref_service = browser->profile()->GetPrefs(); |
479 if (pref_service) { | 480 if (pref_service) { |
480 if (google_util::IsGoogleHomePageUrl( | 481 if (google_util::IsGoogleHomePageUrl( |
481 GURL(pref_service->GetString(prefs::kHomePage)))) { | 482 GURL(pref_service->GetString(prefs::kHomePage)))) { |
482 extra_headers = rlz::RLZTracker::GetAccessPointHttpHeader( | 483 extra_headers = rlz::RLZTracker::GetAccessPointHttpHeader( |
483 rlz::RLZTracker::ChromeHomePage()); | 484 rlz::RLZTracker::ChromeHomePage()); |
484 } | 485 } |
485 } | 486 } |
486 #endif // defined(ENABLE_RLZ) | 487 #endif // BUILDFLAG(ENABLE_RLZ) |
487 | 488 |
488 GURL url = browser->profile()->GetHomePage(); | 489 GURL url = browser->profile()->GetHomePage(); |
489 | 490 |
490 #if BUILDFLAG(ENABLE_EXTENSIONS) | 491 #if BUILDFLAG(ENABLE_EXTENSIONS) |
491 // With bookmark apps enabled, hosted apps should return to their launch page | 492 // With bookmark apps enabled, hosted apps should return to their launch page |
492 // when the home button is pressed. | 493 // when the home button is pressed. |
493 if (browser->is_app()) { | 494 if (browser->is_app()) { |
494 const extensions::Extension* extension = | 495 const extensions::Extension* extension = |
495 extensions::ExtensionRegistry::Get(browser->profile()) | 496 extensions::ExtensionRegistry::Get(browser->profile()) |
496 ->GetExtensionById( | 497 ->GetExtensionById( |
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1330 app_name, true /* trusted_source */, gfx::Rect(), browser->profile())); | 1331 app_name, true /* trusted_source */, gfx::Rect(), browser->profile())); |
1331 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1332 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
1332 | 1333 |
1333 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1334 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
1334 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1335 contents->GetRenderViewHost()->SyncRendererPrefs(); |
1335 app_browser->window()->Show(); | 1336 app_browser->window()->Show(); |
1336 } | 1337 } |
1337 #endif // BUILDFLAG(ENABLE_EXTENSIONS) | 1338 #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
1338 | 1339 |
1339 } // namespace chrome | 1340 } // namespace chrome |
OLD | NEW |