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..c267d783356a4630ee7e80bfdda3e877ab5db3ad 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,24 @@ void ToggleSpeechInput(Browser* browser) { |
GetActiveWebContents(browser)->GetRenderViewHost()->ToggleSpeechInput(); |
} |
+void ToggleRequestTabletSite(Browser* browser) |
+{ |
+ WebContents* current_tab = GetActiveWebContents(browser); |
+ if (!current_tab) return; |
+ NavigationEntry *entry = current_tab->GetController().GetActiveEntry(); |
+ if (!entry) return; |
+ if (entry->GetIsOverridingUserAgent()) { |
+ entry->SetIsOverridingUserAgent(false); |
+ 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
|
+ } else { |
+ entry->SetIsOverridingUserAgent(true); |
+ current_tab->SetUserAgentOverride( |
+ webkit_glue::BuildUserAgentOverrideForTabletSiteFromUserAgent( |
+ content::GetUserAgent(entry->GetOriginalRequestURL()))); |
+ } |
+ current_tab->GetController().Reload(true); |
+} |
+ |
void ToggleFullscreenMode(Browser* browser) { |
browser->fullscreen_controller()->ToggleFullscreenMode(); |
} |