Index: chrome/browser/ui/toolbar/wrench_menu_model.cc |
diff --git a/chrome/browser/ui/toolbar/wrench_menu_model.cc b/chrome/browser/ui/toolbar/wrench_menu_model.cc |
index 45a5ba7e4a94ccc9e8f428ccd1c451c353e0f77a..7bcc09c0117bd47033c23482c47cf490f499927b 100644 |
--- a/chrome/browser/ui/toolbar/wrench_menu_model.cc |
+++ b/chrome/browser/ui/toolbar/wrench_menu_model.cc |
@@ -43,6 +43,7 @@ |
#include "chrome/common/pref_names.h" |
#include "chrome/common/profiling.h" |
#include "content/public/browser/host_zoom_map.h" |
+#include "content/public/browser/navigation_entry.h" |
#include "content/public/browser/notification_service.h" |
#include "content/public/browser/notification_source.h" |
#include "content/public/browser/notification_types.h" |
@@ -58,6 +59,10 @@ |
#include "ui/gfx/image/image.h" |
#include "ui/gfx/image/image_skia.h" |
+#if defined(OS_CHROMEOS) |
+#include "ui/base/touch/touch_factory.h" |
+#endif |
+ |
#if defined(TOOLKIT_GTK) |
#include <gtk/gtk.h> |
#include "chrome/browser/ui/gtk/gtk_util.h" |
@@ -362,6 +367,15 @@ bool WrenchMenuModel::IsCommandIdChecked(int command_id) const { |
return browser_->profile()->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar); |
} else if (command_id == IDC_PROFILING_ENABLED) { |
return Profiling::BeingProfiled(); |
+ } else if (command_id == IDC_TOGGLE_REQUEST_TABLET_SITE) { |
+ WebContents* current_tab = chrome::GetActiveWebContents(browser_); |
sky
2012/09/07 18:05:30
Move this logic into a function, IsRequestingTable
sschmitz
2012/09/07 22:33:09
Done.
|
+ if (!current_tab) |
+ return false; |
+ content::NavigationEntry* entry = |
+ current_tab->GetController().GetActiveEntry(); |
+ if (!entry) |
+ return false; |
+ return entry->GetIsOverridingUserAgent(); |
} |
return false; |
@@ -533,7 +547,24 @@ void WrenchMenuModel::Build() { |
AddSeparator(ui::NORMAL_SEPARATOR); |
} |
- AddItemWithStringId(IDC_OPTIONS, IDS_SETTINGS); |
+ AddItemWithStringId(IDC_OPTIONS, IDS_SETTINGS);\ |
sky
2012/09/07 18:05:30
WHy the \ ?
sschmitz
2012/09/07 22:33:09
Oops, removed. Done.
|
+ |
+#if defined(OS_CHROMEOS) |
+ // Note: on Chromebooks with default to "Desktop Site" even for |
sky
2012/09/07 18:05:30
Again, how come we don't have one in about:flags ?
sschmitz
2012/09/07 22:33:09
Removed one flag, removed the "and is-touch-device
|
+ // Chromebooks with a touch screen. |
+ // The following toggle lets the user switch to |
+ // "Tablet Site". This functionality is under two flags: |
+ // - to turn in on only for touch devices (intended use) |
+ // - to turn it on regardless of touch device (for testing) |
+ bool enable_flag = CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kEnableRequestTabletSite); |
+ bool force_flag = CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kEnableRequestTabletSiteEvenIfNonTouchDevice); |
+ if (force_flag || |
+ (enable_flag && ui::TouchFactory::GetInstance()->IsTouchDevicePresent())) |
+ AddCheckItemWithStringId(IDC_TOGGLE_REQUEST_TABLET_SITE, |
+ IDS_TOGGLE_REQUEST_TABLET_SITE); |
+#endif |
// On ChromeOS-Touch, we don't want the about/background pages menu options. |
#if defined(OS_CHROMEOS) |