Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2613)

Unified Diff: chrome/browser/ui/browser_commands.cc

Issue 10827146: crbug.com/127841 - Request Tablet Site on CB with touch screen. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: removed spurious newline Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/browser_commands.cc
diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc
index b372acf2c7dae784bc934a7b116c165cfc1ca0e4..a89f9b794311f2a49fcbbd985e461ee0957e61f3 100644
--- a/chrome/browser/ui/browser_commands.cc
+++ b/chrome/browser/ui/browser_commands.cc
@@ -63,10 +63,12 @@
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "content/public/browser/web_intents_dispatcher.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/web_intent_data.h"
#include "webkit/glue/webkit_glue.h"
@@ -868,6 +870,34 @@ void ToggleSpeechInput(Browser* browser) {
GetActiveWebContents(browser)->GetRenderViewHost()->ToggleSpeechInput();
}
+void ToggleRequestTabletSite(Browser* browser) {
+ 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::BuildUserAgentOverrideForTabletSiteFromProduct(
+ content::GetContentClient()->GetProduct()));
+ }
+ controller.ReloadOriginalRequestURL(true);
+}
+
+bool CanRequestTabletSite(Browser* browser) {
+ if (!browser)
+ return false;
+ WebContents* current_tab = GetActiveWebContents(browser);
+ if (!current_tab)
+ return false;
+ return !!current_tab->GetController().GetActiveEntry();
gone 2012/09/06 18:08:32 Is this supposed to be a double !!?
sschmitz 2012/09/06 18:52:45 Yes, but since you ask, I changed to "... != NULL"
+}
+
void ToggleFullscreenMode(Browser* browser) {
browser->fullscreen_controller()->ToggleFullscreenMode();
}

Powered by Google App Engine
This is Rietveld 408576698