diff options
author | avayvod@chromium.org <avayvod@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-04 19:08:35 +0000 |
---|---|---|
committer | avayvod@chromium.org <avayvod@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-04 19:08:35 +0000 |
commit | fa8a23605d5cd615d7458a74052c1cdec21877ab (patch) | |
tree | 0bff4542af703f302df8e84f0fe7ec7df88bbbb9 | |
parent | 1fabd9a93df25441a704715c05d2e773d9ef4db1 (diff) | |
download | chromium_src-fa8a23605d5cd615d7458a74052c1cdec21877ab.zip chromium_src-fa8a23605d5cd615d7458a74052c1cdec21877ab.tar.gz chromium_src-fa8a23605d5cd615d7458a74052c1cdec21877ab.tar.bz2 |
Removed Timezone settings menu item from Clock menu for login wizard view.
BUG=34374
TEST=Switch to Chrome-based login manager, click on the clock button. Only
the date should be shown here, nothing like Settings... menu item.
Review URL: http://codereview.chromium.org/562044
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38117 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/chromeos/browser_view.cc | 9 | ||||
-rw-r--r-- | chrome/browser/chromeos/browser_view.h | 6 | ||||
-rw-r--r-- | chrome/browser/chromeos/clock_menu_button.cc | 6 | ||||
-rw-r--r-- | chrome/browser/chromeos/language_menu_button.cc | 14 | ||||
-rw-r--r-- | chrome/browser/chromeos/login_wizard_view.cc | 13 | ||||
-rw-r--r-- | chrome/browser/chromeos/login_wizard_view.h | 9 | ||||
-rw-r--r-- | chrome/browser/chromeos/status_area_host.h | 11 | ||||
-rw-r--r-- | chrome/browser/chromeos/status_area_view.h | 5 |
8 files changed, 52 insertions, 21 deletions
diff --git a/chrome/browser/chromeos/browser_view.cc b/chrome/browser/chromeos/browser_view.cc index 8baaf49..ec74458 100644 --- a/chrome/browser/chromeos/browser_view.cc +++ b/chrome/browser/chromeos/browser_view.cc @@ -445,11 +445,16 @@ gfx::NativeWindow BrowserView::GetNativeWindow() const { return GetWindow()->GetNativeWindow(); } -void BrowserView::OpenSystemOptionsDialog() const { +bool BrowserView::ShouldOpenButtonOptions( + const views::View* button_view) const { + return true; +} + +void BrowserView::OpenButtonOptions(const views::View* button_view) const { browser()->OpenSystemOptionsDialog(); } -bool BrowserView::IsButtonVisible(views::View* button_view) const { +bool BrowserView::IsButtonVisible(const views::View* button_view) const { if (button_view == status_area_->menu_view()) return !IsToolbarVisible(); return true; diff --git a/chrome/browser/chromeos/browser_view.h b/chrome/browser/chromeos/browser_view.h index 6b81982..e3fa12c 100644 --- a/chrome/browser/chromeos/browser_view.h +++ b/chrome/browser/chromeos/browser_view.h @@ -75,8 +75,10 @@ class BrowserView : public ::BrowserView, // StatusAreaHost overrides. virtual gfx::NativeWindow GetNativeWindow() const; - virtual void OpenSystemOptionsDialog() const; - virtual bool IsButtonVisible(views::View* button_view) const; + virtual bool ShouldOpenButtonOptions( + const views::View* button_view) const; + virtual void OpenButtonOptions(const views::View* button_view) const; + virtual bool IsButtonVisible(const views::View* button_view) const; // Shows the compact location bar under the selected tab. void ShowCompactLocationBarUnderSelectedTab(); diff --git a/chrome/browser/chromeos/clock_menu_button.cc b/chrome/browser/chromeos/clock_menu_button.cc index eecff67..77159b3 100644 --- a/chrome/browser/chromeos/clock_menu_button.cc +++ b/chrome/browser/chromeos/clock_menu_button.cc @@ -95,7 +95,9 @@ void ClockMenuButton::UpdateText() { // ClockMenuButton, menus::MenuModel implementation: int ClockMenuButton::GetItemCount() const { - return 3; + // If options dialog is unavailable, don't count a separator and configure + // menu item. + return host_->ShouldOpenButtonOptions(this) ? 3 : 1; } menus::MenuModel::ItemType ClockMenuButton::GetTypeAt(int index) const { @@ -117,7 +119,7 @@ bool ClockMenuButton::IsEnabledAt(int index) const { } void ClockMenuButton::ActivatedAt(int index) { - host_->OpenSystemOptionsDialog(); + host_->OpenButtonOptions(this); } //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/chromeos/language_menu_button.cc b/chrome/browser/chromeos/language_menu_button.cc index 54cc7ff..04741a2 100644 --- a/chrome/browser/chromeos/language_menu_button.cc +++ b/chrome/browser/chromeos/language_menu_button.cc @@ -267,7 +267,7 @@ void LanguageMenuButton::ActivatedAt(int index) { DCHECK(language_list_.get()); if (IndexPointsToConfigureImeMenuItem(index)) { - host_->OpenSystemOptionsDialog(); + host_->OpenButtonOptions(this); return; } @@ -369,11 +369,13 @@ void LanguageMenuButton::RebuildModel() { need_separator = true; } - // Note: We use AddSeparator() for separators, and AddRadioItem() for all - // other items even if an item is not actually a radio item. - if (need_separator) - model_->AddSeparator(); - model_->AddRadioItem(COMMAND_ID_CONFIGURE_IME, dummy_label, 0 /* dummy */); + if (host_->ShouldOpenButtonOptions(this)) { + // Note: We use AddSeparator() for separators, and AddRadioItem() for all + // other items even if an item is not actually a radio item. + if (need_separator) + model_->AddSeparator(); + model_->AddRadioItem(COMMAND_ID_CONFIGURE_IME, dummy_label, 0 /* dummy */); + } } bool LanguageMenuButton::IndexIsInLanguageList(int index) const { diff --git a/chrome/browser/chromeos/login_wizard_view.cc b/chrome/browser/chromeos/login_wizard_view.cc index 77a751b..09f5f10 100644 --- a/chrome/browser/chromeos/login_wizard_view.cc +++ b/chrome/browser/chromeos/login_wizard_view.cc @@ -15,6 +15,7 @@ #include "base/file_path.h" #include "base/logging.h" #include "base/process_util.h" +#include "chrome/browser/chromeos/clock_menu_button.h" #include "chrome/browser/chromeos/image_background.h" #include "chrome/browser/chromeos/login_library.h" #include "chrome/browser/chromeos/status_area_view.h" @@ -173,11 +174,19 @@ gfx::NativeWindow LoginWizardView::GetNativeWindow() const { return window()->GetNativeWindow(); } -void LoginWizardView::OpenSystemOptionsDialog() const { +bool LoginWizardView::ShouldOpenButtonOptions( + const views::View* button_view) const { + if (button_view == status_area_->clock_view()) { + return false; + } + return true; +} + +void LoginWizardView::OpenButtonOptions(const views::View* button_view) const { // TODO(avayvod): Add some dialog for options or remove them completely. } -bool LoginWizardView::IsButtonVisible(views::View* button_view) const { +bool LoginWizardView::IsButtonVisible(const views::View* button_view) const { return true; } diff --git a/chrome/browser/chromeos/login_wizard_view.h b/chrome/browser/chromeos/login_wizard_view.h index b2d05d0..01d779f 100644 --- a/chrome/browser/chromeos/login_wizard_view.h +++ b/chrome/browser/chromeos/login_wizard_view.h @@ -38,12 +38,13 @@ class LoginWizardView : public views::View, // Overriden from StatusAreaHost: virtual gfx::NativeWindow GetNativeWindow() const; - virtual void OpenSystemOptionsDialog() const; - virtual bool IsButtonVisible(views::View* button_view) const; + virtual bool ShouldOpenButtonOptions(const views::View* button_view) const; + virtual void OpenButtonOptions(const views::View* button_view) const; + virtual bool IsButtonVisible(const views::View* button_view) const; private: - // Creates login window. - void InitLoginWindow(); + // Creates login window. + void InitLoginWindow(); // Creates main wizard window with status bar. void InitWizardWindow(); diff --git a/chrome/browser/chromeos/status_area_host.h b/chrome/browser/chromeos/status_area_host.h index f8af405..b4a4b25 100644 --- a/chrome/browser/chromeos/status_area_host.h +++ b/chrome/browser/chromeos/status_area_host.h @@ -20,11 +20,16 @@ class StatusAreaHost { // Returns native window hosting the status area. virtual gfx::NativeWindow GetNativeWindow() const = 0; - // Opens system options dialog. - virtual void OpenSystemOptionsDialog() const = 0; + // Indicates if options dialog related to the button specified should be + // shown. + virtual bool ShouldOpenButtonOptions( + const views::View* button_view) const = 0; + + // Opens options dialog related to the button specified. + virtual void OpenButtonOptions(const views::View* button_view) const = 0; // Indicates if the button specified should be visible at the moment. - virtual bool IsButtonVisible(views::View* button_view) const = 0; + virtual bool IsButtonVisible(const views::View* button_view) const = 0; protected: virtual ~StatusAreaHost() {} diff --git a/chrome/browser/chromeos/status_area_view.h b/chrome/browser/chromeos/status_area_view.h index bc2a758..40741d0 100644 --- a/chrome/browser/chromeos/status_area_view.h +++ b/chrome/browser/chromeos/status_area_view.h @@ -42,6 +42,11 @@ class StatusAreaView : public views::View { static OpenTabsMode GetOpenTabsMode(); static void SetOpenTabsMode(OpenTabsMode mode); + ClockMenuButton* clock_view() { return clock_view_; } + LanguageMenuButton* language_view() { return language_view_; } + NetworkMenuButton* network_view() { return network_view_; } + PowerMenuButton* power_view() { return power_view_; } + private: StatusAreaHost* host_; |