| 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" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "chrome/browser/ui/location_bar/location_bar.h" | 43 #include "chrome/browser/ui/location_bar/location_bar.h" |
| 44 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" | 44 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" |
| 45 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 45 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
| 46 #include "chrome/browser/ui/search/search_tab_helper.h" | 46 #include "chrome/browser/ui/search/search_tab_helper.h" |
| 47 #include "chrome/browser/ui/status_bubble.h" | 47 #include "chrome/browser/ui/status_bubble.h" |
| 48 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 48 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
| 49 #include "chrome/browser/ui/tab_dialogs.h" | 49 #include "chrome/browser/ui/tab_dialogs.h" |
| 50 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 50 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 51 #include "chrome/browser/upgrade_detector.h" | 51 #include "chrome/browser/upgrade_detector.h" |
| 52 #include "chrome/common/chrome_switches.h" | 52 #include "chrome/common/chrome_switches.h" |
| 53 #include "chrome/common/chrome_version_info.h" | |
| 54 #include "chrome/common/content_restriction.h" | 53 #include "chrome/common/content_restriction.h" |
| 55 #include "chrome/common/pref_names.h" | 54 #include "chrome/common/pref_names.h" |
| 56 #include "components/bookmarks/browser/bookmark_model.h" | 55 #include "components/bookmarks/browser/bookmark_model.h" |
| 57 #include "components/bookmarks/browser/bookmark_utils.h" | 56 #include "components/bookmarks/browser/bookmark_utils.h" |
| 58 #include "components/favicon/content/content_favicon_driver.h" | 57 #include "components/favicon/content/content_favicon_driver.h" |
| 59 #include "components/google/core/browser/google_util.h" | 58 #include "components/google/core/browser/google_util.h" |
| 60 #include "components/signin/core/browser/signin_header_helper.h" | 59 #include "components/signin/core/browser/signin_header_helper.h" |
| 61 #include "components/translate/core/browser/language_state.h" | 60 #include "components/translate/core/browser/language_state.h" |
| 62 #include "components/ui/zoom/page_zoom.h" | 61 #include "components/ui/zoom/page_zoom.h" |
| 63 #include "components/ui/zoom/zoom_controller.h" | 62 #include "components/ui/zoom/zoom_controller.h" |
| 63 #include "components/version_info/version_info.h" |
| 64 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 64 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 65 #include "content/public/browser/devtools_agent_host.h" | 65 #include "content/public/browser/devtools_agent_host.h" |
| 66 #include "content/public/browser/navigation_controller.h" | 66 #include "content/public/browser/navigation_controller.h" |
| 67 #include "content/public/browser/navigation_entry.h" | 67 #include "content/public/browser/navigation_entry.h" |
| 68 #include "content/public/browser/notification_service.h" | 68 #include "content/public/browser/notification_service.h" |
| 69 #include "content/public/browser/page_navigator.h" | 69 #include "content/public/browser/page_navigator.h" |
| 70 #include "content/public/browser/render_view_host.h" | 70 #include "content/public/browser/render_view_host.h" |
| 71 #include "content/public/browser/render_widget_host_view.h" | 71 #include "content/public/browser/render_widget_host_view.h" |
| 72 #include "content/public/browser/user_metrics.h" | 72 #include "content/public/browser/user_metrics.h" |
| 73 #include "content/public/browser/web_contents.h" | 73 #include "content/public/browser/web_contents.h" |
| (...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1113 if (!current_tab) | 1113 if (!current_tab) |
| 1114 return; | 1114 return; |
| 1115 NavigationController& controller = current_tab->GetController(); | 1115 NavigationController& controller = current_tab->GetController(); |
| 1116 NavigationEntry* entry = controller.GetLastCommittedEntry(); | 1116 NavigationEntry* entry = controller.GetLastCommittedEntry(); |
| 1117 if (!entry) | 1117 if (!entry) |
| 1118 return; | 1118 return; |
| 1119 if (entry->GetIsOverridingUserAgent()) { | 1119 if (entry->GetIsOverridingUserAgent()) { |
| 1120 entry->SetIsOverridingUserAgent(false); | 1120 entry->SetIsOverridingUserAgent(false); |
| 1121 } else { | 1121 } else { |
| 1122 entry->SetIsOverridingUserAgent(true); | 1122 entry->SetIsOverridingUserAgent(true); |
| 1123 chrome::VersionInfo version_info; | 1123 std::string product = version_info::GetProductNameAndVersionForUserAgent(); |
| 1124 std::string product = version_info.ProductNameAndVersionForUserAgent(); | |
| 1125 current_tab->SetUserAgentOverride(content::BuildUserAgentFromOSAndProduct( | 1124 current_tab->SetUserAgentOverride(content::BuildUserAgentFromOSAndProduct( |
| 1126 kOsOverrideForTabletSite, product)); | 1125 kOsOverrideForTabletSite, product)); |
| 1127 } | 1126 } |
| 1128 controller.ReloadOriginalRequestURL(true); | 1127 controller.ReloadOriginalRequestURL(true); |
| 1129 } | 1128 } |
| 1130 | 1129 |
| 1131 void ToggleFullscreenMode(Browser* browser) { | 1130 void ToggleFullscreenMode(Browser* browser) { |
| 1132 DCHECK(browser); | 1131 DCHECK(browser); |
| 1133 browser->exclusive_access_manager() | 1132 browser->exclusive_access_manager() |
| 1134 ->fullscreen_controller() | 1133 ->fullscreen_controller() |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1278 browser->host_desktop_type())); | 1277 browser->host_desktop_type())); |
| 1279 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1278 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
| 1280 | 1279 |
| 1281 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1280 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
| 1282 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1281 contents->GetRenderViewHost()->SyncRendererPrefs(); |
| 1283 app_browser->window()->Show(); | 1282 app_browser->window()->Show(); |
| 1284 } | 1283 } |
| 1285 #endif // defined(ENABLE_EXTENSIONS) | 1284 #endif // defined(ENABLE_EXTENSIONS) |
| 1286 | 1285 |
| 1287 } // namespace chrome | 1286 } // namespace chrome |
| OLD | NEW |