Chromium Code Reviews| 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 6f5e608d7e244f07a7c6e8f31456c952ba70add2..d62a4d59a373d7f0788a77dfe124beddcd488ba8 100644 |
| --- a/chrome/browser/ui/toolbar/wrench_menu_model.cc |
| +++ b/chrome/browser/ui/toolbar/wrench_menu_model.cc |
| @@ -42,6 +42,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" |
| @@ -54,6 +55,7 @@ |
| #include "ui/base/layout.h" |
| #include "ui/base/models/button_menu_item_model.h" |
| #include "ui/base/resource/resource_bundle.h" |
| +#include "ui/base/touch/touch_factory.h" |
| #include "ui/gfx/image/image.h" |
| #include "ui/gfx/image/image_skia.h" |
| @@ -361,6 +363,14 @@ 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) { |
| + if (!browser_) return false; |
|
Rick Byers
2012/08/03 15:53:06
newline after if, here and elsewhere
sschmitz
2012/08/03 18:11:43
Done.
|
| + content::WebContents* current_tab = chrome::GetActiveWebContents(browser_); |
| + if (!current_tab) return false; |
| + content::NavigationEntry *entry = |
| + current_tab->GetController().GetActiveEntry(); |
| + if (!entry) return false; |
| + return entry->GetIsOverridingUserAgent(); |
|
Rick Byers
2012/08/03 15:53:06
Again, I think you want some independent state som
sschmitz
2012/08/03 18:11:43
Similar to browser_commands.cc, the control is dis
|
| } |
| return false; |
| @@ -505,6 +515,23 @@ void WrenchMenuModel::Build() { |
| AddItemWithStringId(IDC_OPTIONS, IDS_SETTINGS); |
| +#if defined(OS_CHROMEOS) |
| + // Note: on Chromebooks with default to "Desktop Site" even for |
| + // 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 enableFlag = CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kEnableRequestTabletSite); |
| + bool forceFlag = CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kEnableRequestTabletSiteEvenIfNonTouchDevice); |
| + if (forceFlag || |
| + (enableFlag && ui::TouchFactory::GetInstance()->IsTouchDevicePresent())) |
|
Rick Byers
2012/08/03 15:53:06
IsTouchDevicePresent is itself behind a flag (--en
sschmitz
2012/08/03 18:11:43
Question: Don't we want the added control to turn
|
| + AddCheckItemWithStringId(IDC_TOGGLE_REQUEST_TABLET_SITE, |
| + IDS_TOGGLE_REQUEST_TABLET_SITE); |
| +#endif |
| + |
| if (!is_touch_menu) { |
| AddItem(IDC_ABOUT, l10n_util::GetStringUTF16(IDS_ABOUT)); |
| string16 num_background_pages = base::FormatNumber( |