| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #include "chrome/browser/ui/chrome_pages.h" | 46 #include "chrome/browser/ui/chrome_pages.h" |
| 47 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 47 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| 48 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 48 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
| 49 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 49 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
| 50 #include "chrome/browser/ui/omnibox/location_bar.h" | 50 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 51 #include "chrome/browser/ui/status_bubble.h" | 51 #include "chrome/browser/ui/status_bubble.h" |
| 52 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 52 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 53 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 53 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
| 54 #include "chrome/browser/upgrade_detector.h" | 54 #include "chrome/browser/upgrade_detector.h" |
| 55 #include "chrome/browser/web_applications/web_app.h" | 55 #include "chrome/browser/web_applications/web_app.h" |
| 56 #include "chrome/common/chrome_content_client.h" | |
| 57 #include "chrome/common/chrome_notification_types.h" | 56 #include "chrome/common/chrome_notification_types.h" |
| 58 #include "chrome/common/chrome_switches.h" | 57 #include "chrome/common/chrome_switches.h" |
| 58 #include "chrome/common/chrome_version_info.h" |
| 59 #include "chrome/common/pref_names.h" | 59 #include "chrome/common/pref_names.h" |
| 60 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 60 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 61 #include "content/public/browser/devtools_agent_host.h" | 61 #include "content/public/browser/devtools_agent_host.h" |
| 62 #include "content/public/browser/navigation_controller.h" | 62 #include "content/public/browser/navigation_controller.h" |
| 63 #include "content/public/browser/navigation_entry.h" | 63 #include "content/public/browser/navigation_entry.h" |
| 64 #include "content/public/browser/notification_service.h" | 64 #include "content/public/browser/notification_service.h" |
| 65 #include "content/public/browser/page_navigator.h" | 65 #include "content/public/browser/page_navigator.h" |
| 66 #include "content/public/browser/render_view_host.h" | 66 #include "content/public/browser/render_view_host.h" |
| 67 #include "content/public/browser/user_metrics.h" | 67 #include "content/public/browser/user_metrics.h" |
| 68 #include "content/public/browser/web_contents.h" | 68 #include "content/public/browser/web_contents.h" |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 if (!current_tab) | 957 if (!current_tab) |
| 958 return; | 958 return; |
| 959 NavigationController& controller = current_tab->GetController(); | 959 NavigationController& controller = current_tab->GetController(); |
| 960 NavigationEntry* entry = controller.GetActiveEntry(); | 960 NavigationEntry* entry = controller.GetActiveEntry(); |
| 961 if (!entry) | 961 if (!entry) |
| 962 return; | 962 return; |
| 963 if (entry->GetIsOverridingUserAgent()) { | 963 if (entry->GetIsOverridingUserAgent()) { |
| 964 entry->SetIsOverridingUserAgent(false); | 964 entry->SetIsOverridingUserAgent(false); |
| 965 } else { | 965 } else { |
| 966 entry->SetIsOverridingUserAgent(true); | 966 entry->SetIsOverridingUserAgent(true); |
| 967 chrome::VersionInfo version_info; |
| 968 std::string product; |
| 969 if (version_info.is_valid()) |
| 970 product = version_info.ProductNameAndVersionForUserAgent(); |
| 967 current_tab->SetUserAgentOverride( | 971 current_tab->SetUserAgentOverride( |
| 968 webkit_glue::BuildUserAgentFromOSAndProduct( | 972 webkit_glue::BuildUserAgentFromOSAndProduct( |
| 969 kOsOverrideForTabletSite, | 973 kOsOverrideForTabletSite, product)); |
| 970 ChromeContentClient::GetProductImpl())); | |
| 971 } | 974 } |
| 972 controller.ReloadOriginalRequestURL(true); | 975 controller.ReloadOriginalRequestURL(true); |
| 973 } | 976 } |
| 974 | 977 |
| 975 void ToggleFullscreenMode(Browser* browser) { | 978 void ToggleFullscreenMode(Browser* browser) { |
| 976 browser->fullscreen_controller()->ToggleFullscreenMode(); | 979 browser->fullscreen_controller()->ToggleFullscreenMode(); |
| 977 } | 980 } |
| 978 | 981 |
| 979 void ClearCache(Browser* browser) { | 982 void ClearCache(Browser* browser) { |
| 980 BrowsingDataRemover* remover = | 983 BrowsingDataRemover* remover = |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 Browser::TYPE_POPUP, app_name, gfx::Rect(), browser->profile(), | 1106 Browser::TYPE_POPUP, app_name, gfx::Rect(), browser->profile(), |
| 1104 browser->host_desktop_type())); | 1107 browser->host_desktop_type())); |
| 1105 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1108 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
| 1106 | 1109 |
| 1107 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1110 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
| 1108 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1111 contents->GetRenderViewHost()->SyncRendererPrefs(); |
| 1109 app_browser->window()->Show(); | 1112 app_browser->window()->Show(); |
| 1110 } | 1113 } |
| 1111 | 1114 |
| 1112 } // namespace chrome | 1115 } // namespace chrome |
| OLD | NEW |