summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/frame/browser_view.cc64
-rw-r--r--chrome/browser/chromeos/frame/browser_view.h26
-rw-r--r--chrome/browser/chromeos/login/background_view.cc44
-rw-r--r--chrome/browser/chromeos/login/background_view.h32
-rw-r--r--chrome/browser/chromeos/login/existing_user_controller.cc1
-rw-r--r--chrome/browser/chromeos/login/keyboard_switch_menu.cc4
-rw-r--r--chrome/browser/chromeos/login/keyboard_switch_menu.h1
-rw-r--r--chrome/browser/chromeos/login/screen_locker_views.cc6
-rw-r--r--chrome/browser/chromeos/login/webui_login_view.cc46
-rw-r--r--chrome/browser/chromeos/login/webui_login_view.h31
-rw-r--r--chrome/browser/chromeos/status/OWNERS3
-rw-r--r--chrome/browser/chromeos/status/accessibility_menu_button.cc11
-rw-r--r--chrome/browser/chromeos/status/accessibility_menu_button.h8
-rw-r--r--chrome/browser/chromeos/status/accessibility_menu_button_browsertest.cc5
-rw-r--r--chrome/browser/chromeos/status/caps_lock_menu_button.cc18
-rw-r--r--chrome/browser/chromeos/status/caps_lock_menu_button.h3
-rw-r--r--chrome/browser/chromeos/status/caps_lock_menu_button_browsertest.cc5
-rw-r--r--chrome/browser/chromeos/status/clock_menu_button.cc50
-rw-r--r--chrome/browser/chromeos/status/clock_menu_button.h23
-rw-r--r--chrome/browser/chromeos/status/clock_menu_button_browsertest.cc5
-rw-r--r--chrome/browser/chromeos/status/input_method_menu.cc24
-rw-r--r--chrome/browser/chromeos/status/input_method_menu.h8
-rw-r--r--chrome/browser/chromeos/status/input_method_menu_button.cc34
-rw-r--r--chrome/browser/chromeos/status/input_method_menu_button.h8
-rw-r--r--chrome/browser/chromeos/status/input_method_menu_button_browsertest.cc5
-rw-r--r--chrome/browser/chromeos/status/memory_menu_button.cc7
-rw-r--r--chrome/browser/chromeos/status/memory_menu_button.h4
-rw-r--r--chrome/browser/chromeos/status/network_dropdown_button.cc1
-rw-r--r--chrome/browser/chromeos/status/network_menu_button.cc20
-rw-r--r--chrome/browser/chromeos/status/network_menu_button.h6
-rw-r--r--chrome/browser/chromeos/status/power_menu_button.cc6
-rw-r--r--chrome/browser/chromeos/status/power_menu_button.h2
-rw-r--r--chrome/browser/chromeos/status/power_menu_button_browsertest.cc6
-rw-r--r--chrome/browser/chromeos/status/status_area_button.cc59
-rw-r--r--chrome/browser/chromeos/status/status_area_button.h66
-rw-r--r--chrome/browser/chromeos/status/status_area_host.h72
-rw-r--r--chrome/browser/chromeos/status/status_area_view.cc73
-rw-r--r--chrome/browser/chromeos/status/status_area_view.h49
-rw-r--r--chrome/browser/chromeos/status/status_area_view_chromeos.cc84
-rw-r--r--chrome/browser/chromeos/status/status_area_view_chromeos.h64
-rw-r--r--chrome/browser/chromeos/view_ids.h8
-rw-r--r--chrome/chrome_browser.gypi7
42 files changed, 506 insertions, 493 deletions
diff --git a/chrome/browser/chromeos/frame/browser_view.cc b/chrome/browser/chromeos/frame/browser_view.cc
index d7bcc0d..d243513 100644
--- a/chrome/browser/chromeos/frame/browser_view.cc
+++ b/chrome/browser/chromeos/frame/browser_view.cc
@@ -16,7 +16,7 @@
#include "chrome/browser/chromeos/status/input_method_menu_button.h"
#include "chrome/browser/chromeos/status/network_menu_button.h"
#include "chrome/browser/chromeos/status/status_area_button.h"
-#include "chrome/browser/chromeos/status/status_area_view.h"
+#include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
#include "chrome/browser/chromeos/system/runtime_environment.h"
#include "chrome/browser/chromeos/view_ids.h"
#include "chrome/browser/themes/theme_service.h"
@@ -142,7 +142,7 @@ class BrowserViewLayout : public ::BrowserViewLayout {
::BrowserViewLayout::ViewAdded(host, view);
switch (view->id()) {
case VIEW_ID_STATUS_AREA:
- status_area_ = static_cast<chromeos::StatusAreaView*>(view);
+ status_area_ = static_cast<chromeos::StatusAreaViewChromeos*>(view);
break;
case VIEW_ID_LAYOUT_MODE_BUTTON:
layout_mode_button_ = static_cast<chromeos::LayoutModeButton*>(view);
@@ -280,7 +280,7 @@ class BrowserViewLayout : public ::BrowserViewLayout {
}
}
- chromeos::StatusAreaView* status_area_;
+ chromeos::StatusAreaViewChromeos* status_area_;
chromeos::LayoutModeButton* layout_mode_button_;
// Most-recently-set bounds for the _CHROME_STATUS_BOUNDS property.
@@ -324,10 +324,10 @@ BrowserView::~BrowserView() {
void BrowserView::Init() {
::BrowserView::Init();
- status_area_ = new StatusAreaView(this);
+ status_area_ = new StatusAreaViewChromeos();
+ status_area_->Init(this, StatusAreaViewChromeos::BROWSER_MODE);
status_area_->set_id(VIEW_ID_STATUS_AREA);
AddChildView(status_area_);
- status_area_->Init();
layout_mode_button_ = new LayoutModeButton();
layout_mode_button_->set_id(VIEW_ID_LAYOUT_MODE_BUTTON);
@@ -496,55 +496,51 @@ void BrowserView::OnBrowserRemoved(const Browser* browser) {
Layout();
}
-// BrowserView, StatusAreaHost implementation.
+// StatusAreaButton::Delegate overrides.
-Profile* BrowserView::GetProfile() const {
- return browser()->profile();
-}
-
-gfx::NativeWindow BrowserView::GetNativeWindow() const {
- return GetWidget()->GetNativeWindow();
-}
-
-bool BrowserView::ShouldOpenButtonOptions(
- const views::View* button_view) const {
+bool BrowserView::ShouldExecuteStatusAreaCommand(
+ const views::View* button_view, int command_id) const {
return true;
}
-void BrowserView::ExecuteBrowserCommand(int id) const {
- browser()->ExecuteCommand(id);
-}
-
-void BrowserView::OpenButtonOptions(const views::View* button_view) {
- if (button_view == status_area_->network_view()) {
- browser()->OpenInternetOptionsDialog();
- } else if (button_view == status_area_->input_method_view()) {
- browser()->OpenLanguageOptionsDialog();
- } else {
- browser()->OpenSystemOptionsDialog();
+void BrowserView::ExecuteStatusAreaCommand(
+ const views::View* button_view, int command_id) {
+ switch (command_id) {
+ case StatusAreaViewChromeos::SHOW_NETWORK_OPTIONS:
+ browser()->OpenInternetOptionsDialog();
+ break;
+ case StatusAreaViewChromeos::SHOW_LANGUAGE_OPTIONS:
+ browser()->OpenLanguageOptionsDialog();
+ break;
+ case StatusAreaViewChromeos::SHOW_SYSTEM_OPTIONS:
+ browser()->OpenLanguageOptionsDialog();
+ break;
+ default:
+ NOTREACHED();
}
}
-StatusAreaHost::ScreenMode BrowserView::GetScreenMode() const {
- return kBrowserMode;
+gfx::Font BrowserView::GetStatusAreaFont(const gfx::Font& font) const {
+ return font.DeriveFont(0, gfx::Font::BOLD);
}
-StatusAreaHost::TextStyle BrowserView::GetTextStyle() const {
+StatusAreaButton::TextStyle BrowserView::GetStatusAreaTextStyle() const {
ThemeService* theme_service =
- ThemeServiceFactory::GetForProfile(GetProfile());
+ ThemeServiceFactory::GetForProfile(browser()->profile());
if (!theme_service->UsingDefaultTheme())
- return StatusAreaHost::kWhiteHaloed;
+ return StatusAreaButton::WHITE_HALOED;
return IsOffTheRecord() ?
- StatusAreaHost::kWhitePlain : StatusAreaHost::kGrayEmbossed;
+ StatusAreaButton::WHITE_PLAIN : StatusAreaButton::GRAY_EMBOSSED;
}
void BrowserView::ButtonVisibilityChanged(views::View* button_view) {
- status_area_->ButtonVisibilityChanged(button_view);
+ status_area_->UpdateButtonVisibility();
}
// BrowserView, MessageLoopForUI::Observer implementation.
+
#if defined(TOUCH_UI) || defined(USE_AURA)
base::EventStatus BrowserView::WillProcessEvent(
const base::NativeEvent& event) OVERRIDE {
diff --git a/chrome/browser/chromeos/frame/browser_view.h b/chrome/browser/chromeos/frame/browser_view.h
index 14bc6094..d09e411 100644
--- a/chrome/browser/chromeos/frame/browser_view.h
+++ b/chrome/browser/chromeos/frame/browser_view.h
@@ -10,7 +10,7 @@
#include "base/compiler_specific.h"
#include "base/message_loop.h"
-#include "chrome/browser/chromeos/status/status_area_host.h"
+#include "chrome/browser/chromeos/status/status_area_button.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "views/context_menu_controller.h"
@@ -18,6 +18,7 @@
class AccessibleToolbarView;
class Profile;
+class StatusAreaButton;
class TabStripModel;
namespace ui {
@@ -35,8 +36,7 @@ class MenuRunner;
namespace chromeos {
class LayoutModeButton;
-class StatusAreaView;
-class StatusAreaButton;
+class StatusAreaViewChromeos;
// chromeos::BrowserView adds ChromeOS specific controls and menus to a
// BrowserView created with Browser::TYPE_TABBED. This extender adds controls
@@ -49,7 +49,7 @@ class BrowserView : public ::BrowserView,
public views::ContextMenuController,
public views::MenuListener,
public BrowserList::Observer,
- public StatusAreaHost,
+ public StatusAreaButton::Delegate,
public MessageLoopForUI::Observer {
public:
explicit BrowserView(Browser* browser);
@@ -83,15 +83,13 @@ class BrowserView : public ::BrowserView,
virtual void OnBrowserAdded(const Browser* browser) OVERRIDE;
virtual void OnBrowserRemoved(const Browser* browser) OVERRIDE;
- // StatusAreaHost overrides.
- virtual Profile* GetProfile() const OVERRIDE;
- virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE;
- virtual bool ShouldOpenButtonOptions(
- const views::View* button_view) const OVERRIDE;
- virtual void ExecuteBrowserCommand(int id) const OVERRIDE;
- virtual void OpenButtonOptions(const views::View* button_view) OVERRIDE;
- virtual ScreenMode GetScreenMode() const OVERRIDE;
- virtual TextStyle GetTextStyle() const OVERRIDE;
+ // StatusAreaButton::Delegate overrides.
+ virtual bool ShouldExecuteStatusAreaCommand(
+ const views::View* button_view, int command_id) const OVERRIDE;
+ virtual void ExecuteStatusAreaCommand(
+ const views::View* button_view, int command_id) OVERRIDE;
+ virtual gfx::Font GetStatusAreaFont(const gfx::Font& font) const OVERRIDE;
+ virtual StatusAreaButton::TextStyle GetStatusAreaTextStyle() const OVERRIDE;
virtual void ButtonVisibilityChanged(views::View* button_view) OVERRIDE;
// MessageLoopForUI::Observer overrides.
@@ -136,7 +134,7 @@ class BrowserView : public ::BrowserView,
// onscreen until Layout() is called.
void UpdateLayoutModeButtonVisibility();
- StatusAreaView* status_area_;
+ StatusAreaViewChromeos* status_area_;
LayoutModeButton* layout_mode_button_;
// System menu.
diff --git a/chrome/browser/chromeos/login/background_view.cc b/chrome/browser/chromeos/login/background_view.cc
index e07b659..1dba5c5 100644
--- a/chrome/browser/chromeos/login/background_view.cc
+++ b/chrome/browser/chromeos/login/background_view.cc
@@ -18,10 +18,6 @@
#include "chrome/browser/chromeos/login/rounded_rect_painter.h"
#include "chrome/browser/chromeos/login/shutdown_button.h"
#include "chrome/browser/chromeos/login/wizard_controller.h"
-#include "chrome/browser/chromeos/status/clock_menu_button.h"
-#include "chrome/browser/chromeos/status/input_method_menu_button.h"
-#include "chrome/browser/chromeos/status/network_menu_button.h"
-#include "chrome/browser/chromeos/status/status_area_view.h"
#include "chrome/browser/policy/browser_policy_connector.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/views/dom_view.h"
@@ -81,6 +77,7 @@ namespace chromeos {
BackgroundView::BackgroundView()
: status_area_(NULL),
+ screen_mode_(StatusAreaViewChromeos::LOGIN_MODE_VIEWS),
os_version_label_(NULL),
boot_times_label_(NULL),
progress_bar_(NULL),
@@ -216,7 +213,7 @@ bool BackgroundView::ScreenSaverEnabled() {
void BackgroundView::SetDefaultUse24HourClock(bool use_24hour_clock) {
DCHECK(status_area_);
- status_area_->clock_view()->SetDefaultUse24HourClock(use_24hour_clock);
+ status_area_->SetDefaultUse24HourClock(use_24hour_clock);
}
///////////////////////////////////////////////////////////////////////////////
@@ -271,24 +268,18 @@ void BackgroundView::ChildPreferredSizeChanged(View* child) {
SchedulePaint();
}
-Profile* BackgroundView::GetProfile() const {
- return NULL;
-}
+// Overridden from StatusAreaButton::Delegate:
-bool BackgroundView::ShouldOpenButtonOptions(
- const views::View* button_view) const {
- if (button_view == status_area_->network_view()) {
+bool BackgroundView::ShouldExecuteStatusAreaCommand(
+ const views::View* button_view, int command_id) const {
+ if (command_id == StatusAreaViewChromeos::SHOW_NETWORK_OPTIONS)
return true;
- }
- if (button_view == status_area_->clock_view() ||
- button_view == status_area_->input_method_view()) {
- return false;
- }
- return true;
+ return false;
}
-void BackgroundView::OpenButtonOptions(const views::View* button_view) {
- if (button_view == status_area_->network_view()) {
+void BackgroundView::ExecuteStatusAreaCommand(
+ const views::View* button_view, int command_id) {
+ if (command_id == StatusAreaViewChromeos::SHOW_NETWORK_OPTIONS) {
if (proxy_settings_dialog_.get() == NULL) {
proxy_settings_dialog_.reset(new ProxySettingsDialog(
this, GetNativeWindow()));
@@ -297,19 +288,20 @@ void BackgroundView::OpenButtonOptions(const views::View* button_view) {
}
}
-StatusAreaHost::ScreenMode BackgroundView::GetScreenMode() const {
- return kViewsLoginMode;
+gfx::Font BackgroundView::GetStatusAreaFont(const gfx::Font& font) const {
+ return font.DeriveFont(0, gfx::Font::BOLD);
}
-StatusAreaHost::TextStyle BackgroundView::GetTextStyle() const {
- return kGrayPlain;
+StatusAreaButton::TextStyle BackgroundView::GetStatusAreaTextStyle() const {
+ return StatusAreaButton::GRAY_PLAIN;
}
void BackgroundView::ButtonVisibilityChanged(views::View* button_view) {
- status_area_->ButtonVisibilityChanged(button_view);
+ status_area_->UpdateButtonVisibility();
}
// Overridden from LoginHtmlDialog::Delegate:
+
void BackgroundView::OnLocaleChanged() {
// Proxy settings dialog contains localized strings.
proxy_settings_dialog_.reset();
@@ -332,8 +324,8 @@ void BackgroundView::OnBootTimesLabelTextUpdated(
void BackgroundView::InitStatusArea() {
DCHECK(status_area_ == NULL);
- status_area_ = new StatusAreaView(this);
- status_area_->Init();
+ status_area_ = new StatusAreaViewChromeos();
+ status_area_->Init(this, screen_mode_);
AddChildView(status_area_);
}
diff --git a/chrome/browser/chromeos/login/background_view.h b/chrome/browser/chromeos/login/background_view.h
index 53d8a0e..db59247 100644
--- a/chrome/browser/chromeos/login/background_view.h
+++ b/chrome/browser/chromeos/login/background_view.h
@@ -7,8 +7,9 @@
#pragma once
#include "chrome/browser/chromeos/login/login_html_dialog.h"
-#include "chrome/browser/chromeos/status/status_area_host.h"
#include "chrome/browser/chromeos/login/version_info_updater.h"
+#include "chrome/browser/chromeos/status/status_area_button.h"
+#include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
#include "views/view.h"
namespace views {
@@ -26,12 +27,11 @@ namespace chromeos {
class OobeProgressBar;
class ShutdownButton;
-class StatusAreaView;
// View used to render the background during login. BackgroundView contains
// StatusAreaView.
class BackgroundView : public views::View,
- public StatusAreaHost,
+ public StatusAreaButton::Delegate,
public LoginHtmlDialog::Delegate,
public VersionInfoUpdater::Delegate {
public:
@@ -68,8 +68,8 @@ class BackgroundView : public views::View,
// Create a modal popup view.
void CreateModalPopup(views::WidgetDelegate* view);
- // Overridden from StatusAreaHost:
- virtual gfx::NativeWindow GetNativeWindow() const;
+ // Gets the native window from the view widget.
+ gfx::NativeWindow GetNativeWindow() const;
// Toggles status area visibility.
void SetStatusAreaVisible(bool visible);
@@ -109,14 +109,13 @@ class BackgroundView : public views::View,
virtual void ChildPreferredSizeChanged(View* child) OVERRIDE;
virtual void OnLocaleChanged() OVERRIDE;
- // Overridden from StatusAreaHost:
- virtual Profile* GetProfile() const OVERRIDE;
- virtual void ExecuteBrowserCommand(int id) const OVERRIDE {}
- virtual bool ShouldOpenButtonOptions(
- const views::View* button_view) const OVERRIDE;
- virtual void OpenButtonOptions(const views::View* button_view) OVERRIDE;
- virtual ScreenMode GetScreenMode() const OVERRIDE;
- virtual TextStyle GetTextStyle() const OVERRIDE;
+ // Overridden from StatusAreaButton::Delegate:
+ virtual bool ShouldExecuteStatusAreaCommand(
+ const views::View* button_view, int command_id) const OVERRIDE;
+ virtual void ExecuteStatusAreaCommand(
+ const views::View* button_view, int command_id) OVERRIDE;
+ virtual gfx::Font GetStatusAreaFont(const gfx::Font& font) const OVERRIDE;
+ virtual StatusAreaButton::TextStyle GetStatusAreaTextStyle() const OVERRIDE;
virtual void ButtonVisibilityChanged(views::View* button_view) OVERRIDE;
// Overridden from LoginHtmlDialog::Delegate:
@@ -128,6 +127,10 @@ class BackgroundView : public views::View,
virtual void OnBootTimesLabelTextUpdated(
const std::string& boot_times_label_text) OVERRIDE;
+ void set_screen_mode(StatusAreaViewChromeos::ScreenMode mode) {
+ screen_mode_ = mode;
+ }
+
private:
// Creates and adds the status_area.
void InitStatusArea();
@@ -141,7 +144,8 @@ class BackgroundView : public views::View,
void UpdateWindowType();
// All of these variables could be NULL.
- StatusAreaView* status_area_;
+ StatusAreaViewChromeos* status_area_;
+ StatusAreaViewChromeos::ScreenMode screen_mode_;
views::Label* os_version_label_;
views::Label* boot_times_label_;
OobeProgressBar* progress_bar_;
diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc
index 84630bf..37b1ae2 100644
--- a/chrome/browser/chromeos/login/existing_user_controller.cc
+++ b/chrome/browser/chromeos/login/existing_user_controller.cc
@@ -26,7 +26,6 @@
#include "chrome/browser/chromeos/login/views_login_display.h"
#include "chrome/browser/chromeos/login/wizard_accessibility_helper.h"
#include "chrome/browser/chromeos/login/wizard_controller.h"
-#include "chrome/browser/chromeos/status/status_area_view.h"
#include "chrome/browser/chromeos/user_cros_settings_provider.h"
#include "chrome/browser/google/google_util.h"
#include "chrome/browser/prefs/pref_service.h"
diff --git a/chrome/browser/chromeos/login/keyboard_switch_menu.cc b/chrome/browser/chromeos/login/keyboard_switch_menu.cc
index 8f0a98a..c0cce6d 100644
--- a/chrome/browser/chromeos/login/keyboard_switch_menu.cc
+++ b/chrome/browser/chromeos/login/keyboard_switch_menu.cc
@@ -8,7 +8,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/chromeos/input_method/input_method_manager.h"
#include "chrome/browser/chromeos/input_method/input_method_util.h"
-#include "chrome/browser/chromeos/status/status_area_host.h"
+#include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "views/controls/button/menu_button.h"
@@ -18,7 +18,7 @@ namespace chromeos {
KeyboardSwitchMenu::KeyboardSwitchMenu()
: InputMethodMenu(NULL /* pref_service */,
- StatusAreaHost::kViewsLoginMode,
+ StatusAreaViewChromeos::LOGIN_MODE_VIEWS,
true /* for_out_of_box_experience_dialog */) {
}
diff --git a/chrome/browser/chromeos/login/keyboard_switch_menu.h b/chrome/browser/chromeos/login/keyboard_switch_menu.h
index 1a78846..b972bbd 100644
--- a/chrome/browser/chromeos/login/keyboard_switch_menu.h
+++ b/chrome/browser/chromeos/login/keyboard_switch_menu.h
@@ -10,7 +10,6 @@
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/chromeos/status/input_method_menu.h"
-#include "chrome/browser/chromeos/status/status_area_host.h"
namespace chromeos {
diff --git a/chrome/browser/chromeos/login/screen_locker_views.cc b/chrome/browser/chromeos/login/screen_locker_views.cc
index d0606f5..cf960a1 100644
--- a/chrome/browser/chromeos/login/screen_locker_views.cc
+++ b/chrome/browser/chromeos/login/screen_locker_views.cc
@@ -21,6 +21,7 @@
#include "chrome/browser/chromeos/login/screen_lock_view.h"
#include "chrome/browser/chromeos/login/screen_locker.h"
#include "chrome/browser/chromeos/login/shutdown_button.h"
+#include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
#include "chrome/browser/chromeos/view_ids.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/chrome_switches.h"
@@ -388,10 +389,7 @@ class ScreenLockerBackgroundView
views::View* screen_lock_view)
: lock_widget_(lock_widget),
screen_lock_view_(screen_lock_view) {
- }
-
- virtual ScreenMode GetScreenMode() const OVERRIDE {
- return kScreenLockerMode;
+ set_screen_mode(chromeos::StatusAreaViewChromeos::SCREEN_LOCKER_MODE);
}
virtual void Layout() OVERRIDE {
diff --git a/chrome/browser/chromeos/login/webui_login_view.cc b/chrome/browser/chromeos/login/webui_login_view.cc
index 36020ec..d8d1c98 100644
--- a/chrome/browser/chromeos/login/webui_login_view.cc
+++ b/chrome/browser/chromeos/login/webui_login_view.cc
@@ -15,10 +15,7 @@
#include "chrome/browser/chromeos/dbus/session_manager_client.h"
#include "chrome/browser/chromeos/login/proxy_settings_dialog.h"
#include "chrome/browser/chromeos/login/webui_login_display.h"
-#include "chrome/browser/chromeos/status/clock_menu_button.h"
-#include "chrome/browser/chromeos/status/input_method_menu_button.h"
-#include "chrome/browser/chromeos/status/network_menu_button.h"
-#include "chrome/browser/chromeos/status/status_area_view.h"
+#include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/views/dom_view.h"
#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
@@ -233,27 +230,18 @@ void WebUILoginView::ChildPreferredSizeChanged(View* child) {
SchedulePaint();
}
-Profile* WebUILoginView::GetProfile() const {
- return NULL;
-}
-
-void WebUILoginView::ExecuteBrowserCommand(int id) const {
-}
+// Overridden from StatusAreaButton::Delegate:
-bool WebUILoginView::ShouldOpenButtonOptions(
- const views::View* button_view) const {
- if (button_view == status_area_->network_view())
+bool WebUILoginView::ShouldExecuteStatusAreaCommand(
+ const views::View* button_view, int command_id) const {
+ if (command_id == StatusAreaViewChromeos::SHOW_NETWORK_OPTIONS)
return true;
-
- if (button_view == status_area_->clock_view() ||
- button_view == status_area_->input_method_view())
- return false;
-
- return true;
+ return false;
}
-void WebUILoginView::OpenButtonOptions(const views::View* button_view) {
- if (button_view == status_area_->network_view()) {
+void WebUILoginView::ExecuteStatusAreaCommand(
+ const views::View* button_view, int command_id) {
+ if (command_id == StatusAreaViewChromeos::SHOW_NETWORK_OPTIONS) {
if (proxy_settings_dialog_.get() == NULL) {
proxy_settings_dialog_.reset(new ProxySettingsDialog(
this, GetNativeWindow()));
@@ -262,18 +250,20 @@ void WebUILoginView::OpenButtonOptions(const views::View* button_view) {
}
}
-StatusAreaHost::ScreenMode WebUILoginView::GetScreenMode() const {
- return kWebUILoginMode;
+gfx::Font WebUILoginView::GetStatusAreaFont(const gfx::Font& font) const {
+ return font;
}
-StatusAreaHost::TextStyle WebUILoginView::GetTextStyle() const {
- return kGrayPlain;
+StatusAreaButton::TextStyle WebUILoginView::GetStatusAreaTextStyle() const {
+ return StatusAreaButton::GRAY_PLAIN;
}
void WebUILoginView::ButtonVisibilityChanged(views::View* button_view) {
- status_area_->ButtonVisibilityChanged(button_view);
+ status_area_->UpdateButtonVisibility();
}
+// Overridden from LoginHtmlDialog::Delegate:
+
void WebUILoginView::OnDialogClosed() {
}
@@ -334,8 +324,8 @@ void WebUILoginView::OnTabMainFrameFirstRender() {
void WebUILoginView::InitStatusArea() {
DCHECK(status_area_ == NULL);
DCHECK(status_window_ == NULL);
- status_area_ = new StatusAreaView(this);
- status_area_->Init();
+ status_area_ = new StatusAreaViewChromeos();
+ status_area_->Init(this, StatusAreaViewChromeos::LOGIN_MODE_WEBUI);
status_area_->SetVisible(status_area_visibility_on_init_);
// Width of |status_window| is meant to be large enough.
diff --git a/chrome/browser/chromeos/login/webui_login_view.h b/chrome/browser/chromeos/login/webui_login_view.h
index d822f0b..a5f5ce5 100644
--- a/chrome/browser/chromeos/login/webui_login_view.h
+++ b/chrome/browser/chromeos/login/webui_login_view.h
@@ -7,7 +7,7 @@
#pragma once
#include "chrome/browser/chromeos/login/login_html_dialog.h"
-#include "chrome/browser/chromeos/status/status_area_host.h"
+#include "chrome/browser/chromeos/status/status_area_button.h"
#include "chrome/browser/tab_first_render_watcher.h"
#include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h"
#include "content/browser/tab_contents/tab_contents_delegate.h"
@@ -25,15 +25,15 @@ class Widget;
namespace chromeos {
-class StatusAreaView;
+class StatusAreaViewChromeos;
// View used to render a WebUI supporting Widget. This widget is used for the
// WebUI based start up and lock screens. It contains a StatusAreaView and
// DOMView.
class WebUILoginView : public views::WidgetDelegateView,
- public StatusAreaHost,
+ public StatusAreaButton::Delegate,
public TabContentsDelegate,
- public chromeos::LoginHtmlDialog::Delegate,
+ public LoginHtmlDialog::Delegate,
public TabFirstRenderWatcher::Delegate {
public:
static const int kStatusAreaCornerPadding;
@@ -49,12 +49,12 @@ class WebUILoginView : public views::WidgetDelegateView,
const views::Accelerator& accelerator) OVERRIDE;
virtual std::string GetClassName() const OVERRIDE;
- // Overridden from StatusAreaHost:
- virtual gfx::NativeWindow GetNativeWindow() const;
-
// Called when WebUI window is created.
virtual void OnWindowCreated();
+ // Gets the native window from the view widget.
+ gfx::NativeWindow GetNativeWindow() const;
+
// Invokes SetWindowType for the window. This is invoked during startup and
// after we've painted.
void UpdateWindowType();
@@ -76,14 +76,13 @@ class WebUILoginView : public views::WidgetDelegateView,
virtual void Layout() OVERRIDE;
virtual void ChildPreferredSizeChanged(View* child) OVERRIDE;
- // Overridden from StatusAreaHost:
- virtual Profile* GetProfile() const OVERRIDE;
- virtual void ExecuteBrowserCommand(int id) const OVERRIDE;
- virtual bool ShouldOpenButtonOptions(
- const views::View* button_view) const OVERRIDE;
- virtual void OpenButtonOptions(const views::View* button_view) OVERRIDE;
- virtual ScreenMode GetScreenMode() const OVERRIDE;
- virtual TextStyle GetTextStyle() const OVERRIDE;
+ // Overridden from StatusAreaButton::Delegate:
+ virtual bool ShouldExecuteStatusAreaCommand(
+ const views::View* button_view, int command_id) const OVERRIDE;
+ virtual void ExecuteStatusAreaCommand(
+ const views::View* button_view, int command_id) OVERRIDE;
+ virtual gfx::Font GetStatusAreaFont(const gfx::Font& font) const OVERRIDE;
+ virtual StatusAreaButton::TextStyle GetStatusAreaTextStyle() const OVERRIDE;
virtual void ButtonVisibilityChanged(views::View* button_view) OVERRIDE;
// Overridden from LoginHtmlDialog::Delegate:
@@ -98,7 +97,7 @@ class WebUILoginView : public views::WidgetDelegateView,
// Creates and adds the status area (separate window).
virtual void InitStatusArea();
- StatusAreaView* status_area_;
+ StatusAreaViewChromeos* status_area_;
// DOMView for rendering a webpage as a webui login.
DOMView* webui_login_;
diff --git a/chrome/browser/chromeos/status/OWNERS b/chrome/browser/chromeos/status/OWNERS
new file mode 100644
index 0000000..afc4fb4
--- /dev/null
+++ b/chrome/browser/chromeos/status/OWNERS
@@ -0,0 +1,3 @@
+set noparent
+davemoore@chromium.org
+stevenjb@chromium.org
diff --git a/chrome/browser/chromeos/status/accessibility_menu_button.cc b/chrome/browser/chromeos/status/accessibility_menu_button.cc
index 1e94967..f8f59d7 100644
--- a/chrome/browser/chromeos/status/accessibility_menu_button.cc
+++ b/chrome/browser/chromeos/status/accessibility_menu_button.cc
@@ -8,6 +8,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/accessibility_util.h"
#include "chrome/browser/chromeos/status/status_area_bubble.h"
+#include "chrome/browser/chromeos/view_ids.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/pref_names.h"
@@ -35,8 +36,12 @@ namespace chromeos {
////////////////////////////////////////////////////////////////////////////////
// AccessibilityMenuButton
-AccessibilityMenuButton::AccessibilityMenuButton(StatusAreaHost* host)
- : StatusAreaButton(host, this) {
+AccessibilityMenuButton::AccessibilityMenuButton(
+ StatusAreaButton::Delegate* delegate,
+ StatusAreaViewChromeos::ScreenMode screen_mode)
+ : StatusAreaButton(delegate, this),
+ screen_mode_(screen_mode) {
+ set_id(VIEW_ID_STATUS_BUTTON_ACCESSIBILITY);
accessibility_enabled_.Init(prefs::kAccessibilityEnabled,
g_browser_process->local_state(), this);
SetIcon(*ResourceBundle::GetSharedInstance().GetBitmapNamed(
@@ -90,7 +95,7 @@ void AccessibilityMenuButton::Observe(
// Show a bubble when accessibility is turned on at the login screen.
if (path == prefs::kAccessibilityEnabled) {
if (accessibility_enabled_.GetValue() &&
- host_->GetScreenMode() == StatusAreaHost::kWebUILoginMode) {
+ screen_mode_ == StatusAreaViewChromeos::LOGIN_MODE_WEBUI) {
views::ImageView* icon_view = new views::ImageView;
const gfx::Image& image = ResourceBundle::GetSharedInstance().
GetImageNamed(IDR_ACCESSIBILITY_ICON);
diff --git a/chrome/browser/chromeos/status/accessibility_menu_button.h b/chrome/browser/chromeos/status/accessibility_menu_button.h
index e70b7c0..4b7a4f7 100644
--- a/chrome/browser/chromeos/status/accessibility_menu_button.h
+++ b/chrome/browser/chromeos/status/accessibility_menu_button.h
@@ -7,6 +7,7 @@
#pragma once
#include "chrome/browser/chromeos/status/status_area_button.h"
+#include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
#include "chrome/browser/prefs/pref_member.h"
#include "content/public/browser/notification_observer.h"
#include "views/controls/menu/view_menu_delegate.h"
@@ -18,7 +19,6 @@ class MenuRunner;
namespace chromeos {
-class StatusAreaHost;
class StatusAreaBubbleController;
// A class for the button in the status area which alerts the user when
@@ -28,7 +28,9 @@ class AccessibilityMenuButton : public StatusAreaButton,
public views::MenuDelegate,
public content::NotificationObserver {
public:
- explicit AccessibilityMenuButton(StatusAreaHost* host);
+ explicit AccessibilityMenuButton(
+ StatusAreaButton::Delegate* delegate,
+ StatusAreaViewChromeos::ScreenMode screen_mode);
virtual ~AccessibilityMenuButton();
// views::ViewMenuDelegate implementation
@@ -49,6 +51,8 @@ class AccessibilityMenuButton : public StatusAreaButton,
// Prepares menu before showing it.
void PrepareMenu();
+ StatusAreaViewChromeos::ScreenMode screen_mode_;
+
// An object synced to the preference, representing if accessibility feature
// is enabled or not.
BooleanPrefMember accessibility_enabled_;
diff --git a/chrome/browser/chromeos/status/accessibility_menu_button_browsertest.cc b/chrome/browser/chromeos/status/accessibility_menu_button_browsertest.cc
index a3e7150..8de4051 100644
--- a/chrome/browser/chromeos/status/accessibility_menu_button_browsertest.cc
+++ b/chrome/browser/chromeos/status/accessibility_menu_button_browsertest.cc
@@ -6,7 +6,6 @@
#include "chrome/browser/chromeos/accessibility_util.h"
#include "chrome/browser/chromeos/frame/browser_view.h"
-#include "chrome/browser/chromeos/status/status_area_view.h"
#include "chrome/browser/chromeos/view_ids.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/browser/ui/browser.h"
@@ -21,8 +20,8 @@ class AccessibilityMenuButtonTest : public InProcessBrowserTest {
AccessibilityMenuButton* GetAccessibilityMenuButton() {
BrowserView* view = static_cast<BrowserView*>(browser()->window());
- return static_cast<StatusAreaView*>(view->
- GetViewByID(VIEW_ID_STATUS_AREA))->accessibility_view();
+ return static_cast<AccessibilityMenuButton*>(view->GetViewByID(
+ VIEW_ID_STATUS_BUTTON_ACCESSIBILITY));
}
};
diff --git a/chrome/browser/chromeos/status/caps_lock_menu_button.cc b/chrome/browser/chromeos/status/caps_lock_menu_button.cc
index 9d5e176..5ac4351 100644
--- a/chrome/browser/chromeos/status/caps_lock_menu_button.cc
+++ b/chrome/browser/chromeos/status/caps_lock_menu_button.cc
@@ -10,8 +10,9 @@
#include "chrome/browser/chromeos/input_method/xkeyboard.h"
#include "chrome/browser/chromeos/status/status_area_bubble.h"
#include "chrome/browser/chromeos/system/runtime_environment.h"
+#include "chrome/browser/chromeos/view_ids.h"
#include "chrome/browser/prefs/pref_service.h"
-#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/pref_names.h"
#include "grit/generated_resources.h"
@@ -29,10 +30,10 @@ namespace {
const size_t kMaxBubbleCount = 3;
-// Returns PrefService object associated with |host|.
-PrefService* GetPrefService(chromeos::StatusAreaHost* host) {
- if (host->GetProfile())
- return host->GetProfile()->GetPrefs();
+PrefService* GetPrefService() {
+ Profile* profile = ProfileManager::GetDefaultProfile();
+ if (profile)
+ return profile->GetPrefs();
return NULL;
}
@@ -51,12 +52,13 @@ namespace chromeos {
////////////////////////////////////////////////////////////////////////////////
// CapsLockMenuButton
-CapsLockMenuButton::CapsLockMenuButton(StatusAreaHost* host)
- : StatusAreaButton(host, this),
- prefs_(GetPrefService(host)),
+CapsLockMenuButton::CapsLockMenuButton(StatusAreaButton::Delegate* delegate)
+ : StatusAreaButton(delegate, this),
+ prefs_(GetPrefService()),
status_(NULL),
should_show_bubble_(true),
bubble_count_(0) {
+ set_id(VIEW_ID_STATUS_BUTTON_CAPS_LOCK);
if (prefs_)
remap_search_key_to_.Init(
prefs::kLanguageXkbRemapSearchKeyTo, prefs_, this);
diff --git a/chrome/browser/chromeos/status/caps_lock_menu_button.h b/chrome/browser/chromeos/status/caps_lock_menu_button.h
index 07b3ce9..1f2e243 100644
--- a/chrome/browser/chromeos/status/caps_lock_menu_button.h
+++ b/chrome/browser/chromeos/status/caps_lock_menu_button.h
@@ -24,7 +24,6 @@ class MenuRunner;
namespace chromeos {
-class StatusAreaHost;
class StatusAreaBubbleContentView;
class StatusAreaBubbleController;
@@ -36,7 +35,7 @@ class CapsLockMenuButton : public content::NotificationObserver,
public views::ViewMenuDelegate,
public SystemKeyEventListener::CapsLockObserver {
public:
- explicit CapsLockMenuButton(StatusAreaHost* host);
+ explicit CapsLockMenuButton(StatusAreaButton::Delegate* delegate);
virtual ~CapsLockMenuButton();
// views::View implementation.
diff --git a/chrome/browser/chromeos/status/caps_lock_menu_button_browsertest.cc b/chrome/browser/chromeos/status/caps_lock_menu_button_browsertest.cc
index 4d94e62..55345f1 100644
--- a/chrome/browser/chromeos/status/caps_lock_menu_button_browsertest.cc
+++ b/chrome/browser/chromeos/status/caps_lock_menu_button_browsertest.cc
@@ -7,7 +7,6 @@
#include "base/string_util.h"
#include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h"
#include "chrome/browser/chromeos/frame/browser_view.h"
-#include "chrome/browser/chromeos/status/status_area_view.h"
#include "chrome/browser/chromeos/view_ids.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
@@ -28,8 +27,8 @@ class CapsLockMenuButtonTest : public CrosInProcessBrowserTest {
CapsLockMenuButton* GetCapsLockMenuButton() {
BrowserView* view = static_cast<BrowserView*>(browser()->window());
- return static_cast<StatusAreaView*>(view->
- GetViewByID(VIEW_ID_STATUS_AREA))->caps_lock_view();
+ return static_cast<CapsLockMenuButton*>(view->GetViewByID(
+ VIEW_ID_STATUS_BUTTON_CAPS_LOCK));
}
};
diff --git a/chrome/browser/chromeos/status/clock_menu_button.cc b/chrome/browser/chromeos/status/clock_menu_button.cc
index deb3036..7c6b195 100644
--- a/chrome/browser/chromeos/status/clock_menu_button.cc
+++ b/chrome/browser/chromeos/status/clock_menu_button.cc
@@ -9,9 +9,10 @@
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
-#include "chrome/browser/chromeos/status/status_area_host.h"
+#include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
+#include "chrome/browser/chromeos/view_ids.h"
#include "chrome/browser/prefs/pref_service.h"
-#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/notification_details.h"
@@ -40,15 +41,14 @@ namespace chromeos {
// when the timer goes off.
const int kTimerSlopSeconds = 1;
-ClockMenuButton::ClockMenuButton(StatusAreaHost* host)
- : StatusAreaButton(host, this),
+ClockMenuButton::ClockMenuButton(StatusAreaButton::Delegate* delegate)
+ : StatusAreaButton(delegate, this),
default_use_24hour_clock_(false) {
- // Add as TimezoneSettings observer. We update the clock if timezone changes.
- system::TimezoneSettings::GetInstance()->AddObserver(this);
- CrosLibrary::Get()->GetPowerLibrary()->AddObserver(this);
+ set_id(VIEW_ID_STATUS_BUTTON_CLOCK);
// Start monitoring the kUse24HourClock preference.
- if (host->GetProfile()) { // This can be NULL in the login screen.
- registrar_.Init(host->GetProfile()->GetPrefs());
+ Profile* profile = ProfileManager::GetDefaultProfile();
+ if (profile) { // This can be NULL in the login screen.
+ registrar_.Init(profile->GetPrefs());
registrar_.Add(prefs::kUse24HourClock, this);
}
@@ -57,8 +57,6 @@ ClockMenuButton::ClockMenuButton(StatusAreaHost* host)
ClockMenuButton::~ClockMenuButton() {
timer_.Stop();
- CrosLibrary::Get()->GetPowerLibrary()->RemoveObserver(this);
- system::TimezoneSettings::GetInstance()->RemoveObserver(this);
}
void ClockMenuButton::UpdateTextAndSetNextTimer() {
@@ -87,10 +85,13 @@ void ClockMenuButton::UpdateTextAndSetNextTimer() {
void ClockMenuButton::UpdateText() {
base::Time time(base::Time::Now());
+ bool use_24hour_clock = default_use_24hour_clock_;
+#if defined(OS_CHROMEOS)
// If the profie is present, check the use 24-hour clock preference.
- const bool use_24hour_clock = host_->GetProfile() ?
- host_->GetProfile()->GetPrefs()->GetBoolean(prefs::kUse24HourClock) :
- default_use_24hour_clock_;
+ Profile* profile = ProfileManager::GetDefaultProfile();
+ if (profile)
+ use_24hour_clock = profile->GetPrefs()->GetBoolean(prefs::kUse24HourClock);
+#endif
SetText(base::TimeFormatTimeOfDayWithHourClockType(
time,
use_24hour_clock ? base::k24HourClock : base::k12HourClock,
@@ -134,19 +135,8 @@ bool ClockMenuButton::IsCommandEnabled(int id) const {
void ClockMenuButton::ExecuteCommand(int id) {
DCHECK_EQ(CLOCK_OPEN_OPTIONS_ITEM, id);
- host_->OpenButtonOptions(this);
-}
-
-// ClockMenuButton, PowerLibrary::Observer implementation:
-
-void ClockMenuButton::SystemResumed() {
- UpdateText();
-}
-
-// ClockMenuButton, SystemLibrary::Observer implementation:
-
-void ClockMenuButton::TimezoneChanged(const icu::TimeZone& timezone) {
- UpdateText();
+ delegate()->ExecuteStatusAreaCommand(
+ this, StatusAreaViewChromeos::SHOW_SYSTEM_OPTIONS);
}
int ClockMenuButton::horizontal_padding() {
@@ -188,9 +178,9 @@ void ClockMenuButton::EnsureMenu() {
// Text for this item will be set by GetLabel().
menu->AppendDelegateMenuItem(CLOCK_DISPLAY_ITEM);
- // If options dialog is unavailable, don't show a separator and configure
- // menu item.
- if (host_->ShouldOpenButtonOptions(this)) {
+ // If options UI is available, show a separator and configure menu item.
+ if (delegate()->ShouldExecuteStatusAreaCommand(
+ this, StatusAreaViewChromeos::SHOW_SYSTEM_OPTIONS)) {
menu->AppendSeparator();
const string16 clock_open_options_label =
diff --git a/chrome/browser/chromeos/status/clock_menu_button.h b/chrome/browser/chromeos/status/clock_menu_button.h
index ef2eba0..595d31f 100644
--- a/chrome/browser/chromeos/status/clock_menu_button.h
+++ b/chrome/browser/chromeos/status/clock_menu_button.h
@@ -8,9 +8,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/timer.h"
-#include "chrome/browser/chromeos/cros/power_library.h"
#include "chrome/browser/chromeos/status/status_area_button.h"
-#include "chrome/browser/chromeos/system/timezone_settings.h"
#include "chrome/browser/prefs/pref_change_registrar.h"
#include "chrome/browser/prefs/pref_member.h"
#include "content/public/browser/notification_observer.h"
@@ -26,18 +24,14 @@ class MenuRunner;
namespace chromeos {
-class StatusAreaHost;
-
// The clock menu button in the status area.
// This button shows the current time.
class ClockMenuButton : public StatusAreaButton,
public views::MenuDelegate,
public views::ViewMenuDelegate,
- public content::NotificationObserver,
- public PowerLibrary::Observer,
- public system::TimezoneSettings::Observer {
+ public content::NotificationObserver {
public:
- explicit ClockMenuButton(StatusAreaHost* host);
+ explicit ClockMenuButton(StatusAreaButton::Delegate* delegate);
virtual ~ClockMenuButton();
// views::MenuDelegate implementation
@@ -45,18 +39,10 @@ class ClockMenuButton : public StatusAreaButton,
virtual bool IsCommandEnabled(int id) const OVERRIDE;
virtual void ExecuteCommand(int id) OVERRIDE;
- // Overridden from ResumeLibrary::Observer:
- virtual void PowerChanged(const PowerSupplyStatus& status) {}
- virtual void SystemResumed();
-
- // Overridden from TimezoneSettings::Observer:
- virtual void TimezoneChanged(const icu::TimeZone& timezone);
-
// views::View
virtual void OnLocaleChanged() OVERRIDE;
- // Updates the time on the menu button. Can be called by host if timezone
- // changes.
+ // Updates the time on the menu button.
void UpdateText();
// Sets default use 24hour clock mode.
@@ -87,8 +73,7 @@ class ClockMenuButton : public StatusAreaButton,
PrefChangeRegistrar registrar_;
- // Default value for use_24hour_clock. Used when StatusAreaHost does not
- // have a profile, i.e. on login screen and lock screen.
+ // Default value for use_24hour_clock.
bool default_use_24hour_clock_;
DISALLOW_COPY_AND_ASSIGN(ClockMenuButton);
diff --git a/chrome/browser/chromeos/status/clock_menu_button_browsertest.cc b/chrome/browser/chromeos/status/clock_menu_button_browsertest.cc
index 105da7d..d17c348 100644
--- a/chrome/browser/chromeos/status/clock_menu_button_browsertest.cc
+++ b/chrome/browser/chromeos/status/clock_menu_button_browsertest.cc
@@ -7,7 +7,6 @@
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/frame/browser_view.h"
-#include "chrome/browser/chromeos/status/status_area_view.h"
#include "chrome/browser/chromeos/system/timezone_settings.h"
#include "chrome/browser/chromeos/view_ids.h"
#include "chrome/browser/prefs/pref_member.h"
@@ -30,8 +29,8 @@ class ClockMenuButtonTest : public InProcessBrowserTest {
}
ClockMenuButton* GetClockMenuButton() {
BrowserView* view = static_cast<BrowserView*>(browser()->window());
- return static_cast<StatusAreaView*>(view->
- GetViewByID(VIEW_ID_STATUS_AREA))->clock_view();
+ return static_cast<ClockMenuButton*>(view->GetViewByID(
+ VIEW_ID_STATUS_BUTTON_CLOCK));
}
};
diff --git a/chrome/browser/chromeos/status/input_method_menu.cc b/chrome/browser/chromeos/status/input_method_menu.cc
index 1eae137..a60305d 100644
--- a/chrome/browser/chromeos/status/input_method_menu.cc
+++ b/chrome/browser/chromeos/status/input_method_menu.cc
@@ -132,7 +132,7 @@ using input_method::InputMethodManager;
// InputMethodMenu
InputMethodMenu::InputMethodMenu(PrefService* pref_service,
- StatusAreaHost::ScreenMode screen_mode,
+ StatusAreaViewChromeos::ScreenMode screen_mode,
bool for_out_of_box_experience_dialog)
: input_method_descriptors_(InputMethodManager::GetInstance()->
GetActiveInputMethods()),
@@ -151,7 +151,7 @@ InputMethodMenu::InputMethodMenu(PrefService* pref_service,
!input_method_descriptors_->empty());
// Sync current and previous input methods on Chrome prefs with ibus-daemon.
- if (pref_service_ && (screen_mode_ == StatusAreaHost::kBrowserMode)) {
+ if (pref_service_ && (screen_mode_ == StatusAreaViewChromeos::BROWSER_MODE)) {
previous_input_method_pref_.Init(
prefs::kLanguagePreviousInputMethod, pref_service, this);
current_input_method_pref_.Init(
@@ -159,14 +159,14 @@ InputMethodMenu::InputMethodMenu(PrefService* pref_service,
}
InputMethodManager* manager = InputMethodManager::GetInstance();
- if (screen_mode_ == StatusAreaHost::kViewsLoginMode ||
- screen_mode_ == StatusAreaHost::kWebUILoginMode) {
+ if (screen_mode_ == StatusAreaViewChromeos::LOGIN_MODE_VIEWS ||
+ screen_mode_ == StatusAreaViewChromeos::LOGIN_MODE_WEBUI) {
// This button is for the login screen.
manager->AddPreLoginPreferenceObserver(this);
registrar_.Add(this,
chrome::NOTIFICATION_LOGIN_USER_CHANGED,
content::NotificationService::AllSources());
- } else if (screen_mode_ == StatusAreaHost::kBrowserMode) {
+ } else if (screen_mode_ == StatusAreaViewChromeos::BROWSER_MODE) {
manager->AddPostLoginPreferenceObserver(this);
}
@@ -421,15 +421,15 @@ void InputMethodMenu::PreferenceUpdateNeeded(
InputMethodManager* manager,
const input_method::InputMethodDescriptor& previous_input_method,
const input_method::InputMethodDescriptor& current_input_method) {
- if (screen_mode_ == StatusAreaHost::kBrowserMode) {
+ if (screen_mode_ == StatusAreaViewChromeos::BROWSER_MODE) {
if (pref_service_) { // make sure we're not in unit tests.
// Sometimes (e.g. initial boot) |previous_input_method.id()| is empty.
previous_input_method_pref_.SetValue(previous_input_method.id());
current_input_method_pref_.SetValue(current_input_method.id());
pref_service_->ScheduleSavePersistentPrefs();
}
- } else if (screen_mode_ == StatusAreaHost::kViewsLoginMode ||
- screen_mode_ == StatusAreaHost::kWebUILoginMode) {
+ } else if (screen_mode_ == StatusAreaViewChromeos::LOGIN_MODE_VIEWS ||
+ screen_mode_ == StatusAreaViewChromeos::LOGIN_MODE_WEBUI) {
if (g_browser_process && g_browser_process->local_state()) {
g_browser_process->local_state()->SetString(
language_prefs::kPreferredKeyboardLayout, current_input_method.id());
@@ -465,7 +465,7 @@ void InputMethodMenu::FirstObserverIsAdded(InputMethodManager* manager) {
// NOTICE: Since this function might be called from the constructor of this
// class, it's better to avoid calling virtual functions.
- if (pref_service_ && (screen_mode_ == StatusAreaHost::kBrowserMode)) {
+ if (pref_service_ && (screen_mode_ == StatusAreaViewChromeos::BROWSER_MODE)) {
// Get the input method name in the Preferences file which was in use last
// time, and switch to the method. We remember two input method names in the
// preference so that the Control+space hot-key could work fine from the
@@ -721,10 +721,10 @@ void InputMethodMenu::SetMinimumWidth(int width) {
void InputMethodMenu::RemoveObservers() {
InputMethodManager* manager = InputMethodManager::GetInstance();
- if (screen_mode_ == StatusAreaHost::kViewsLoginMode ||
- screen_mode_ == StatusAreaHost::kWebUILoginMode) {
+ if (screen_mode_ == StatusAreaViewChromeos::LOGIN_MODE_VIEWS ||
+ screen_mode_ == StatusAreaViewChromeos::LOGIN_MODE_WEBUI) {
manager->RemovePreLoginPreferenceObserver(this);
- } else if (screen_mode_ == StatusAreaHost::kBrowserMode) {
+ } else if (screen_mode_ == StatusAreaViewChromeos::BROWSER_MODE) {
manager->RemovePostLoginPreferenceObserver(this);
}
manager->RemoveObserver(this);
diff --git a/chrome/browser/chromeos/status/input_method_menu.h b/chrome/browser/chromeos/status/input_method_menu.h
index 6d712af..29657e2 100644
--- a/chrome/browser/chromeos/status/input_method_menu.h
+++ b/chrome/browser/chromeos/status/input_method_menu.h
@@ -9,7 +9,7 @@
#include <string>
#include "chrome/browser/chromeos/input_method/input_method_manager.h"
-#include "chrome/browser/chromeos/status/status_area_host.h"
+#include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
#include "chrome/browser/prefs/pref_member.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -35,7 +35,7 @@ namespace chromeos {
// A class for the dropdown menu for switching input method and keyboard layout.
// Since the class provides the views::ViewMenuDelegate interface, it's easy to
-// create a button widget (e.g. views::MenuButton, chromeos::StatusAreaButton)
+// create a button widget (e.g. views::MenuButton, StatusAreaButton)
// which shows the dropdown menu on click.
class InputMethodMenu
: public views::ViewMenuDelegate,
@@ -45,7 +45,7 @@ class InputMethodMenu
public content::NotificationObserver {
public:
InputMethodMenu(PrefService* pref_service,
- StatusAreaHost::ScreenMode screen_mode,
+ StatusAreaViewChromeos::ScreenMode screen_mode,
bool for_out_of_box_experience_dialog);
virtual ~InputMethodMenu();
@@ -193,7 +193,7 @@ class InputMethodMenu
content::NotificationRegistrar registrar_;
// The mode of the host screen (e.g. browser, screen locker, login screen.)
- const StatusAreaHost::ScreenMode screen_mode_;
+ const StatusAreaViewChromeos::ScreenMode screen_mode_;
// true if the menu is for a dialog in OOBE screen. In the dialog, we don't
// use radio buttons.
const bool for_out_of_box_experience_dialog_;
diff --git a/chrome/browser/chromeos/status/input_method_menu_button.cc b/chrome/browser/chromeos/status/input_method_menu_button.cc
index 1a12e02..fc643a4 100644
--- a/chrome/browser/chromeos/status/input_method_menu_button.cc
+++ b/chrome/browser/chromeos/status/input_method_menu_button.cc
@@ -9,9 +9,8 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/chromeos/input_method/input_method_manager.h"
#include "chrome/browser/chromeos/input_method/input_method_util.h"
-#include "chrome/browser/chromeos/status/status_area_host.h"
#include "chrome/browser/prefs/pref_service.h"
-#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
@@ -19,12 +18,10 @@
namespace {
-// Returns PrefService object associated with |host|. Returns NULL if we are NOT
-// within a browser.
-PrefService* GetPrefService(chromeos::StatusAreaHost* host) {
- if (host->GetProfile()) {
- return host->GetProfile()->GetPrefs();
- }
+PrefService* GetPrefService() {
+ Profile* profile = ProfileManager::GetDefaultProfile();
+ if (profile)
+ return profile->GetPrefs();
return NULL;
}
@@ -34,7 +31,7 @@ class MenuImpl : public chromeos::InputMethodMenu {
public:
MenuImpl(chromeos::InputMethodMenuButton* button,
PrefService* pref_service,
- chromeos::StatusAreaHost::ScreenMode screen_mode)
+ chromeos::StatusAreaViewChromeos::ScreenMode screen_mode)
: InputMethodMenu(pref_service, screen_mode, false), button_(button) {}
private:
@@ -64,9 +61,13 @@ namespace chromeos {
////////////////////////////////////////////////////////////////////////////////
// InputMethodMenuButton
-InputMethodMenuButton::InputMethodMenuButton(StatusAreaHost* host)
- : StatusAreaButton(host, this),
- menu_(new MenuImpl(this, GetPrefService(host), host->GetScreenMode())) {
+InputMethodMenuButton::InputMethodMenuButton(
+ StatusAreaButton::Delegate* delegate,
+ StatusAreaViewChromeos::ScreenMode screen_mode)
+ : StatusAreaButton(delegate, this),
+ menu_(new MenuImpl(this, GetPrefService(), screen_mode)),
+ screen_mode_(screen_mode) {
+ set_id(VIEW_ID_STATUS_BUTTON_INPUT_METHOD);
UpdateUIFromCurrentInputMethod();
}
@@ -118,7 +119,7 @@ void InputMethodMenuButton::UpdateUI(const std::string& input_method_id,
const bool hide_button =
num_active_input_methods == 1 &&
input_method::InputMethodUtil::IsKeyboardLayout(input_method_id) &&
- host_->GetScreenMode() == StatusAreaHost::kBrowserMode;
+ screen_mode_ == StatusAreaViewChromeos::BROWSER_MODE;
SetVisible(!hide_button);
SetText(name);
SetTooltipText(tooltip);
@@ -139,11 +140,14 @@ void InputMethodMenuButton::UpdateUI(const std::string& input_method_id,
}
void InputMethodMenuButton::OpenConfigUI() {
- host_->OpenButtonOptions(this); // ask browser to open the WebUI page.
+ // Ask browser to open the WebUI page.
+ delegate()->ExecuteStatusAreaCommand(
+ this, StatusAreaViewChromeos::SHOW_LANGUAGE_OPTIONS);
}
bool InputMethodMenuButton::ShouldSupportConfigUI() {
- return host_->ShouldOpenButtonOptions(this);
+ return delegate()->ShouldExecuteStatusAreaCommand(
+ this, StatusAreaViewChromeos::SHOW_LANGUAGE_OPTIONS);
}
void InputMethodMenuButton::UpdateUIFromCurrentInputMethod() {
diff --git a/chrome/browser/chromeos/status/input_method_menu_button.h b/chrome/browser/chromeos/status/input_method_menu_button.h
index 2a41619..1f98e14 100644
--- a/chrome/browser/chromeos/status/input_method_menu_button.h
+++ b/chrome/browser/chromeos/status/input_method_menu_button.h
@@ -11,18 +11,19 @@
#include "base/compiler_specific.h"
#include "chrome/browser/chromeos/status/input_method_menu.h"
#include "chrome/browser/chromeos/status/status_area_button.h"
+#include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
#include "views/controls/menu/view_menu_delegate.h"
namespace chromeos {
-class StatusAreaHost;
-
// A class for the button in the status area which expands the dropdown menu for
// switching input method and keyboard layout.
class InputMethodMenuButton : public StatusAreaButton,
public views::ViewMenuDelegate {
public:
- explicit InputMethodMenuButton(StatusAreaHost* host);
+ explicit InputMethodMenuButton(
+ StatusAreaButton::Delegate* delegate,
+ StatusAreaViewChromeos::ScreenMode screen_mode);
virtual ~InputMethodMenuButton();
// views::View implementation.
@@ -47,6 +48,7 @@ class InputMethodMenuButton : public StatusAreaButton,
bool WindowIsActive();
scoped_ptr<InputMethodMenu> menu_;
+ StatusAreaViewChromeos::ScreenMode screen_mode_;
DISALLOW_COPY_AND_ASSIGN(InputMethodMenuButton);
};
diff --git a/chrome/browser/chromeos/status/input_method_menu_button_browsertest.cc b/chrome/browser/chromeos/status/input_method_menu_button_browsertest.cc
index ba4827c..daacb0c 100644
--- a/chrome/browser/chromeos/status/input_method_menu_button_browsertest.cc
+++ b/chrome/browser/chromeos/status/input_method_menu_button_browsertest.cc
@@ -7,7 +7,6 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h"
#include "chrome/browser/chromeos/frame/browser_view.h"
-#include "chrome/browser/chromeos/status/status_area_view.h"
#include "chrome/browser/chromeos/view_ids.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
@@ -28,8 +27,8 @@ class InputMethodMenuButtonTest : public CrosInProcessBrowserTest {
InputMethodMenuButton* GetInputMethodMenuButton() {
BrowserView* view = static_cast<BrowserView*>(browser()->window());
- return static_cast<StatusAreaView*>(view->
- GetViewByID(VIEW_ID_STATUS_AREA))->input_method_view();
+ return static_cast<InputMethodMenuButton*>(view->GetViewByID(
+ VIEW_ID_STATUS_BUTTON_INPUT_METHOD));
}
};
diff --git a/chrome/browser/chromeos/status/memory_menu_button.cc b/chrome/browser/chromeos/status/memory_menu_button.cc
index edf7b3e..ae38c3c 100644
--- a/chrome/browser/chromeos/status/memory_menu_button.cc
+++ b/chrome/browser/chromeos/status/memory_menu_button.cc
@@ -9,7 +9,7 @@
#include "base/process_util.h" // GetSystemMemoryInfo
#include "base/stringprintf.h"
#include "base/threading/thread_restrictions.h"
-#include "chrome/browser/chromeos/status/status_area_host.h"
+#include "chrome/browser/chromeos/view_ids.h"
#include "chrome/browser/memory_purger.h"
#include "chrome/common/render_messages.h"
#include "content/browser/renderer_host/render_process_host.h"
@@ -51,10 +51,11 @@ namespace chromeos {
// Delay between updates, in seconds.
const int kUpdateIntervalSeconds = 5;
-MemoryMenuButton::MemoryMenuButton(StatusAreaHost* host)
- : StatusAreaButton(host, this),
+MemoryMenuButton::MemoryMenuButton(StatusAreaButton::Delegate* delegate)
+ : StatusAreaButton(delegate, this),
meminfo_(new base::SystemMemoryInfoKB()),
renderer_kills_(0) {
+ set_id(VIEW_ID_STATUS_BUTTON_MEMORY);
// Track renderer kills, as the kernel OOM killer will start to kill our
// renderers as we run out of memory.
registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
diff --git a/chrome/browser/chromeos/status/memory_menu_button.h b/chrome/browser/chromeos/status/memory_menu_button.h
index 47be7a6..3704e02 100644
--- a/chrome/browser/chromeos/status/memory_menu_button.h
+++ b/chrome/browser/chromeos/status/memory_menu_button.h
@@ -25,15 +25,13 @@ class MenuRunner;
namespace chromeos {
-class StatusAreaHost;
-
// Memory debugging display that lives in the status area.
class MemoryMenuButton : public StatusAreaButton,
public views::MenuDelegate,
public views::ViewMenuDelegate,
public content::NotificationObserver {
public:
- explicit MemoryMenuButton(StatusAreaHost* host);
+ explicit MemoryMenuButton(StatusAreaButton::Delegate* delegate);
virtual ~MemoryMenuButton();
// views::MenuDelegate implementation
diff --git a/chrome/browser/chromeos/status/network_dropdown_button.cc b/chrome/browser/chromeos/status/network_dropdown_button.cc
index abef11c..8ae9b04 100644
--- a/chrome/browser/chromeos/status/network_dropdown_button.cc
+++ b/chrome/browser/chromeos/status/network_dropdown_button.cc
@@ -9,7 +9,6 @@
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/login/proxy_settings_dialog.h"
#include "chrome/browser/chromeos/options/network_config_view.h"
-#include "chrome/browser/chromeos/status/status_area_host.h"
#include "chrome/common/chrome_switches.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
diff --git a/chrome/browser/chromeos/status/network_menu_button.cc b/chrome/browser/chromeos/status/network_menu_button.cc
index 8c758f6..f15ebd1 100644
--- a/chrome/browser/chromeos/status/network_menu_button.cc
+++ b/chrome/browser/chromeos/status/network_menu_button.cc
@@ -20,7 +20,7 @@
#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/chromeos/options/network_config_view.h"
#include "chrome/browser/chromeos/sim_dialog_delegate.h"
-#include "chrome/browser/chromeos/status/status_area_host.h"
+#include "chrome/browser/chromeos/view_ids.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
@@ -96,14 +96,17 @@ namespace chromeos {
////////////////////////////////////////////////////////////////////////////////
// NetworkMenuButton
-NetworkMenuButton::NetworkMenuButton(StatusAreaHost* host)
- : StatusAreaButton(host, this),
+NetworkMenuButton::NetworkMenuButton(
+ StatusAreaButton::Delegate* delegate,
+ StatusAreaViewChromeos::ScreenMode screen_mode)
+ : StatusAreaButton(delegate, this),
mobile_data_bubble_(NULL),
is_browser_mode_(false),
check_for_promo_(true),
was_sim_locked_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
- is_browser_mode_ = (host->GetScreenMode() == StatusAreaHost::kBrowserMode);
+ set_id(VIEW_ID_STATUS_BUTTON_NETWORK_MENU);
+ is_browser_mode_ = (screen_mode == StatusAreaViewChromeos::BROWSER_MODE);
network_menu_.reset(new NetworkMenu(this, is_browser_mode_));
network_icon_.reset(
new NetworkMenuIcon(this, NetworkMenuIcon::MENU_MODE));
@@ -194,15 +197,18 @@ views::MenuButton* NetworkMenuButton::GetMenuButton() {
}
gfx::NativeWindow NetworkMenuButton::GetNativeWindow() const {
- return host_->GetNativeWindow();
+ // This must always have a parent, which must have a widget ancestor.
+ return parent()->GetWidget()->GetNativeWindow();
}
void NetworkMenuButton::OpenButtonOptions() {
- host_->OpenButtonOptions(this);
+ delegate()->ExecuteStatusAreaCommand(
+ this, StatusAreaViewChromeos::SHOW_NETWORK_OPTIONS);
}
bool NetworkMenuButton::ShouldOpenButtonOptions() const {
- return host_->ShouldOpenButtonOptions(this);
+ return delegate()->ShouldExecuteStatusAreaCommand(
+ this, StatusAreaViewChromeos::SHOW_NETWORK_OPTIONS);
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/chromeos/status/network_menu_button.h b/chrome/browser/chromeos/status/network_menu_button.h
index 29e015a..9df8144 100644
--- a/chrome/browser/chromeos/status/network_menu_button.h
+++ b/chrome/browser/chromeos/status/network_menu_button.h
@@ -16,6 +16,7 @@
#include "chrome/browser/chromeos/status/network_menu.h"
#include "chrome/browser/chromeos/status/network_menu_icon.h"
#include "chrome/browser/chromeos/status/status_area_button.h"
+#include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
class PrefService;
@@ -25,8 +26,6 @@ class Canvas;
namespace chromeos {
-class StatusAreaHost;
-
// The network menu button in the status area.
// This class will handle getting the wifi networks and populating the menu.
// It will also handle the status icon changing and connecting to another
@@ -61,7 +60,8 @@ class NetworkMenuButton : public StatusAreaButton,
public NetworkLibrary::CellularDataPlanObserver,
public MessageBubbleDelegate {
public:
- explicit NetworkMenuButton(StatusAreaHost* host);
+ explicit NetworkMenuButton(StatusAreaButton::Delegate* delegate,
+ StatusAreaViewChromeos::ScreenMode screen_mode);
virtual ~NetworkMenuButton();
static void RegisterPrefs(PrefService* local_state);
diff --git a/chrome/browser/chromeos/status/power_menu_button.cc b/chrome/browser/chromeos/status/power_menu_button.cc
index 85ecf06..28eecb6 100644
--- a/chrome/browser/chromeos/status/power_menu_button.cc
+++ b/chrome/browser/chromeos/status/power_menu_button.cc
@@ -13,6 +13,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/status/status_area_bubble.h"
+#include "chrome/browser/chromeos/view_ids.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
#include "ui/base/l10n/l10n_util.h"
@@ -205,14 +206,15 @@ using base::TimeDelta;
////////////////////////////////////////////////////////////////////////////////
// PowerMenuButton
-PowerMenuButton::PowerMenuButton(StatusAreaHost* host)
- : StatusAreaButton(host, this),
+PowerMenuButton::PowerMenuButton(StatusAreaButton::Delegate* delegate)
+ : StatusAreaButton(delegate, this),
battery_is_present_(false),
line_power_on_(false),
battery_percentage_(0.0),
battery_time_to_full_(TimeDelta::FromMicroseconds(kInitialMS)),
battery_time_to_empty_(TimeDelta::FromMicroseconds(kInitialMS)),
status_(NULL) {
+ set_id(VIEW_ID_STATUS_BUTTON_POWER);
UpdateIconAndLabelInfo();
CrosLibrary::Get()->GetPowerLibrary()->AddObserver(this);
}
diff --git a/chrome/browser/chromeos/status/power_menu_button.h b/chrome/browser/chromeos/status/power_menu_button.h
index de0eb87..66a0181 100644
--- a/chrome/browser/chromeos/status/power_menu_button.h
+++ b/chrome/browser/chromeos/status/power_menu_button.h
@@ -32,7 +32,7 @@ class PowerMenuButton : public StatusAreaButton,
public views::ViewMenuDelegate,
public PowerLibrary::Observer {
public:
- explicit PowerMenuButton(StatusAreaHost* host);
+ explicit PowerMenuButton(StatusAreaButton::Delegate* delegate);
virtual ~PowerMenuButton();
// views::MenuDelegate implementation.
diff --git a/chrome/browser/chromeos/status/power_menu_button_browsertest.cc b/chrome/browser/chromeos/status/power_menu_button_browsertest.cc
index 1c6584d..fe476f0 100644
--- a/chrome/browser/chromeos/status/power_menu_button_browsertest.cc
+++ b/chrome/browser/chromeos/status/power_menu_button_browsertest.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/chromeos/status/power_menu_button.h"
#include "chrome/browser/chromeos/frame/browser_view.h"
-#include "chrome/browser/chromeos/status/status_area_view.h"
#include "chrome/browser/chromeos/view_ids.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
@@ -23,9 +22,8 @@ class PowerMenuButtonTest : public InProcessBrowserTest {
PowerMenuButton* GetPowerMenuButton() {
BrowserView* view = static_cast<BrowserView*>(browser()->window());
- PowerMenuButton* power = static_cast<StatusAreaView*>(view->
- GetViewByID(VIEW_ID_STATUS_AREA))->power_view();
- return power;
+ return static_cast<PowerMenuButton*>(view->GetViewByID(
+ VIEW_ID_STATUS_BUTTON_POWER));
}
string16 CallPowerChangedAndGetTooltipText(const PowerSupplyStatus& status) {
diff --git a/chrome/browser/chromeos/status/status_area_button.cc b/chrome/browser/chromeos/status/status_area_button.cc
index e4b4103..9e2e7cd 100644
--- a/chrome/browser/chromeos/status/status_area_button.cc
+++ b/chrome/browser/chromeos/status/status_area_button.cc
@@ -29,26 +29,20 @@ const int kIconHorizontalPad = 2;
}
-namespace chromeos {
-
////////////////////////////////////////////////////////////////////////////////
// StatusAreaButton
-StatusAreaButton::StatusAreaButton(StatusAreaHost* host,
+StatusAreaButton::StatusAreaButton(Delegate* button_delegate,
views::ViewMenuDelegate* menu_delegate)
: MenuButton(NULL, string16(), menu_delegate, false),
- use_menu_button_paint_(false),
- active_(true),
- host_(host) {
+ menu_active_(true),
+ delegate_(button_delegate) {
set_border(NULL);
- set_use_menu_button_paint(true);
-
- bool webui_login = host_->GetScreenMode() == StatusAreaHost::kWebUILoginMode;
gfx::Font font =
ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont);
- font = font.DeriveFont(kFontSizeDelta, webui_login ? font.GetStyle()
- : gfx::Font::BOLD);
+ font = font.DeriveFont(kFontSizeDelta);
+ font = delegate_->GetStatusAreaFont(font);
SetFont(font);
SetShowMultipleIconStates(false);
@@ -68,12 +62,7 @@ void StatusAreaButton::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) {
canvas->FillRect(SkColorSetARGB(0x19, 0xFF, 0xFF, 0xFF), GetLocalBounds());
}
- if (use_menu_button_paint_) {
- views::MenuButton::PaintButton(canvas, mode);
- } else {
- canvas->DrawBitmapInt(icon(), horizontal_padding(), 0);
- OnPaintFocusBorder(canvas);
- }
+ views::MenuButton::PaintButton(canvas, mode);
}
void StatusAreaButton::SetText(const string16& text) {
@@ -88,7 +77,7 @@ void StatusAreaButton::SetText(const string16& text) {
}
bool StatusAreaButton::Activate() {
- if (active_)
+ if (menu_active_)
return views::MenuButton::Activate();
else
return true;
@@ -100,18 +89,14 @@ gfx::Size StatusAreaButton::GetPreferredSize() {
icon_height() + insets.height());
// Adjusts size when use menu button paint.
- if (use_menu_button_paint_) {
- gfx::Size menu_button_size = views::MenuButton::GetPreferredSize();
- prefsize.SetSize(
- std::max(prefsize.width(), menu_button_size.width()),
- std::max(prefsize.height(), menu_button_size.height())
- );
-
- // Shift 1-pixel down for odd number of pixels in vertical space.
- if ((prefsize.height() - menu_button_size.height()) % 2) {
- insets_.Set(insets.top() + 1, insets.left(),
- insets.bottom(), insets.right());
- }
+ gfx::Size menu_button_size = views::MenuButton::GetPreferredSize();
+ prefsize.SetSize(std::max(prefsize.width(), menu_button_size.width()),
+ std::max(prefsize.height(), menu_button_size.height()));
+
+ // Shift 1-pixel down for odd number of pixels in vertical space.
+ if ((prefsize.height() - menu_button_size.height()) % 2) {
+ insets_.Set(insets.top() + 1, insets.left(),
+ insets.bottom(), insets.right());
}
// Add padding.
@@ -131,7 +116,7 @@ void StatusAreaButton::OnThemeChanged() {
void StatusAreaButton::SetVisible(bool visible) {
if (visible != IsVisible()) {
views::MenuButton::SetVisible(visible);
- host_->ButtonVisibilityChanged(this);
+ delegate_->ButtonVisibilityChanged(this);
}
}
@@ -158,23 +143,21 @@ int StatusAreaButton::horizontal_padding() {
void StatusAreaButton::UpdateTextStyle() {
ClearEmbellishing();
- switch (host_->GetTextStyle()) {
- case StatusAreaHost::kWhitePlain:
+ switch (delegate_->GetStatusAreaTextStyle()) {
+ case WHITE_PLAIN:
SetEnabledColor(kWhitePlainTextColor);
break;
- case StatusAreaHost::kGrayPlain:
+ case GRAY_PLAIN:
SetEnabledColor(kGrayPlainTextColor);
break;
- case StatusAreaHost::kWhiteHaloed:
+ case WHITE_HALOED:
SetEnabledColor(kWhiteHaloedTextColor);
SetTextHaloColor(kWhiteHaloedHaloColor);
break;
- case StatusAreaHost::kGrayEmbossed:
+ case GRAY_EMBOSSED:
SetEnabledColor(kGrayEmbossedTextColor);
SetTextShadowColors(kGrayEmbossedShadowColor, kGrayEmbossedShadowColor);
SetTextShadowOffset(0, 1);
break;
}
}
-
-} // namespace chromeos
diff --git a/chrome/browser/chromeos/status/status_area_button.h b/chrome/browser/chromeos/status/status_area_button.h
index 1aee800..e88cbcd 100644
--- a/chrome/browser/chromeos/status/status_area_button.h
+++ b/chrome/browser/chromeos/status/status_area_button.h
@@ -7,17 +7,47 @@
#pragma once
#include "base/string16.h"
-#include "chrome/browser/chromeos/status/status_area_host.h"
#include "views/controls/button/menu_button.h"
#include "views/controls/menu/view_menu_delegate.h"
-namespace chromeos {
+namespace gfx {
+class Font;
+}
// Button to be used to represent status and allow menus to be popped up.
// Shows current button state by drawing a border around the current icon.
class StatusAreaButton : public views::MenuButton {
public:
- StatusAreaButton(StatusAreaHost* host,
+ // Different text styles for different types of backgrounds.
+ enum TextStyle {
+ WHITE_PLAIN,
+ GRAY_PLAIN,
+ WHITE_HALOED,
+ GRAY_EMBOSSED
+ };
+
+ class Delegate {
+ public:
+ // |command_id| can be any int, passed from the button to the delegate.
+ virtual bool ShouldExecuteStatusAreaCommand(
+ const views::View* button_view, int command_id) const = 0;
+
+ virtual void ExecuteStatusAreaCommand(
+ const views::View* button_view, int command_id) = 0;
+
+ // Return the button font. |font| is set to the default button font.
+ virtual gfx::Font GetStatusAreaFont(const gfx::Font& font) const = 0;
+
+ virtual TextStyle GetStatusAreaTextStyle() const = 0;
+
+ // Handle visibility changes (e.g. resize the status area).
+ virtual void ButtonVisibilityChanged(views::View* button_view) = 0;
+
+ protected:
+ virtual ~Delegate() {}
+ };
+
+ StatusAreaButton(Delegate* button_delegate,
views::ViewMenuDelegate* menu_delegate);
virtual ~StatusAreaButton() {}
virtual void PaintButton(gfx::Canvas* canvas, PaintButtonMode mode);
@@ -26,10 +56,6 @@ class StatusAreaButton : public views::MenuButton {
// text content so that the button size would fit the new text size.
virtual void SetText(const string16& text);
- void set_use_menu_button_paint(bool use_menu_button_paint) {
- use_menu_button_paint_ = use_menu_button_paint;
- }
-
// views::MenuButton overrides.
virtual bool Activate() OVERRIDE;
@@ -40,11 +66,13 @@ class StatusAreaButton : public views::MenuButton {
virtual void SetVisible(bool visible) OVERRIDE;
virtual bool HitTest(const gfx::Point& l) const OVERRIDE;
- // Controls whether or not this status area button is able to be pressed.
- void set_active(bool active) { active_ = active; }
- bool active() const { return active_; }
+ void set_menu_active(bool active) { menu_active_ = active; }
+ bool menu_active() const { return menu_active_; }
protected:
+ Delegate* delegate() { return delegate_; }
+ const Delegate* delegate() const { return delegate_; }
+
// Subclasses should override these methods to return the correct dimensions.
virtual int icon_height();
virtual int icon_width();
@@ -53,26 +81,20 @@ class StatusAreaButton : public views::MenuButton {
// The padding is added to both the left and right side.
virtual int horizontal_padding();
- // True if the button wants to use views::MenuButton drawings.
- bool use_menu_button_paint_;
-
// Insets to use for this button.
gfx::Insets insets_;
- // Indicates when this button can be pressed. Independent of
- // IsEnabled state, so that when IsEnabled is true, this can still
- // be false, and vice versa.
- bool active_;
-
- // The status area host,
- StatusAreaHost* host_;
+ // Controls whether or not the menu can be activated. This is independent of
+ // IsEnabled state, so that we can prevent the menu from appearing without
+ // affecting the appearance of the button.
+ bool menu_active_;
private:
void UpdateTextStyle();
+ Delegate* delegate_;
+
DISALLOW_COPY_AND_ASSIGN(StatusAreaButton);
};
-} // namespace chromeos
-
#endif // CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_BUTTON_H_
diff --git a/chrome/browser/chromeos/status/status_area_host.h b/chrome/browser/chromeos/status/status_area_host.h
deleted file mode 100644
index 7bb1638..0000000
--- a/chrome/browser/chromeos/status/status_area_host.h
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_HOST_H_
-#define CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_HOST_H_
-#pragma once
-
-#include "ui/gfx/native_widget_types.h"
-
-namespace views {
-class View;
-} // namespace views
-
-class Profile;
-
-namespace chromeos {
-
-// This class is an abstraction decoupling StatusAreaView from its host
-// window.
-class StatusAreaHost {
- public:
- // Different text styles for different types of backgrounds.
- enum TextStyle {
- kWhitePlain,
- kGrayPlain,
- kWhiteHaloed,
- kGrayEmbossed
- };
-
- // The type of screen the host window is on.
- enum ScreenMode {
- kViewsLoginMode, // The host is for the views-based OOBE/login screens.
- kWebUILoginMode, // The host is for the WebUI OOBE/login screens.
- kBrowserMode, // The host is for browser.
- kScreenLockerMode, // The host is for screen locker.
- };
-
- // Returns the Profile if this status area is inside the browser and has a
- // profile. Otherwise, returns NULL.
- virtual Profile* GetProfile() const = 0;
-
- // Returns native window hosting the status area.
- virtual gfx::NativeWindow GetNativeWindow() 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) = 0;
-
- // Executes browser command.
- virtual void ExecuteBrowserCommand(int id) const = 0;
-
- // Returns the text style.
- virtual TextStyle GetTextStyle() const = 0;
-
- // Returns the type of screen.
- virtual ScreenMode GetScreenMode() const = 0;
-
- // Invoked when a child button's visibility changes.
- virtual void ButtonVisibilityChanged(views::View* button_view) = 0;
-
- protected:
- virtual ~StatusAreaHost() {}
-};
-
-} // namespace chromeos
-
-#endif // CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_HOST_H_
diff --git a/chrome/browser/chromeos/status/status_area_view.cc b/chrome/browser/chromeos/status/status_area_view.cc
index bda2d37..24b0d16 100644
--- a/chrome/browser/chromeos/status/status_area_view.cc
+++ b/chrome/browser/chromeos/status/status_area_view.cc
@@ -15,7 +15,6 @@
#include "chrome/browser/chromeos/status/memory_menu_button.h"
#include "chrome/browser/chromeos/status/network_menu_button.h"
#include "chrome/browser/chromeos/status/power_menu_button.h"
-#include "chrome/browser/chromeos/status/status_area_host.h"
#include "chrome/common/chrome_switches.h"
#include "grit/theme_resources.h"
#include "ui/base/resource/resource_bundle.h"
@@ -23,8 +22,6 @@
#include "views/border.h"
#include "views/controls/image_view.h"
-namespace chromeos {
-
// Number of pixels to separate each icon.
#if defined(TOUCH_UI)
const int kSeparation = 25;
@@ -32,49 +29,33 @@ const int kSeparation = 25;
const int kSeparation = 0;
#endif
-StatusAreaView::StatusAreaView(StatusAreaHost* host)
- : host_(host),
- accessibility_view_(NULL),
- caps_lock_view_(NULL),
- clock_view_(NULL),
- input_method_view_(NULL),
- memory_view_(NULL),
- network_view_(NULL),
- power_view_(NULL),
- need_return_focus_(false) {
+StatusAreaView::StatusAreaView()
+ : need_return_focus_(false) {
}
StatusAreaView::~StatusAreaView() {
}
-void StatusAreaView::Init() {
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kMemoryWidget)) {
- memory_view_ = new MemoryMenuButton(host_);
- AddChildView(memory_view_);
- }
-
- accessibility_view_ = new AccessibilityMenuButton(host_);
- accessibility_view_->set_border(views::Border::CreateEmptyBorder(0, 1, 0, 0));
- AddChildView(accessibility_view_);
-
- caps_lock_view_ = new CapsLockMenuButton(host_);
- caps_lock_view_->set_border(views::Border::CreateEmptyBorder(0, 1, 0, 0));
- AddChildView(caps_lock_view_);
-
- clock_view_ = new ClockMenuButton(host_);
- clock_view_->set_border(views::Border::CreateEmptyBorder(0, 1, 0, 0));
- AddChildView(clock_view_);
-
- input_method_view_ = new InputMethodMenuButton(host_);
- AddChildView(input_method_view_);
-
- network_view_ = new NetworkMenuButton(host_);
- AddChildView(network_view_);
+void StatusAreaView::AddButton(StatusAreaButton* button, bool bordered) {
+ buttons_.push_back(button);
+ if (bordered)
+ button->set_border(views::Border::CreateEmptyBorder(0, 1, 0, 0));
+ AddChildView(button);
+ UpdateButtonVisibility();
+}
- power_view_ = new PowerMenuButton(host_);
- AddChildView(power_view_);
+void StatusAreaView::RemoveButton(StatusAreaButton* button) {
+ std::list<StatusAreaButton*>::iterator iter =
+ std::find(buttons_.begin(), buttons_.end(), button);
+ if (iter != buttons_.end()) {
+ RemoveChildView(*iter);
+ buttons_.erase(iter);
+ }
+ UpdateButtonVisibility();
}
+// views::View* overrides.
+
gfx::Size StatusAreaView::GetPreferredSize() {
int result_w = 0;
int result_h = 0;
@@ -122,17 +103,13 @@ void StatusAreaView::ChildPreferredSizeChanged(View* child) {
}
void StatusAreaView::MakeButtonsActive(bool active) {
- if (memory_view_)
- memory_view_->set_active(active);
- accessibility_view()->set_active(active);
- caps_lock_view()->set_active(active);
- clock_view()->set_active(active);
- input_method_view()->set_active(active);
- network_view()->set_active(active);
- power_view()->set_active(active);
+ for (std::list<StatusAreaButton*>::iterator iter = buttons_.begin();
+ iter != buttons_.end(); ++iter) {
+ (*iter)->set_menu_active(active);
+ }
}
-void StatusAreaView::ButtonVisibilityChanged(views::View* button_view) {
+void StatusAreaView::UpdateButtonVisibility() {
Layout();
PreferredSizeChanged();
}
@@ -179,5 +156,3 @@ void StatusAreaView::FocusWillChange(views::View* focused_before,
base::Bind(&StatusAreaView::ReturnFocus, AsWeakPtr(), first_to_last));
}
}
-
-} // namespace chromeos
diff --git a/chrome/browser/chromeos/status/status_area_view.h b/chrome/browser/chromeos/status/status_area_view.h
index 22cc8f7..f2da1ee 100644
--- a/chrome/browser/chromeos/status/status_area_view.h
+++ b/chrome/browser/chromeos/status/status_area_view.h
@@ -6,33 +6,27 @@
#define CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_VIEW_H_
#pragma once
+#include <list>
+
#include "base/basictypes.h"
#include "base/callback.h"
+#include "chrome/browser/chromeos/status/status_area_button.h"
#include "chrome/browser/ui/views/accessible_pane_view.h"
#include "views/view.h"
-namespace chromeos {
-
-class AccessibilityMenuButton;
-class CapsLockMenuButton;
-class ClockMenuButton;
-class InputMethodMenuButton;
-class MemoryMenuButton;
-class NetworkMenuButton;
-class PowerMenuButton;
-class StatusAreaHost;
-
// This class is used to wrap the small informative widgets in the upper-right
// of the window title bar. It is used on ChromeOS only.
class StatusAreaView : public AccessiblePaneView,
public base::SupportsWeakPtr<StatusAreaView> {
public:
- explicit StatusAreaView(StatusAreaHost* host);
+ explicit StatusAreaView();
virtual ~StatusAreaView();
- virtual void Init();
+ void AddButton(StatusAreaButton* button, bool bordered);
+ void RemoveButton(StatusAreaButton* button);
+
void MakeButtonsActive(bool active);
- void ButtonVisibilityChanged(views::View* button_view);
+ void UpdateButtonVisibility();
// Takes focus and transfers it to the first (last if |reverse| is true).
// After focus has traversed through all elements, clears focus and calls
@@ -46,38 +40,23 @@ class StatusAreaView : public AccessiblePaneView,
views::View* focused_now) OVERRIDE;
// views::View* overrides.
- virtual gfx::Size GetPreferredSize();
- virtual void Layout();
- virtual void ChildPreferredSizeChanged(View* child);
-
- AccessibilityMenuButton* accessibility_view() { return accessibility_view_; }
- CapsLockMenuButton* caps_lock_view() { return caps_lock_view_; }
- ClockMenuButton* clock_view() { return clock_view_; }
- InputMethodMenuButton* input_method_view() { return input_method_view_; }
- NetworkMenuButton* network_view() { return network_view_; }
- PowerMenuButton* power_view() { return power_view_; }
+ virtual gfx::Size GetPreferredSize() OVERRIDE;
+ virtual void Layout() OVERRIDE;
+ virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE;
private:
- StatusAreaHost* host_;
-
- AccessibilityMenuButton* accessibility_view_;
- CapsLockMenuButton* caps_lock_view_;
- ClockMenuButton* clock_view_;
- InputMethodMenuButton* input_method_view_;
- MemoryMenuButton* memory_view_;
- NetworkMenuButton* network_view_;
- PowerMenuButton* power_view_;
+ StatusAreaButton::Delegate* delegate_;
// True if focus needs to be returned via |return_focus_cb_| when it wraps.
bool need_return_focus_;
ReturnFocusCallback return_focus_cb_;
+ std::list<StatusAreaButton*> buttons_;
+
// Clears focus and calls |return_focus_cb_|.
void ReturnFocus(bool reverse);
DISALLOW_COPY_AND_ASSIGN(StatusAreaView);
};
-} // namespace chromeos
-
#endif // CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_VIEW_H_
diff --git a/chrome/browser/chromeos/status/status_area_view_chromeos.cc b/chrome/browser/chromeos/status/status_area_view_chromeos.cc
new file mode 100644
index 0000000..d12c6f2
--- /dev/null
+++ b/chrome/browser/chromeos/status/status_area_view_chromeos.cc
@@ -0,0 +1,84 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
+
+#include "base/command_line.h"
+#include "chrome/browser/chromeos/cros/cros_library.h"
+#include "chrome/browser/chromeos/status/accessibility_menu_button.h"
+#include "chrome/browser/chromeos/status/caps_lock_menu_button.h"
+#include "chrome/browser/chromeos/status/clock_menu_button.h"
+#include "chrome/browser/chromeos/status/input_method_menu_button.h"
+#include "chrome/browser/chromeos/status/memory_menu_button.h"
+#include "chrome/browser/chromeos/status/network_menu_button.h"
+#include "chrome/browser/chromeos/status/power_menu_button.h"
+#include "chrome/browser/chromeos/view_ids.h"
+#include "chrome/common/chrome_switches.h"
+
+namespace chromeos {
+
+StatusAreaViewChromeos::StatusAreaViewChromeos() {
+ CrosLibrary::Get()->GetPowerLibrary()->AddObserver(this);
+ system::TimezoneSettings::GetInstance()->AddObserver(this);
+}
+
+StatusAreaViewChromeos::~StatusAreaViewChromeos() {
+ CrosLibrary::Get()->GetPowerLibrary()->RemoveObserver(this);
+ system::TimezoneSettings::GetInstance()->RemoveObserver(this);
+}
+
+void StatusAreaViewChromeos::Init(StatusAreaButton::Delegate* delegate,
+ ScreenMode screen_mode) {
+ AddChromeosButtons(this, delegate, screen_mode);
+}
+
+void StatusAreaViewChromeos::PowerChanged(const PowerSupplyStatus& status) {
+}
+
+void StatusAreaViewChromeos::SystemResumed() {
+ UpdateClockText();
+}
+
+void StatusAreaViewChromeos::TimezoneChanged(const icu::TimeZone& timezone) {
+ UpdateClockText();
+}
+
+void StatusAreaViewChromeos::UpdateClockText() {
+ ClockMenuButton* clock_button =
+ static_cast<ClockMenuButton*>(GetViewByID(VIEW_ID_STATUS_BUTTON_CLOCK));
+ if (clock_button)
+ clock_button->UpdateText();
+}
+
+void StatusAreaViewChromeos::SetDefaultUse24HourClock(bool use_24hour_clock) {
+ ClockMenuButton* clock_button =
+ static_cast<ClockMenuButton*>(GetViewByID(VIEW_ID_STATUS_BUTTON_CLOCK));
+ if (clock_button)
+ clock_button->SetDefaultUse24HourClock(use_24hour_clock);
+}
+
+// static
+void StatusAreaViewChromeos::AddChromeosButtons(
+ StatusAreaView* status_area,
+ StatusAreaButton::Delegate* delegate,
+ ScreenMode screen_mode) {
+ const bool border = true;
+ const bool no_border = false;
+
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kMemoryWidget))
+ status_area->AddButton(new MemoryMenuButton(delegate), no_border);
+
+ status_area->AddButton(
+ new AccessibilityMenuButton(delegate, screen_mode), border);
+ status_area->AddButton(new CapsLockMenuButton(delegate), border);
+ status_area->AddButton(new ClockMenuButton(delegate), border);
+
+ status_area->AddButton(
+ new InputMethodMenuButton(delegate, screen_mode), no_border);
+ status_area->AddButton(
+ new NetworkMenuButton(delegate, screen_mode), no_border);
+ status_area->AddButton(new PowerMenuButton(delegate), no_border);
+}
+
+} // namespace chromeos
diff --git a/chrome/browser/chromeos/status/status_area_view_chromeos.h b/chrome/browser/chromeos/status/status_area_view_chromeos.h
new file mode 100644
index 0000000..a9e9934
--- /dev/null
+++ b/chrome/browser/chromeos/status/status_area_view_chromeos.h
@@ -0,0 +1,64 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_VIEW_CHROMEOS_H_
+#define CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_VIEW_CHROMEOS_H_
+#pragma once
+
+#include "chrome/browser/chromeos/status/status_area_view.h"
+
+#include "chrome/browser/chromeos/cros/power_library.h"
+#include "chrome/browser/chromeos/system/timezone_settings.h"
+#include "chrome/browser/chromeos/view_ids.h"
+
+namespace chromeos {
+
+class StatusAreaViewChromeos : public StatusAreaView,
+ public PowerLibrary::Observer,
+ public system::TimezoneSettings::Observer {
+ public:
+ // The type of screen the host window is on.
+ enum ScreenMode {
+ LOGIN_MODE_VIEWS, // The host is for the views-based OOBE/login screens.
+ LOGIN_MODE_WEBUI, // The host is for the WebUI OOBE/login screens.
+ BROWSER_MODE, // The host is for browser.
+ SCREEN_LOCKER_MODE, // The host is for screen locker.
+ };
+
+ // Commands to be passed to StatusAreaButton::Delegate:ExecuteCommand().
+ enum Command {
+ SHOW_LANGUAGE_OPTIONS,
+ SHOW_NETWORK_OPTIONS,
+ SHOW_SYSTEM_OPTIONS
+ };
+
+ explicit StatusAreaViewChromeos();
+ virtual ~StatusAreaViewChromeos();
+
+ void Init(StatusAreaButton::Delegate* delegate, ScreenMode screen_mode);
+
+ // PowerLibrary::Observer:
+ virtual void PowerChanged(const PowerSupplyStatus& status) OVERRIDE;
+ virtual void SystemResumed() OVERRIDE;
+
+ // TimezoneSettings::Observer:
+ virtual void TimezoneChanged(const icu::TimeZone& timezone) OVERRIDE;
+
+ // Sets default use 24hour clock mode.
+ void SetDefaultUse24HourClock(bool use_24hour_clock);
+
+ // Convenience function to add buttons to a status area for ChromeOS.
+ static void AddChromeosButtons(StatusAreaView* status_area,
+ StatusAreaButton::Delegate* delegate,
+ ScreenMode screen_mode);
+
+ private:
+ void UpdateClockText();
+
+ DISALLOW_COPY_AND_ASSIGN(StatusAreaViewChromeos);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_VIEW_CHROMEOS_H_
diff --git a/chrome/browser/chromeos/view_ids.h b/chrome/browser/chromeos/view_ids.h
index 6d31565..a513a1c 100644
--- a/chrome/browser/chromeos/view_ids.h
+++ b/chrome/browser/chromeos/view_ids.h
@@ -16,6 +16,14 @@ enum ChromeOSViewIds {
VIEW_ID_SCREEN_LOCKER_SIGNOUT_LINK,
VIEW_ID_SCREEN_LOCKER_SHUTDOWN,
VIEW_ID_LAYOUT_MODE_BUTTON,
+
+ VIEW_ID_STATUS_BUTTON_ACCESSIBILITY,
+ VIEW_ID_STATUS_BUTTON_CAPS_LOCK,
+ VIEW_ID_STATUS_BUTTON_CLOCK,
+ VIEW_ID_STATUS_BUTTON_INPUT_METHOD,
+ VIEW_ID_STATUS_BUTTON_MEMORY,
+ VIEW_ID_STATUS_BUTTON_NETWORK_MENU,
+ VIEW_ID_STATUS_BUTTON_POWER
};
#endif // CHROME_BROWSER_CHROMEOS_VIEW_IDS_H_
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 5009baa..2a075ab 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -792,13 +792,14 @@
'browser/chromeos/status/network_menu_icon.h',
'browser/chromeos/status/power_menu_button.cc',
'browser/chromeos/status/power_menu_button.h',
+ 'browser/chromeos/status/status_area_bubble.cc',
+ 'browser/chromeos/status/status_area_bubble.h',
'browser/chromeos/status/status_area_button.cc',
'browser/chromeos/status/status_area_button.h',
- 'browser/chromeos/status/status_area_host.h',
'browser/chromeos/status/status_area_view.cc',
'browser/chromeos/status/status_area_view.h',
- 'browser/chromeos/status/status_area_bubble.cc',
- 'browser/chromeos/status/status_area_bubble.h',
+ 'browser/chromeos/status/status_area_view_chromeos.cc',
+ 'browser/chromeos/status/status_area_view_chromeos.h',
'browser/chromeos/system/name_value_pairs_parser.cc',
'browser/chromeos/system/name_value_pairs_parser.h',
'browser/chromeos/system/runtime_environment.cc',