Chromium Code Reviews| Index: chrome/browser/ui/browser_commands.cc |
| diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc |
| index 423efc915ea14d1bdfdb860592384f17b6eef198..38d5cf35ea10f818c198ff3a778d3e5c81a4d400 100644 |
| --- a/chrome/browser/ui/browser_commands.cc |
| +++ b/chrome/browser/ui/browser_commands.cc |
| @@ -62,10 +62,12 @@ |
| #include "content/public/browser/user_metrics.h" |
| #include "content/public/browser/web_contents.h" |
| #include "content/public/browser/web_contents_view.h" |
| +#include "content/public/common/content_client.h" |
| #include "content/public/common/content_restriction.h" |
| #include "content/public/common/renderer_preferences.h" |
| #include "content/public/common/url_constants.h" |
| #include "net/base/escape.h" |
| +#include "webkit/glue/user_agent.h" |
| #include "webkit/glue/webkit_glue.h" |
| #if defined(OS_MACOSX) |
| @@ -864,6 +866,28 @@ void ToggleSpeechInput(Browser* browser) { |
| GetActiveWebContents(browser)->GetRenderViewHost()->ToggleSpeechInput(); |
| } |
| +void ToggleRequestTabletSite(Browser* browser) |
| +{ |
|
sky
2012/08/06 21:41:06
{ should be on previous line.
sschmitz
2012/08/07 02:19:49
Done.
|
| + // Note: The associated control is disabled when current_tab |
|
sky
2012/08/06 21:41:06
This comment is misleading so you don't do that in
sschmitz
2012/08/07 02:19:49
Removed the comment. Some reorg.
Done.
|
| + // or entry are NULL. |
| + WebContents* current_tab = GetActiveWebContents(browser); |
| + if (!current_tab) |
| + return; |
| + NavigationController& controller = current_tab->GetController(); |
| + NavigationEntry* entry = controller.GetActiveEntry(); |
| + if (!entry) |
| + return; |
| + if (entry->GetIsOverridingUserAgent()) { |
| + entry->SetIsOverridingUserAgent(false); |
| + } else { |
| + entry->SetIsOverridingUserAgent(true); |
| + current_tab->SetUserAgentOverride( |
| + webkit_glue::BuildUserAgentOverrideForTabletSiteFromUserAgent( |
| + content::GetUserAgent(entry->GetOriginalRequestURL()))); |
| + } |
| + controller.Reload(true); |
| +} |
| + |
| void ToggleFullscreenMode(Browser* browser) { |
| browser->fullscreen_controller()->ToggleFullscreenMode(); |
| } |