OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/bookmarks/bookmark_editor.h" | 10 #include "chrome/browser/bookmarks/bookmark_editor.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 #include "chrome/common/chrome_switches.h" | 55 #include "chrome/common/chrome_switches.h" |
56 #include "chrome/common/pref_names.h" | 56 #include "chrome/common/pref_names.h" |
57 #include "content/public/browser/devtools_agent_host_registry.h" | 57 #include "content/public/browser/devtools_agent_host_registry.h" |
58 #include "content/public/browser/navigation_controller.h" | 58 #include "content/public/browser/navigation_controller.h" |
59 #include "content/public/browser/navigation_entry.h" | 59 #include "content/public/browser/navigation_entry.h" |
60 #include "content/public/browser/page_navigator.h" | 60 #include "content/public/browser/page_navigator.h" |
61 #include "content/public/browser/render_view_host.h" | 61 #include "content/public/browser/render_view_host.h" |
62 #include "content/public/browser/user_metrics.h" | 62 #include "content/public/browser/user_metrics.h" |
63 #include "content/public/browser/web_contents.h" | 63 #include "content/public/browser/web_contents.h" |
64 #include "content/public/browser/web_contents_view.h" | 64 #include "content/public/browser/web_contents_view.h" |
65 #include "content/public/common/content_client.h" | |
65 #include "content/public/common/content_restriction.h" | 66 #include "content/public/common/content_restriction.h" |
66 #include "content/public/common/renderer_preferences.h" | 67 #include "content/public/common/renderer_preferences.h" |
67 #include "content/public/common/url_constants.h" | 68 #include "content/public/common/url_constants.h" |
68 #include "net/base/escape.h" | 69 #include "net/base/escape.h" |
70 #include "webkit/glue/user_agent.h" | |
69 #include "webkit/glue/webkit_glue.h" | 71 #include "webkit/glue/webkit_glue.h" |
70 | 72 |
71 #if defined(OS_MACOSX) | 73 #if defined(OS_MACOSX) |
72 #include "ui/base/cocoa/find_pasteboard.h" | 74 #include "ui/base/cocoa/find_pasteboard.h" |
73 #endif | 75 #endif |
74 | 76 |
75 #if defined(OS_WIN) | 77 #if defined(OS_WIN) |
76 #include "base/win/metro.h" | 78 #include "base/win/metro.h" |
77 #endif | 79 #endif |
78 | 80 |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
857 | 859 |
858 void OpenUpdateChromeDialog(Browser* browser) { | 860 void OpenUpdateChromeDialog(Browser* browser) { |
859 content::RecordAction(UserMetricsAction("UpdateChrome")); | 861 content::RecordAction(UserMetricsAction("UpdateChrome")); |
860 browser->window()->ShowUpdateChromeDialog(); | 862 browser->window()->ShowUpdateChromeDialog(); |
861 } | 863 } |
862 | 864 |
863 void ToggleSpeechInput(Browser* browser) { | 865 void ToggleSpeechInput(Browser* browser) { |
864 GetActiveWebContents(browser)->GetRenderViewHost()->ToggleSpeechInput(); | 866 GetActiveWebContents(browser)->GetRenderViewHost()->ToggleSpeechInput(); |
865 } | 867 } |
866 | 868 |
869 void ToggleRequestTabletSite(Browser* browser) | |
870 { | |
871 WebContents* current_tab = GetActiveWebContents(browser); | |
872 if (!current_tab) return; | |
873 NavigationEntry *entry = current_tab->GetController().GetActiveEntry(); | |
874 if (!entry) return; | |
875 if (entry->GetIsOverridingUserAgent()) { | |
876 entry->SetIsOverridingUserAgent(false); | |
877 current_tab->SetUserAgentOverride(std::string()); | |
gone
2012/08/03 00:08:26
I don't think you have to worry about un-setting t
sschmitz
2012/08/03 15:36:58
I agree, but I prefer to unset the string. It seem
Rick Byers
2012/08/03 15:53:06
I'm not sure that's what we want. This is about s
sschmitz
2012/08/03 18:11:43
Yes, good question. I can see benefits for both sc
sschmitz
2012/08/03 23:25:26
Later: After more talk with Dan, I changed it back
| |
878 } else { | |
879 entry->SetIsOverridingUserAgent(true); | |
880 current_tab->SetUserAgentOverride( | |
881 webkit_glue::BuildUserAgentOverrideForTabletSiteFromUserAgent( | |
882 content::GetUserAgent(entry->GetOriginalRequestURL()))); | |
883 } | |
884 current_tab->GetController().Reload(true); | |
885 } | |
886 | |
867 void ToggleFullscreenMode(Browser* browser) { | 887 void ToggleFullscreenMode(Browser* browser) { |
868 browser->fullscreen_controller()->ToggleFullscreenMode(); | 888 browser->fullscreen_controller()->ToggleFullscreenMode(); |
869 } | 889 } |
870 | 890 |
871 void ClearCache(Browser* browser) { | 891 void ClearCache(Browser* browser) { |
872 BrowsingDataRemover* remover = new BrowsingDataRemover(browser->profile(), | 892 BrowsingDataRemover* remover = new BrowsingDataRemover(browser->profile(), |
873 BrowsingDataRemover::EVERYTHING, | 893 BrowsingDataRemover::EVERYTHING, |
874 base::Time()); | 894 base::Time()); |
875 remover->Remove(BrowsingDataRemover::REMOVE_CACHE, | 895 remover->Remove(BrowsingDataRemover::REMOVE_CACHE, |
876 BrowsingDataHelper::UNPROTECTED_WEB); | 896 BrowsingDataHelper::UNPROTECTED_WEB); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
989 if (!tab_contents) | 1009 if (!tab_contents) |
990 tab_contents = new TabContents(contents); | 1010 tab_contents = new TabContents(contents); |
991 app_browser->tab_strip_model()->AppendTabContents(tab_contents, true); | 1011 app_browser->tab_strip_model()->AppendTabContents(tab_contents, true); |
992 | 1012 |
993 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1013 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
994 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1014 contents->GetRenderViewHost()->SyncRendererPrefs(); |
995 app_browser->window()->Show(); | 1015 app_browser->window()->Show(); |
996 } | 1016 } |
997 | 1017 |
998 } // namespace chrome | 1018 } // namespace chrome |
OLD | NEW |