summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ash/ash_switches.cc3
-rw-r--r--ash/shell.cc110
-rw-r--r--ash/shell/shell_delegate_impl.cc4
-rw-r--r--ash/shell/shell_delegate_impl.h1
-rw-r--r--ash/shell_delegate.h3
-rw-r--r--ash/status_area/status_area_view.cc22
-rw-r--r--ash/status_area/status_area_view.h5
-rw-r--r--ash/test/test_shell_delegate.cc4
-rw-r--r--ash/test/test_shell_delegate.h1
-rw-r--r--chrome/browser/about_flags.cc7
-rw-r--r--chrome/browser/chrome_browser_main_extra_parts_ash.cc6
-rw-r--r--chrome/browser/chromeos/chrome_browser_main_chromeos.cc5
-rw-r--r--chrome/browser/chromeos/input_method/input_method_util.cc42
-rw-r--r--chrome/browser/chromeos/input_method/input_method_util.h1
-rw-r--r--chrome/browser/chromeos/input_method/input_method_util_unittest.cc107
-rw-r--r--chrome/browser/chromeos/login/existing_user_controller.cc12
-rw-r--r--chrome/browser/chromeos/login/existing_user_controller.h3
-rw-r--r--chrome/browser/chromeos/login/existing_user_controller_browsertest.cc3
-rw-r--r--chrome/browser/chromeos/login/login_display_host.h3
-rw-r--r--chrome/browser/chromeos/login/login_utils.cc9
-rw-r--r--chrome/browser/chromeos/login/webui_login_display_host.cc5
-rw-r--r--chrome/browser/chromeos/login/webui_login_display_host.h1
-rw-r--r--chrome/browser/chromeos/login/webui_login_view.cc106
-rw-r--r--chrome/browser/chromeos/login/webui_login_view.h39
-rw-r--r--chrome/browser/chromeos/login/webui_screen_locker.cc19
-rw-r--r--chrome/browser/chromeos/login/webui_screen_locker.h4
-rw-r--r--chrome/browser/chromeos/status/accessibility_menu_button.cc136
-rw-r--r--chrome/browser/chromeos/status/accessibility_menu_button.h65
-rw-r--r--chrome/browser/chromeos/status/caps_lock_menu_button.cc291
-rw-r--r--chrome/browser/chromeos/status/caps_lock_menu_button.h109
-rw-r--r--chrome/browser/chromeos/status/clock_menu_button.cc208
-rw-r--r--chrome/browser/chromeos/status/clock_menu_button.h84
-rw-r--r--chrome/browser/chromeos/status/clock_updater.cc30
-rw-r--r--chrome/browser/chromeos/status/clock_updater.h35
-rw-r--r--chrome/browser/chromeos/status/data_promo_notification.cc8
-rw-r--r--chrome/browser/chromeos/status/data_promo_notification.h4
-rw-r--r--chrome/browser/chromeos/status/input_method_menu.cc537
-rw-r--r--chrome/browser/chromeos/status/input_method_menu.h167
-rw-r--r--chrome/browser/chromeos/status/input_method_menu_button.cc158
-rw-r--r--chrome/browser/chromeos/status/input_method_menu_button.h56
-rw-r--r--chrome/browser/chromeos/status/input_method_menu_unittest.cc137
-rw-r--r--chrome/browser/chromeos/status/memory_menu_button.cc282
-rw-r--r--chrome/browser/chromeos/status/memory_menu_button.h80
-rw-r--r--chrome/browser/chromeos/status/network_menu.cc104
-rw-r--r--chrome/browser/chromeos/status/network_menu_button.cc237
-rw-r--r--chrome/browser/chromeos/status/network_menu_button.h132
-rw-r--r--chrome/browser/chromeos/status/power_menu_button.cc384
-rw-r--r--chrome/browser/chromeos/status/power_menu_button.h87
-rw-r--r--chrome/browser/chromeos/status/status_area_bubble.cc137
-rw-r--r--chrome/browser/chromeos/status/status_area_bubble.h72
-rw-r--r--chrome/browser/chromeos/status/status_area_button.cc171
-rw-r--r--chrome/browser/chromeos/status/status_area_button.h112
-rw-r--r--chrome/browser/chromeos/status/status_area_view.cc213
-rw-r--r--chrome/browser/chromeos/status/status_area_view.h94
-rw-r--r--chrome/browser/chromeos/status/status_area_view_chromeos.cc103
-rw-r--r--chrome/browser/chromeos/status/status_area_view_chromeos.h74
-rw-r--r--chrome/browser/chromeos/status/volume_menu_button.cc265
-rw-r--r--chrome/browser/chromeos/status/volume_menu_button.h49
-rw-r--r--chrome/browser/chromeos/system/ash_system_tray_delegate.cc7
-rw-r--r--chrome/browser/prefs/browser_prefs.cc5
-rw-r--r--chrome/browser/ui/views/ash/chrome_shell_delegate.cc12
-rw-r--r--chrome/browser/ui/views/ash/chrome_shell_delegate.h10
-rw-r--r--chrome/browser/ui/views/ash/status_area_host_aura.cc230
-rw-r--r--chrome/browser/ui/views/ash/status_area_host_aura.h86
-rw-r--r--chrome/browser/ui/views/ash/status_area_host_aura_browsertest.cc81
-rw-r--r--chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc10
-rw-r--r--chrome/chrome_browser.gypi30
-rw-r--r--chrome/chrome_tests.gypi2
68 files changed, 263 insertions, 5356 deletions
diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc
index aee314a5..340d8f6 100644
--- a/ash/ash_switches.cc
+++ b/ash/ash_switches.cc
@@ -7,9 +7,6 @@
namespace ash {
namespace switches {
-// Use the in-progress uber system tray.
-const char kDisableAshUberTray[] = "disable-ash-uber-tray";
-
// Enables the Oak tree viewer.
const char kAshEnableOak[] = "ash-enable-oak";
diff --git a/ash/shell.cc b/ash/shell.cc
index c11d268..036c00f 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -678,69 +678,57 @@ void Shell::Init() {
event_client_.reset(new internal::EventClientImpl(root_window));
- if (delegate_.get())
- status_widget_ = delegate_->CreateStatusArea();
-
CommandLine* command_line = CommandLine::ForCurrentProcess();
- if (!command_line->HasSwitch(switches::kDisableAshUberTray)) {
- // TODO(sad): This is rather ugly at the moment. This is because we are
- // supporting both the old and the new status bar at the same time. This
- // will soon get better once the new one is ready and the old one goes out
- // the door.
- tray_.reset(new SystemTray());
- if (status_widget_) {
- status_widget_->GetContentsView()->RemoveAllChildViews(false);
- status_widget_->GetContentsView()->AddChildView(tray_.get());
- }
- if (delegate_.get())
- tray_delegate_.reset(delegate_->CreateSystemTrayDelegate(tray_.get()));
- if (!tray_delegate_.get())
- tray_delegate_.reset(new DummySystemTrayDelegate());
-
- internal::TrayVolume* tray_volume = new internal::TrayVolume();
- internal::TrayBluetooth* tray_bluetooth = new internal::TrayBluetooth();
- internal::TrayBrightness* tray_brightness = new internal::TrayBrightness();
- internal::TrayDate* tray_date = new internal::TrayDate();
- internal::TrayPower* tray_power = new internal::TrayPower();
- internal::TrayNetwork* tray_network = new internal::TrayNetwork;
- internal::TrayUser* tray_user = new internal::TrayUser;
- internal::TrayAccessibility* tray_accessibility =
- new internal::TrayAccessibility;
- internal::TrayCapsLock* tray_caps_lock = new internal::TrayCapsLock;
- internal::TrayIME* tray_ime = new internal::TrayIME;
- internal::TrayUpdate* tray_update = new internal::TrayUpdate;
-
- tray_->accessibility_observer_ = tray_accessibility;
- tray_->audio_observer_ = tray_volume;
- tray_->bluetooth_observer_ = tray_bluetooth;
- tray_->brightness_observer_ = tray_brightness;
- tray_->caps_lock_observer_ = tray_caps_lock;
- tray_->clock_observer_ = tray_date;
- tray_->ime_observer_ = tray_ime;
- tray_->network_observer_ = tray_network;
- tray_->power_status_observer_ = tray_power;
- tray_->update_observer_ = tray_update;
- tray_->user_observer_ = tray_user;
-
- tray_->AddTrayItem(tray_user);
- tray_->AddTrayItem(new internal::TrayEmpty());
- tray_->AddTrayItem(tray_power);
- tray_->AddTrayItem(tray_network);
- tray_->AddTrayItem(tray_bluetooth);
- tray_->AddTrayItem(tray_ime);
- tray_->AddTrayItem(tray_volume);
- tray_->AddTrayItem(tray_brightness);
- tray_->AddTrayItem(tray_update);
- tray_->AddTrayItem(new internal::TraySettings());
- tray_->AddTrayItem(tray_accessibility);
- tray_->AddTrayItem(tray_caps_lock);
- tray_->AddTrayItem(tray_date);
-
- tray_->SetVisible(tray_delegate_->GetTrayVisibilityOnStartup());
- }
- if (!status_widget_)
- status_widget_ = internal::CreateStatusArea(tray_.get());
+ // TODO(sad): All of these initialization should happen in SystemTray.
+ tray_.reset(new SystemTray());
+ if (delegate_.get())
+ tray_delegate_.reset(delegate_->CreateSystemTrayDelegate(tray_.get()));
+ if (!tray_delegate_.get())
+ tray_delegate_.reset(new DummySystemTrayDelegate());
+
+ internal::TrayVolume* tray_volume = new internal::TrayVolume();
+ internal::TrayBluetooth* tray_bluetooth = new internal::TrayBluetooth();
+ internal::TrayBrightness* tray_brightness = new internal::TrayBrightness();
+ internal::TrayDate* tray_date = new internal::TrayDate();
+ internal::TrayPower* tray_power = new internal::TrayPower();
+ internal::TrayNetwork* tray_network = new internal::TrayNetwork;
+ internal::TrayUser* tray_user = new internal::TrayUser;
+ internal::TrayAccessibility* tray_accessibility =
+ new internal::TrayAccessibility;
+ internal::TrayCapsLock* tray_caps_lock = new internal::TrayCapsLock;
+ internal::TrayIME* tray_ime = new internal::TrayIME;
+ internal::TrayUpdate* tray_update = new internal::TrayUpdate;
+
+ tray_->accessibility_observer_ = tray_accessibility;
+ tray_->audio_observer_ = tray_volume;
+ tray_->bluetooth_observer_ = tray_bluetooth;
+ tray_->brightness_observer_ = tray_brightness;
+ tray_->caps_lock_observer_ = tray_caps_lock;
+ tray_->clock_observer_ = tray_date;
+ tray_->ime_observer_ = tray_ime;
+ tray_->network_observer_ = tray_network;
+ tray_->power_status_observer_ = tray_power;
+ tray_->update_observer_ = tray_update;
+ tray_->user_observer_ = tray_user;
+
+ tray_->AddTrayItem(tray_user);
+ tray_->AddTrayItem(new internal::TrayEmpty());
+ tray_->AddTrayItem(tray_power);
+ tray_->AddTrayItem(tray_network);
+ tray_->AddTrayItem(tray_bluetooth);
+ tray_->AddTrayItem(tray_ime);
+ tray_->AddTrayItem(tray_volume);
+ tray_->AddTrayItem(tray_brightness);
+ tray_->AddTrayItem(tray_update);
+ tray_->AddTrayItem(new internal::TraySettings());
+ tray_->AddTrayItem(tray_accessibility);
+ tray_->AddTrayItem(tray_caps_lock);
+ tray_->AddTrayItem(tray_date);
+ tray_->SetVisible(tray_delegate_->GetTrayVisibilityOnStartup());
+
+ // TODO(sad): Replace uses of status_widget_ with tray_->GetWidget().
+ status_widget_ = internal::CreateStatusArea(tray_.get());
// This controller needs to be set before SetupManagedWindowMode.
desktop_background_controller_.reset(new DesktopBackgroundController);
diff --git a/ash/shell/shell_delegate_impl.cc b/ash/shell/shell_delegate_impl.cc
index b736473..78e3325 100644
--- a/ash/shell/shell_delegate_impl.cc
+++ b/ash/shell/shell_delegate_impl.cc
@@ -30,10 +30,6 @@ void ShellDelegateImpl::SetWatcher(WindowWatcher* watcher) {
launcher_delegate_->set_watcher(watcher);
}
-views::Widget* ShellDelegateImpl::CreateStatusArea() {
- return NULL;
-}
-
bool ShellDelegateImpl::IsUserLoggedIn() {
return true;
}
diff --git a/ash/shell/shell_delegate_impl.h b/ash/shell/shell_delegate_impl.h
index 7698830..9c0e403 100644
--- a/ash/shell/shell_delegate_impl.h
+++ b/ash/shell/shell_delegate_impl.h
@@ -22,7 +22,6 @@ class ShellDelegateImpl : public ash::ShellDelegate {
void SetWatcher(WindowWatcher* watcher);
- virtual views::Widget* CreateStatusArea() OVERRIDE;
virtual bool IsUserLoggedIn() OVERRIDE;
virtual void LockScreen() OVERRIDE;
virtual void UnlockScreen() OVERRIDE;
diff --git a/ash/shell_delegate.h b/ash/shell_delegate.h
index e571471..813ed18 100644
--- a/ash/shell_delegate.h
+++ b/ash/shell_delegate.h
@@ -38,9 +38,6 @@ class ASH_EXPORT ShellDelegate {
// The Shell owns the delegate.
virtual ~ShellDelegate() {}
- // Invoked to create a new status area. Can return NULL.
- virtual views::Widget* CreateStatusArea() = 0;
-
// Returns true if user has logged in.
virtual bool IsUserLoggedIn() = 0;
diff --git a/ash/status_area/status_area_view.cc b/ash/status_area/status_area_view.cc
index 53ae934..3804cb7 100644
--- a/ash/status_area/status_area_view.cc
+++ b/ash/status_area/status_area_view.cc
@@ -15,16 +15,16 @@
#include "ui/gfx/canvas.h"
#include "ui/gfx/image/image.h"
#include "ui/views/accessible_pane_view.h"
+#include "ui/views/layout/fill_layout.h"
#include "ui/views/widget/widget.h"
namespace ash {
namespace internal {
StatusAreaView::StatusAreaView()
- : status_mock_(*ui::ResourceBundle::GetSharedInstance().GetImageNamed(
- IDR_AURA_STATUS_MOCK).ToSkBitmap()),
- focus_cycler_for_testing_(NULL) {
+ : focus_cycler_for_testing_(NULL) {
}
+
StatusAreaView::~StatusAreaView() {
}
@@ -32,8 +32,13 @@ void StatusAreaView::SetFocusCyclerForTesting(const FocusCycler* focus_cycler) {
focus_cycler_for_testing_ = focus_cycler;
}
-gfx::Size StatusAreaView::GetPreferredSize() {
- return gfx::Size(status_mock_.width(), status_mock_.height());
+bool StatusAreaView::AcceleratorPressed(const ui::Accelerator& accelerator) {
+ if (accelerator.key_code() == ui::VKEY_ESCAPE) {
+ RemovePaneFocus();
+ GetFocusManager()->ClearFocus();
+ return true;
+ }
+ return false;
}
views::Widget* StatusAreaView::GetWidget() {
@@ -60,10 +65,6 @@ void StatusAreaView::DeleteDelegate() {
delete this;
}
-void StatusAreaView::OnPaint(gfx::Canvas* canvas) {
- canvas->DrawBitmapInt(status_mock_, 0, 0);
-}
-
ASH_EXPORT views::Widget* CreateStatusArea(views::View* contents) {
StatusAreaView* status_area_view = new StatusAreaView;
if (!contents)
@@ -71,7 +72,7 @@ ASH_EXPORT views::Widget* CreateStatusArea(views::View* contents) {
views::Widget* widget = new views::Widget;
views::Widget::InitParams params(
views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
- gfx::Size ps = contents->GetPreferredSize();
+ gfx::Size ps = contents ? contents->GetPreferredSize() : gfx::Size(200, 29);
params.bounds = gfx::Rect(0, 0, ps.width(), ps.height());
params.delegate = status_area_view;
params.parent = Shell::GetInstance()->GetContainer(
@@ -85,6 +86,7 @@ ASH_EXPORT views::Widget* CreateStatusArea(views::View* contents) {
// longer be needed and we can nuke this.
views::AccessiblePaneView* accessible_pane =
new views::AccessiblePaneView;
+ accessible_pane->SetLayoutManager(new views::FillLayout);
accessible_pane->AddChildView(contents);
widget->set_focus_on_creation(false);
widget->SetContentsView(accessible_pane);
diff --git a/ash/status_area/status_area_view.h b/ash/status_area/status_area_view.h
index 613b8f1..3738da1 100644
--- a/ash/status_area/status_area_view.h
+++ b/ash/status_area/status_area_view.h
@@ -26,7 +26,7 @@ class ASH_EXPORT StatusAreaView : public views::WidgetDelegate,
void SetFocusCyclerForTesting(const FocusCycler* focus_cycler);
// Overridden from views::View:
- virtual gfx::Size GetPreferredSize() OVERRIDE;
+ virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
virtual views::Widget* GetWidget() OVERRIDE;
virtual const views::Widget* GetWidget() const OVERRIDE;
@@ -35,9 +35,6 @@ class ASH_EXPORT StatusAreaView : public views::WidgetDelegate,
virtual void DeleteDelegate() OVERRIDE;
private:
- virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
-
- SkBitmap status_mock_;
const FocusCycler* focus_cycler_for_testing_;
DISALLOW_COPY_AND_ASSIGN(StatusAreaView);
diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc
index 3489412..04469ab 100644
--- a/ash/test/test_shell_delegate.cc
+++ b/ash/test/test_shell_delegate.cc
@@ -21,10 +21,6 @@ TestShellDelegate::TestShellDelegate() : locked_(false) {
TestShellDelegate::~TestShellDelegate() {
}
-views::Widget* TestShellDelegate::CreateStatusArea() {
- return NULL;
-}
-
bool TestShellDelegate::IsUserLoggedIn() {
return true;
}
diff --git a/ash/test/test_shell_delegate.h b/ash/test/test_shell_delegate.h
index f822617..5d507c4 100644
--- a/ash/test/test_shell_delegate.h
+++ b/ash/test/test_shell_delegate.h
@@ -18,7 +18,6 @@ class TestShellDelegate : public ShellDelegate {
virtual ~TestShellDelegate();
// Overridden from ShellDelegate:
- virtual views::Widget* CreateStatusArea() OVERRIDE;
virtual bool IsUserLoggedIn() OVERRIDE;
virtual void LockScreen() OVERRIDE;
virtual void UnlockScreen() OVERRIDE;
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 9ac5805..66f85ee 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -601,13 +601,6 @@ const Experiment kExperiments[] = {
},
#if defined(USE_ASH)
{
- "disable-ash-uber-tray",
- IDS_FLAGS_DISABLE_ASH_UBER_TRAY_NAME,
- IDS_FLAGS_DISABLE_ASH_UBER_TRAY_DESCRIPTION,
- kOsAll,
- SINGLE_VALUE_TYPE(ash::switches::kDisableAshUberTray),
- },
- {
"enable-ash-oak",
IDS_FLAGS_ENABLE_ASH_OAK_NAME,
IDS_FLAGS_ENABLE_ASH_OAK_DESCRIPTION,
diff --git a/chrome/browser/chrome_browser_main_extra_parts_ash.cc b/chrome/browser/chrome_browser_main_extra_parts_ash.cc
index 698bbf65..c8870da 100644
--- a/chrome/browser/chrome_browser_main_extra_parts_ash.cc
+++ b/chrome/browser/chrome_browser_main_extra_parts_ash.cc
@@ -16,7 +16,6 @@
#include "chrome/browser/ui/views/ash/key_rewriter.h"
#include "chrome/browser/ui/views/ash/screen_orientation_listener.h"
#include "chrome/browser/ui/views/ash/screenshot_taker.h"
-#include "chrome/browser/ui/views/ash/status_area_host_aura.h"
#include "ui/aura/env.h"
#include "ui/aura/aura_switches.h"
#include "ui/aura/monitor_manager.h"
@@ -78,11 +77,6 @@ void ChromeBrowserMainExtraPartsAsh::PreProfileInit() {
}
void ChromeBrowserMainExtraPartsAsh::PostProfileInit() {
- // Add the status area buttons after Profile has been initialized.
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- ash::switches::kDisableAshUberTray)) {
- ChromeShellDelegate::instance()->status_area_host()->AddButtons();
- }
}
void ChromeBrowserMainExtraPartsAsh::PostMainMessageLoopRun() {
diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
index 25e5eb2..7e0123a 100644
--- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
+++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
@@ -41,7 +41,6 @@
#include "chrome/browser/chromeos/power/resume_observer.h"
#include "chrome/browser/chromeos/power/screen_lock_observer.h"
#include "chrome/browser/chromeos/power/video_property_writer.h"
-#include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
#include "chrome/browser/chromeos/system/statistics_provider.h"
#include "chrome/browser/chromeos/system_key_event_listener.h"
#include "chrome/browser/chromeos/upgrade_detector_chromeos.h"
@@ -358,10 +357,6 @@ void ChromeBrowserMainPartsChromeos::PreProfileInit() {
chrome::NOTIFICATION_SESSION_STARTED,
content::NotificationService::AllSources(),
content::NotificationService::NoDetails());
- } else if (parsed_command_line().HasSwitch(switches::kLoginManager)) {
- // Initialize status area mode early on.
- chromeos::StatusAreaViewChromeos::
- SetScreenMode(chromeos::StatusAreaViewChromeos::LOGIN_MODE_WEBUI);
}
// In Aura builds this will initialize ash::Shell.
diff --git a/chrome/browser/chromeos/input_method/input_method_util.cc b/chrome/browser/chromeos/input_method/input_method_util.cc
index 5df029b..fc2f880 100644
--- a/chrome/browser/chromeos/input_method/input_method_util.cc
+++ b/chrome/browser/chromeos/input_method/input_method_util.cc
@@ -15,6 +15,7 @@
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/chromeos/input_method/input_method_manager.h"
#include "chrome/browser/chromeos/language_preferences.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/pref_names.h"
@@ -61,6 +62,13 @@ const struct {
const size_t kMappingFromIdToIndicatorTextLen =
ARRAYSIZE_UNSAFE(kMappingFromIdToIndicatorText);
+
+string16 GetLanguageName(const std::string& language_code) {
+ const string16 language_name = l10n_util::GetDisplayNameForLocale(
+ language_code, g_browser_process->GetApplicationLocale(), true);
+ return language_name;
+}
+
}
namespace chromeos {
@@ -411,6 +419,40 @@ string16 InputMethodUtil::GetInputMethodShortName(
return text;
}
+string16 InputMethodUtil::GetInputMethodLongName(
+ const InputMethodDescriptor& input_method) const {
+ if (!input_method.name().empty()) {
+ // If the descriptor has a name, use it.
+ return UTF8ToUTF16(input_method.name());
+ }
+
+ // We don't show language here. Name of keyboard layout or input method
+ // usually imply (or explicitly include) its language.
+
+ input_method::InputMethodManager* manager =
+ input_method::InputMethodManager::GetInstance();
+
+ // Special case for German, French and Dutch: these languages have multiple
+ // keyboard layouts and share the same layout of keyboard (Belgian). We need
+ // to show explicitly the language for the layout. For Arabic, Amharic, and
+ // Indic languages: they share "Standard Input Method".
+ const string16 standard_input_method_text = l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_LANGUAGES_M17N_STANDARD_INPUT_METHOD);
+ const std::string language_code = input_method.language_code();
+
+ string16 text =
+ manager->GetInputMethodUtil()->TranslateString(input_method.id());
+ if (text == standard_input_method_text ||
+ language_code == "de" ||
+ language_code == "fr" ||
+ language_code == "nl") {
+ text = GetLanguageName(language_code) + UTF8ToUTF16(" - ") + text;
+ }
+
+ DCHECK(!text.empty());
+ return text;
+}
+
const InputMethodDescriptor* InputMethodUtil::GetInputMethodDescriptorFromId(
const std::string& input_method_id) const {
InputMethodIdToDescriptorMap::const_iterator iter
diff --git a/chrome/browser/chromeos/input_method/input_method_util.h b/chrome/browser/chromeos/input_method/input_method_util.h
index 22018fe..f5bb31b 100644
--- a/chrome/browser/chromeos/input_method/input_method_util.h
+++ b/chrome/browser/chromeos/input_method/input_method_util.h
@@ -74,6 +74,7 @@ class InputMethodUtil {
string16 GetInputMethodShortName(
const InputMethodDescriptor& input_method) const;
+ string16 GetInputMethodLongName(const InputMethodDescriptor& ime) const;
// Converts an input method ID to an input method descriptor. Returns NULL
// when |input_method_id| is unknown.
diff --git a/chrome/browser/chromeos/input_method/input_method_util_unittest.cc b/chrome/browser/chromeos/input_method/input_method_util_unittest.cc
index 91bf4f4..61331fd 100644
--- a/chrome/browser/chromeos/input_method/input_method_util_unittest.cc
+++ b/chrome/browser/chromeos/input_method/input_method_util_unittest.cc
@@ -8,6 +8,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/utf_string_conversions.h"
+#include "chrome/browser/chromeos/input_method/input_method_manager.h"
#include "chrome/browser/chromeos/input_method/input_method_whitelist.h"
#include "grit/generated_resources.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -173,6 +174,112 @@ TEST_F(InputMethodUtilTest, GetInputMethodShortNameTest) {
}
}
+TEST_F(InputMethodUtilTest, GetInputMethodLongNameTest) {
+ scoped_ptr<IBusController> controller(IBusController::Create());
+
+ // For most languages input method or keyboard layout name is returned.
+ // See below for exceptions.
+ {
+ InputMethodDescriptor desc =
+ GetDesc(controller.get(), "m17n:fa:isiri", "us", "fa");
+ EXPECT_EQ(ASCIIToUTF16("Persian input method (ISIRI 2901 layout)"),
+ util_.GetInputMethodLongName(desc));
+ }
+ {
+ InputMethodDescriptor desc =
+ GetDesc(controller.get(), "mozc-hangul", "us", "ko");
+ EXPECT_EQ(ASCIIToUTF16("Korean input method"),
+ util_.GetInputMethodLongName(desc));
+ }
+ {
+ InputMethodDescriptor desc =
+ GetDesc(controller.get(), "m17n:vi:tcvn", "us", "vi");
+ EXPECT_EQ(ASCIIToUTF16("Vietnamese input method (TCVN6064)"),
+ util_.GetInputMethodLongName(desc));
+ }
+ {
+ InputMethodDescriptor desc = GetDesc(controller.get(), "mozc", "us", "ja");
+#if !defined(GOOGLE_CHROME_BUILD)
+ EXPECT_EQ(ASCIIToUTF16("Japanese input method (for US keyboard)"),
+#else
+ EXPECT_EQ(ASCIIToUTF16("Google Japanese Input (for US keyboard)"),
+#endif // defined(GOOGLE_CHROME_BUILD)
+ util_.GetInputMethodLongName(desc));
+ }
+ {
+ InputMethodDescriptor desc =
+ GetDesc(controller.get(), "xkb:jp::jpn", "jp", "ja");
+ EXPECT_EQ(ASCIIToUTF16("Japanese keyboard"),
+ util_.GetInputMethodLongName(desc));
+ }
+ {
+ InputMethodDescriptor desc =
+ GetDesc(controller.get(), "xkb:us:dvorak:eng", "us(dvorak)", "en-US");
+ EXPECT_EQ(ASCIIToUTF16("US Dvorak keyboard"),
+ util_.GetInputMethodLongName(desc));
+ }
+ {
+ InputMethodDescriptor desc =
+ GetDesc(controller.get(), "xkb:gb:dvorak:eng", "gb(dvorak)", "en-US");
+ EXPECT_EQ(ASCIIToUTF16("UK Dvorak keyboard"),
+ util_.GetInputMethodLongName(desc));
+ }
+
+ // For Arabic, Dutch, French, German and Hindi,
+ // "language - keyboard layout" pair is returned.
+ {
+ InputMethodDescriptor desc =
+ GetDesc(controller.get(), "m17n:ar:kbd", "us", "ar");
+ EXPECT_EQ(ASCIIToUTF16("Arabic - Standard input method"),
+ util_.GetInputMethodLongName(desc));
+ }
+ {
+ InputMethodDescriptor desc =
+ GetDesc(controller.get(), "xkb:be::nld", "be", "nl");
+ EXPECT_EQ(ASCIIToUTF16("Dutch - Belgian keyboard"),
+ util_.GetInputMethodLongName(desc));
+ }
+ {
+ InputMethodDescriptor desc =
+ GetDesc(controller.get(), "xkb:fr::fra", "fr", "fr");
+ EXPECT_EQ(ASCIIToUTF16("French - French keyboard"),
+ util_.GetInputMethodLongName(desc));
+ }
+ {
+ InputMethodDescriptor desc =
+ GetDesc(controller.get(), "xkb:be::fra", "be", "fr");
+ EXPECT_EQ(ASCIIToUTF16("French - Belgian keyboard"),
+ util_.GetInputMethodLongName(desc));
+ }
+ {
+ InputMethodDescriptor desc =
+ GetDesc(controller.get(), "xkb:de::ger", "de", "de");
+ EXPECT_EQ(ASCIIToUTF16("German - German keyboard"),
+ util_.GetInputMethodLongName(desc));
+ }
+ {
+ InputMethodDescriptor desc =
+ GetDesc(controller.get(), "xkb:be::ger", "be", "de");
+ EXPECT_EQ(ASCIIToUTF16("German - Belgian keyboard"),
+ util_.GetInputMethodLongName(desc));
+ }
+ {
+ InputMethodDescriptor desc =
+ GetDesc(controller.get(), "m17n:hi:itrans", "us", "hi");
+ EXPECT_EQ(ASCIIToUTF16("Hindi - Standard input method"),
+ util_.GetInputMethodLongName(desc));
+ }
+
+ {
+ InputMethodDescriptor desc =
+ GetDesc(controller.get(), "invalid-id", "us", "xx");
+ // You can safely ignore the "Resouce ID is not found for: invalid-id"
+ // error.
+ EXPECT_EQ(ASCIIToUTF16("invalid-id"),
+ util_.GetInputMethodLongName(desc));
+ }
+}
+
TEST_F(InputMethodUtilTest, TestGetStringUTF8) {
EXPECT_EQ(UTF8ToUTF16("Pinyin input method"),
util_.TranslateString("pinyin"));
diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc
index 49fd7b0..61553a8 100644
--- a/chrome/browser/chromeos/login/existing_user_controller.cc
+++ b/chrome/browser/chromeos/login/existing_user_controller.cc
@@ -334,7 +334,6 @@ void ExistingUserController::Login(const std::string& username,
const std::string& password) {
if (username.empty() || password.empty())
return;
- SetStatusAreaEnabled(false);
// Disable clicking on other windows.
login_display_->SetUIEnabled(false);
@@ -370,7 +369,6 @@ void ExistingUserController::Login(const std::string& username,
}
void ExistingUserController::LoginAsDemoUser() {
- SetStatusAreaEnabled(false);
// Disable clicking on other windows.
login_display_->SetUIEnabled(false);
// TODO(rkc): Add a CHECK to make sure demo logins are allowed once
@@ -388,7 +386,6 @@ void ExistingUserController::LoginAsDemoUser() {
void ExistingUserController::LoginAsGuest() {
- SetStatusAreaEnabled(false);
// Disable clicking on other windows.
login_display_->SetUIEnabled(false);
@@ -505,7 +502,6 @@ void ExistingUserController::OnLoginFailure(const LoginFailure& failure) {
}
// Reenable clicking on other windows and status area.
login_display_->SetUIEnabled(true);
- SetStatusAreaEnabled(true);
}
if (login_status_consumer_)
@@ -636,7 +632,6 @@ void ExistingUserController::WhiteListCheckFailed(const std::string& email) {
// Reenable clicking on other windows and status area.
login_display_->SetUIEnabled(true);
- SetStatusAreaEnabled(true);
display_email_.clear();
}
@@ -747,12 +742,6 @@ void ExistingUserController::InitializeStartUrls() const {
CommandLine::ForCurrentProcess()->AppendArg(start_urls[i]);
}
-void ExistingUserController::SetStatusAreaEnabled(bool enable) {
- if (!host_)
- return;
- host_->SetStatusAreaEnabled(enable);
-}
-
void ExistingUserController::ShowError(int error_id,
const std::string& details) {
// TODO(dpolukhin): show detailed error info. |details| string contains
@@ -791,7 +780,6 @@ void ExistingUserController::ShowGaiaPasswordChanged(
User::OAUTH_TOKEN_STATUS_INVALID);
login_display_->SetUIEnabled(true);
- SetStatusAreaEnabled(true);
login_display_->ShowGaiaPasswordChanged(username);
}
diff --git a/chrome/browser/chromeos/login/existing_user_controller.h b/chrome/browser/chromeos/login/existing_user_controller.h
index ba0c5ed..85c616b 100644
--- a/chrome/browser/chromeos/login/existing_user_controller.h
+++ b/chrome/browser/chromeos/login/existing_user_controller.h
@@ -133,9 +133,6 @@ class ExistingUserController : public LoginDisplay::Delegate,
// Adds first-time login URLs.
void InitializeStartUrls() const;
- // Changes state of the status area. During login operation it's disabled.
- void SetStatusAreaEnabled(bool enable);
-
// Show error message. |error_id| error message ID in resources.
// If |details| string is not empty, it specify additional error text
// provided by authenticator, it is not localized.
diff --git a/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc b/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc
index 3dcd077..598f964 100644
--- a/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc
+++ b/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc
@@ -80,7 +80,6 @@ class MockLoginDisplayHost : public LoginDisplayHost {
MOCK_METHOD0(OpenProxySettings, void(void));
MOCK_METHOD1(SetOobeProgressBarVisible, void(bool));
MOCK_METHOD1(SetShutdownButtonEnabled, void(bool));
- MOCK_METHOD1(SetStatusAreaEnabled, void(bool));
MOCK_METHOD1(SetStatusAreaVisible, void(bool));
MOCK_METHOD0(ShowBackground, void(void));
MOCK_METHOD0(CheckForAutoEnrollment, void(void));
@@ -217,8 +216,6 @@ scoped_refptr<Authenticator> CreateAuthenticatorNewUser(
}
IN_PROC_BROWSER_TEST_F(ExistingUserControllerTest, ExistingUserLogin) {
- EXPECT_CALL(*mock_login_display_host_, SetStatusAreaEnabled(false))
- .Times(1);
EXPECT_CALL(*mock_login_display_, SetUIEnabled(false))
.Times(1);
EXPECT_CALL(*mock_login_utils_, CreateAuthenticator(_))
diff --git a/chrome/browser/chromeos/login/login_display_host.h b/chrome/browser/chromeos/login/login_display_host.h
index 90c1eb2..fd3aee1 100644
--- a/chrome/browser/chromeos/login/login_display_host.h
+++ b/chrome/browser/chromeos/login/login_display_host.h
@@ -53,9 +53,6 @@ class LoginDisplayHost {
// Enable/disable shutdown button.
virtual void SetShutdownButtonEnabled(bool enable) = 0;
- // Toggles whether status area is enabled.
- virtual void SetStatusAreaEnabled(bool enable) = 0;
-
// Toggles status area visibility.
virtual void SetStatusAreaVisible(bool visible) = 0;
diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc
index 4d18886..4ee9013 100644
--- a/chrome/browser/chromeos/login/login_utils.cc
+++ b/chrome/browser/chromeos/login/login_utils.cc
@@ -39,7 +39,6 @@
#include "chrome/browser/chromeos/login/parallel_authenticator.h"
#include "chrome/browser/chromeos/login/screen_locker.h"
#include "chrome/browser/chromeos/login/user_manager.h"
-#include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/net/chrome_url_request_context.h"
@@ -706,13 +705,8 @@ void LoginUtilsImpl::DoBrowserLaunch(Profile* profile,
if (browser_shutdown::IsTryingToQuit())
return;
- StatusAreaViewChromeos::SetScreenMode(StatusAreaViewChromeos::BROWSER_MODE);
- if (login_host) {
- // Enable status area now as the login window may be destructed anytime
- // after LaunchBrowser.
+ if (login_host)
login_host->SetStatusAreaVisible(true);
- login_host->SetStatusAreaEnabled(true);
- }
BootTimesLoader::Get()->AddLoginTimeMarker("BrowserLaunched", false);
@@ -1070,7 +1064,6 @@ std::string LoginUtilsImpl::GetOffTheRecordCommandLine(
switches::kFlingTapSuppressMaxDown,
switches::kFlingTapSuppressMaxGap,
switches::kTouchDevices,
- ash::switches::kDisableAshUberTray,
ash::switches::kAuraLegacyPowerButton,
ash::switches::kAuraNoShadows,
ash::switches::kAuraPanelManager,
diff --git a/chrome/browser/chromeos/login/webui_login_display_host.cc b/chrome/browser/chromeos/login/webui_login_display_host.cc
index 5704e60..ea3edca 100644
--- a/chrome/browser/chromeos/login/webui_login_display_host.cc
+++ b/chrome/browser/chromeos/login/webui_login_display_host.cc
@@ -78,11 +78,6 @@ void WebUILoginDisplayHost::SetOobeProgressBarVisible(bool visible) {
void WebUILoginDisplayHost::SetShutdownButtonEnabled(bool enable) {
}
-void WebUILoginDisplayHost::SetStatusAreaEnabled(bool enable) {
- if (login_view_)
- login_view_->SetStatusAreaEnabled(enable);
-}
-
void WebUILoginDisplayHost::SetStatusAreaVisible(bool visible) {
if (login_view_)
login_view_->SetStatusAreaVisible(visible);
diff --git a/chrome/browser/chromeos/login/webui_login_display_host.h b/chrome/browser/chromeos/login/webui_login_display_host.h
index 6b66367..7b66fdb 100644
--- a/chrome/browser/chromeos/login/webui_login_display_host.h
+++ b/chrome/browser/chromeos/login/webui_login_display_host.h
@@ -35,7 +35,6 @@ class WebUILoginDisplayHost : public BaseLoginDisplayHost {
virtual void OpenProxySettings() OVERRIDE;
virtual void SetOobeProgressBarVisible(bool visible) OVERRIDE;
virtual void SetShutdownButtonEnabled(bool enable) OVERRIDE;
- virtual void SetStatusAreaEnabled(bool enable) OVERRIDE;
virtual void SetStatusAreaVisible(bool visible) OVERRIDE;
virtual void StartWizard(const std::string& first_screen_name,
DictionaryValue* screen_parameters) OVERRIDE;
diff --git a/chrome/browser/chromeos/login/webui_login_view.cc b/chrome/browser/chromeos/login/webui_login_view.cc
index de289ef..78ba39b 100644
--- a/chrome/browser/chromeos/login/webui_login_view.cc
+++ b/chrome/browser/chromeos/login/webui_login_view.cc
@@ -15,7 +15,6 @@
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/login/proxy_settings_dialog.h"
#include "chrome/browser/chromeos/login/webui_login_display.h"
-#include "chrome/browser/chromeos/status/status_area_view.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/views/ash/chrome_shell_delegate.h"
#include "chrome/browser/ui/views/dom_view.h"
@@ -108,18 +107,12 @@ void RightAlignedView::ChildPreferredSizeChanged(View* child) {
namespace chromeos {
-// static
-const int WebUILoginView::kStatusAreaCornerPadding = 5;
-
// WebUILoginView public: ------------------------------------------------------
WebUILoginView::WebUILoginView()
- : status_area_(NULL),
- webui_login_(NULL),
+ : webui_login_(NULL),
login_window_(NULL),
- status_window_(NULL),
host_window_frozen_(false),
- status_area_visibility_on_init_(true),
login_page_is_loaded_(false),
should_emit_login_prompt_visible_(true) {
@@ -160,10 +153,6 @@ WebUILoginView::~WebUILoginView() {
ash::SystemTray* tray = ash::Shell::GetInstance()->tray();
if (tray)
tray->SetNextFocusableView(NULL);
-
- if (status_window_)
- status_window_->CloseNow();
- status_window_ = NULL;
}
void WebUILoginView::Init(views::Widget* login_window) {
@@ -227,11 +216,6 @@ void WebUILoginView::OpenProxySettings() {
dialog->Show();
}
-void WebUILoginView::SetStatusAreaEnabled(bool enable) {
- if (status_area_)
- status_area_->MakeButtonsActive(enable);
-}
-
void WebUILoginView::SetStatusAreaVisible(bool visible) {
ash::SystemTray* tray = ash::Shell::GetInstance()->tray();
if (tray) {
@@ -240,10 +224,6 @@ void WebUILoginView::SetStatusAreaVisible(bool visible) {
else
tray->GetWidget()->Hide();
}
- if (status_area_)
- status_area_->SetVisible(visible);
- else
- status_area_visibility_on_init_ = visible;
}
// WebUILoginView protected: ---------------------------------------------------
@@ -268,30 +248,6 @@ void WebUILoginView::AboutToRequestFocusFromTabTraversal(bool reverse) {
GetWidget()->Activate();
}
-// Overridden from StatusAreaButton::Delegate:
-
-bool WebUILoginView::ShouldExecuteStatusAreaCommand(
- const views::View* button_view, int command_id) const {
- if (command_id == StatusAreaButton::Delegate::SHOW_NETWORK_OPTIONS)
- return true;
- return false;
-}
-
-void WebUILoginView::ExecuteStatusAreaCommand(
- const views::View* button_view, int command_id) {
- if (command_id == StatusAreaButton::Delegate::SHOW_NETWORK_OPTIONS)
- OpenProxySettings();
-}
-
-StatusAreaButton::TextStyle WebUILoginView::GetStatusAreaTextStyle() const {
- return StatusAreaButton::GRAY_PLAIN_LIGHT;
-}
-
-void WebUILoginView::ButtonVisibilityChanged(views::View* button_view) {
- if (status_area_)
- status_area_->UpdateButtonVisibility();
-}
-
void WebUILoginView::OnRenderHostCreated(RenderViewHost* host) {
new SnifferObserver(host, GetWebUI());
}
@@ -307,11 +263,6 @@ void WebUILoginView::OnTabMainFrameRender() {
VLOG(1) << "WebUI login main frame rendered.";
tab_watcher_.reset();
- StatusAreaViewChromeos::SetScreenMode(GetScreenMode());
- // In aura there's a global status area shown already.
- status_area_ = ChromeShellDelegate::instance()->GetStatusArea();
- status_area_->SetVisible(status_area_visibility_on_init_);
-
if (should_emit_login_prompt_visible_) {
chromeos::DBusThreadManager::Get()->GetSessionManagerClient()->
EmitLoginPromptVisible();
@@ -323,50 +274,6 @@ void WebUILoginView::OnTabMainFrameRender() {
oobe_ui->OnLoginPromptVisible();
}
-void WebUILoginView::InitStatusArea() {
- DCHECK(status_area_ == NULL);
- DCHECK(status_window_ == NULL);
- StatusAreaViewChromeos* status_area_chromeos = new StatusAreaViewChromeos();
- status_area_chromeos->Init(this);
- status_area_ = status_area_chromeos;
- status_area_->SetVisible(status_area_visibility_on_init_);
-
- // Width of |status_window| is meant to be large enough.
- // The current value of status_area_->GetPreferredSize().width()
- // will be too small when button status is changed.
- // (e.g. when CapsLock indicator appears)
- gfx::Size widget_size(width()/2,
- status_area_->GetPreferredSize().height());
- const int widget_x = base::i18n::IsRTL() ?
- kStatusAreaCornerPadding :
- width() - widget_size.width() - kStatusAreaCornerPadding;
- gfx::Rect widget_bounds(widget_x, kStatusAreaCornerPadding,
- widget_size.width(), widget_size.height());
- // TODO(nkostylev|oshima): Make status area in the same window as
- // |webui_login_| once RenderWidgetHostViewViews and compositor are
- // ready. This will also avoid having to override the status area
- // widget type for the lock screen.
- views::Widget::InitParams widget_params(GetStatusAreaWidgetType());
- widget_params.bounds = widget_bounds;
- widget_params.transparent = true;
- widget_params.parent_widget = login_window_;
- status_window_ = new views::Widget;
- status_window_->Init(widget_params);
-
- views::View* contents_view = new RightAlignedView;
- contents_view->AddChildView(status_area_);
- status_window_->SetContentsView(contents_view);
- status_window_->Show();
-}
-
-StatusAreaViewChromeos::ScreenMode WebUILoginView::GetScreenMode() {
- return StatusAreaViewChromeos::LOGIN_MODE_WEBUI;
-}
-
-views::Widget::InitParams::Type WebUILoginView::GetStatusAreaWidgetType() {
- return views::Widget::InitParams::TYPE_WINDOW_FRAMELESS;
-}
-
void WebUILoginView::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
@@ -413,17 +320,6 @@ bool WebUILoginView::IsPopupOrPanel(const WebContents* source) const {
}
bool WebUILoginView::TakeFocus(bool reverse) {
- if (status_area_ && status_area_->visible()) {
- // Forward the focus to the status area.
- base::Callback<void(bool)> return_focus_cb =
- base::Bind(&WebUILoginView::ReturnFocus, base::Unretained(this));
- status_area_->TakeFocus(reverse, return_focus_cb);
- status_area_->GetWidget()->Activate();
-
- ash::SystemTray* tray = ash::Shell::GetInstance()->tray();
- if (tray)
- tray->SetNextFocusableView(this);
- }
return true;
}
diff --git a/chrome/browser/chromeos/login/webui_login_view.h b/chrome/browser/chromeos/login/webui_login_view.h
index 6ac38b4..c17f6e5 100644
--- a/chrome/browser/chromeos/login/webui_login_view.h
+++ b/chrome/browser/chromeos/login/webui_login_view.h
@@ -10,8 +10,6 @@
#include <string>
#include "chrome/browser/chromeos/login/login_html_dialog.h"
-#include "chrome/browser/chromeos/status/status_area_button.h"
-#include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
#include "chrome/browser/tab_render_watcher.h"
#include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h"
#include "content/public/browser/notification_observer.h"
@@ -22,7 +20,6 @@
class DOMView;
class GURL;
-class StatusAreaView;
namespace content {
class WebUI;
@@ -36,16 +33,12 @@ class Widget;
namespace chromeos {
// 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.
+// WebUI based start up and lock screens. It contains a DOMView.
class WebUILoginView : public views::WidgetDelegateView,
- public StatusAreaButton::Delegate,
public content::WebContentsDelegate,
public content::NotificationObserver,
public TabRenderWatcher::Delegate {
public:
- static const int kStatusAreaCornerPadding;
-
WebUILoginView();
virtual ~WebUILoginView();
@@ -76,9 +69,6 @@ class WebUILoginView : public views::WidgetDelegateView,
// Opens proxy settings dialog.
void OpenProxySettings();
- // Toggles whether status area is enabled.
- void SetStatusAreaEnabled(bool enable);
-
// Toggles status area visibility.
void SetStatusAreaVisible(bool visible);
@@ -94,35 +84,16 @@ class WebUILoginView : public views::WidgetDelegateView,
virtual void ChildPreferredSizeChanged(View* child) OVERRIDE;
virtual void AboutToRequestFocusFromTabTraversal(bool reverse) 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 StatusAreaButton::TextStyle GetStatusAreaTextStyle() const OVERRIDE;
- virtual void ButtonVisibilityChanged(views::View* button_view) OVERRIDE;
-
// TabRenderWatcher::Delegate implementation.
virtual void OnRenderHostCreated(content::RenderViewHost* host) OVERRIDE;
virtual void OnTabMainFrameLoaded() OVERRIDE;
virtual void OnTabMainFrameRender() OVERRIDE;
- // Creates and adds the status area (separate window).
- virtual void InitStatusArea();
-
- // Returns the screen mode to set on the status area view.
- virtual StatusAreaViewChromeos::ScreenMode GetScreenMode();
-
- // Returns the type to use for the status area widget.
- virtual views::Widget::InitParams::Type GetStatusAreaWidgetType();
-
// Overridden from content::NotificationObserver.
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
- StatusAreaView* status_area_;
-
// DOMView for rendering a webpage as a webui login.
DOMView* webui_login_;
@@ -148,11 +119,6 @@ class WebUILoginView : public views::WidgetDelegateView,
// Login window which shows the view.
views::Widget* login_window_;
- // Window that contains status area.
- // TODO(nkostylev): Temporary solution till we have
- // RenderWidgetHostViewViews working.
- views::Widget* status_window_;
-
// Converts keyboard events on the TabContents to accelerators.
UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_;
@@ -165,9 +131,6 @@ class WebUILoginView : public views::WidgetDelegateView,
// Whether the host window is frozen.
bool host_window_frozen_;
- // Caches StatusArea visibility setting before it has been initialized.
- bool status_area_visibility_on_init_;
-
// Has the login page told us that it's ready? This is triggered by either
// all of the user images or the GAIA prompt being loaded, whichever comes
// first.
diff --git a/chrome/browser/chromeos/login/webui_screen_locker.cc b/chrome/browser/chromeos/login/webui_screen_locker.cc
index 36dbb14b..9f8e7c2 100644
--- a/chrome/browser/chromeos/login/webui_screen_locker.cc
+++ b/chrome/browser/chromeos/login/webui_screen_locker.cc
@@ -13,7 +13,6 @@
#include "chrome/browser/chromeos/login/screen_locker.h"
#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/chromeos/login/webui_login_display.h"
-#include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
#include "chrome/browser/ui/views/dom_view.h"
#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
#include "chrome/common/chrome_notification_types.h"
@@ -85,7 +84,6 @@ void WebUIScreenLocker::OnAuthenticate() {
void WebUIScreenLocker::SetInputEnabled(bool enabled) {
login_display_->SetUIEnabled(enabled);
- SetStatusAreaEnabled(enabled);
}
void WebUIScreenLocker::ShowErrorMessage(
@@ -113,12 +111,6 @@ WebUIScreenLocker::~WebUIScreenLocker() {
static_cast<OobeUI*>(GetWebUI()->GetController())->
ResetSigninScreenHandlerDelegate();
}
- // WebUILoginView::OnTabMainFrameFirstRender sets the screen mode to
- // WebUIScreenLocker::GetScreenMode() = SCREEN_LOCKER_MODE. We need to reset
- // the screen mode when the lock screen is hidden here.
- chromeos::StatusAreaViewChromeos::SetScreenMode(
- chromeos::StatusAreaViewChromeos::BROWSER_MODE);
- SetStatusAreaEnabled(true);
}
////////////////////////////////////////////////////////////////////////////////
@@ -199,15 +191,4 @@ void WebUIScreenLocker::OnLockWindowReady() {
ScreenLockReady();
}
-////////////////////////////////////////////////////////////////////////////////
-// Overridden from WebUILoginView:
-
-StatusAreaViewChromeos::ScreenMode WebUIScreenLocker::GetScreenMode() {
- return StatusAreaViewChromeos::SCREEN_LOCKER_MODE;
-}
-
-views::Widget::InitParams::Type WebUIScreenLocker::GetStatusAreaWidgetType() {
- return views::Widget::InitParams::TYPE_POPUP;
-}
-
} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/webui_screen_locker.h b/chrome/browser/chromeos/login/webui_screen_locker.h
index b8ec8d6..3eac6ca 100644
--- a/chrome/browser/chromeos/login/webui_screen_locker.h
+++ b/chrome/browser/chromeos/login/webui_screen_locker.h
@@ -69,10 +69,6 @@ class WebUIScreenLocker : public WebUILoginView,
// LockWindow::Observer implementation.
virtual void OnLockWindowReady() OVERRIDE;
- // Overridden from WebUILoginView.
- virtual StatusAreaViewChromeos::ScreenMode GetScreenMode() OVERRIDE;
- virtual views::Widget::InitParams::Type GetStatusAreaWidgetType() OVERRIDE;
-
private:
friend class test::WebUIScreenLockerTester;
diff --git a/chrome/browser/chromeos/status/accessibility_menu_button.cc b/chrome/browser/chromeos/status/accessibility_menu_button.cc
deleted file mode 100644
index 3e00a5a..0000000
--- a/chrome/browser/chromeos/status/accessibility_menu_button.cc
+++ /dev/null
@@ -1,136 +0,0 @@
-// Copyright (c) 2012 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/accessibility_menu_button.h"
-
-#include "base/utf_string_conversions.h"
-#include "chrome/browser/browser_process.h"
-#include "chrome/browser/chromeos/accessibility/accessibility_util.h"
-#include "chrome/browser/chromeos/status/status_area_bubble.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_notification_types.h"
-#include "chrome/common/pref_names.h"
-#include "content/public/browser/notification_details.h"
-#include "grit/generated_resources.h"
-#include "grit/theme_resources.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/gfx/image/image.h"
-#include "ui/views/controls/image_view.h"
-#include "ui/views/controls/menu/menu_item_view.h"
-#include "ui/views/controls/menu/menu_runner.h"
-#include "ui/views/widget/widget.h"
-
-namespace {
-
-enum MenuItemID {
- MENU_ITEM_DISABLE_SPOKEN_FEEDBACK,
-};
-
-} // namespace
-
-namespace chromeos {
-
-////////////////////////////////////////////////////////////////////////////////
-// AccessibilityMenuButton
-
-AccessibilityMenuButton::AccessibilityMenuButton(
- StatusAreaButton::Delegate* delegate)
- : StatusAreaButton(delegate, this) {
- set_id(VIEW_ID_STATUS_BUTTON_ACCESSIBILITY);
- accessibility_enabled_.Init(prefs::kSpokenFeedbackEnabled,
- g_browser_process->local_state(), this);
- SetIcon(*ResourceBundle::GetSharedInstance().GetBitmapNamed(
- IDR_STATUSBAR_ACCESSIBILITY));
- Update();
-}
-
-AccessibilityMenuButton::~AccessibilityMenuButton() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// views::MenuButtonListener implementation:
-
-void AccessibilityMenuButton::OnMenuButtonClicked(views::View* source,
- const gfx::Point& point) {
- PrepareMenu();
-
- gfx::Point screen_location;
- views::View::ConvertPointToScreen(source, &screen_location);
- gfx::Rect bounds(screen_location, source->size());
- CHECK(menu_runner_->RunMenuAt(source->GetWidget()->GetTopLevelWidget(),
- this, bounds, views::MenuItemView::TOPRIGHT,
- 0) == views::MenuRunner::NORMAL_EXIT);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// views::MenuDelegate implementation
-
-void AccessibilityMenuButton::ExecuteCommand(int id) {
- switch (id) {
- case MENU_ITEM_DISABLE_SPOKEN_FEEDBACK:
- accessibility::EnableSpokenFeedback(false, NULL);
- break;
- default:
- NOTREACHED();
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// content::NotificationObserver implementation
-
-void AccessibilityMenuButton::Observe(
- int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- if (type == chrome::NOTIFICATION_PREF_CHANGED) {
- Update();
- const std::string path =
- *static_cast<content::Details<std::string> >(details).ptr();
- // Show a bubble when accessibility is turned on at the login screen.
- if (path == prefs::kSpokenFeedbackEnabled) {
- if (accessibility_enabled_.GetValue() &&
- StatusAreaViewChromeos::IsLoginMode()) {
- views::ImageView* icon_view = new views::ImageView;
- const gfx::Image& image = ResourceBundle::GetSharedInstance().
- GetImageNamed(IDR_ACCESSIBILITY_ICON);
- icon_view->SetImage(image.ToSkBitmap());
- bubble_controller_.reset(
- StatusAreaBubbleController::ShowBubbleUnderViewForAWhile(
- this,
- new StatusAreaBubbleContentView(
- icon_view,
- l10n_util::GetStringUTF16(
- IDS_STATUSBAR_ACCESSIBILITY_TURNED_ON_BUBBLE))));
- } else {
- bubble_controller_.reset();
- }
- }
- }
-}
-
-
-void AccessibilityMenuButton::Update() {
- // Update tooltip and accessibile name.
- string16 message =
- l10n_util::GetStringUTF16(IDS_STATUSBAR_ACCESSIBILITY_ENABLED);
- SetTooltipText(message);
- SetAccessibleName(message);
- // Update visibility.
- SetVisible(accessibility_enabled_.GetValue());
-}
-
-void AccessibilityMenuButton::PrepareMenu() {
- views::MenuItemView* menu = new views::MenuItemView(this);
- if (accessibility_enabled_.GetValue())
- menu->AppendMenuItemWithLabel(
- MENU_ITEM_DISABLE_SPOKEN_FEEDBACK,
- l10n_util::GetStringUTF16(IDS_STATUSBAR_DISABLE_SPOKEN_FEEDBACK));
- // |menu_runner_| takes the ownership of |menu|
- menu_runner_.reset(new views::MenuRunner(menu));
-}
-
-} // namespace chromeos
diff --git a/chrome/browser/chromeos/status/accessibility_menu_button.h b/chrome/browser/chromeos/status/accessibility_menu_button.h
deleted file mode 100644
index 54f19eb..0000000
--- a/chrome/browser/chromeos/status/accessibility_menu_button.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (c) 2012 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_ACCESSIBILITY_MENU_BUTTON_H_
-#define CHROME_BROWSER_CHROMEOS_STATUS_ACCESSIBILITY_MENU_BUTTON_H_
-#pragma once
-
-#include "chrome/browser/chromeos/status/status_area_button.h"
-#include "chrome/browser/prefs/pref_member.h"
-#include "content/public/browser/notification_observer.h"
-#include "ui/views/controls/button/menu_button_listener.h"
-#include "ui/views/controls/menu/menu_delegate.h"
-
-namespace views {
-class MenuRunner;
-}
-
-namespace chromeos {
-
-class StatusAreaBubbleController;
-
-// A class for the button in the status area which alerts the user when
-// accessibility features are enabled.
-class AccessibilityMenuButton : public StatusAreaButton,
- public views::MenuButtonListener,
- public views::MenuDelegate,
- public content::NotificationObserver {
- public:
- explicit AccessibilityMenuButton(StatusAreaButton::Delegate* delegate);
- virtual ~AccessibilityMenuButton();
-
- // Overridden from views::MenuButtonListener:
- virtual void OnMenuButtonClicked(views::View* source,
- const gfx::Point& point) OVERRIDE;
-
- // Overridden from views::MenuDelegate:
- virtual void ExecuteCommand(int id) OVERRIDE;
-
- // content::NotificationObserver implementation
- virtual void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) OVERRIDE;
-
- private:
- // Updates the state along with the preferences.
- void Update();
-
- // Prepares menu before showing it.
- void PrepareMenu();
-
- // An object synced to the preference, representing if accessibility feature
- // is enabled or not.
- BooleanPrefMember accessibility_enabled_;
- // An object to show menu.
- scoped_ptr<views::MenuRunner> menu_runner_;
- // The currently showing bubble controller.
- scoped_ptr<StatusAreaBubbleController> bubble_controller_;
-
- DISALLOW_COPY_AND_ASSIGN(AccessibilityMenuButton);
-};
-
-} // namespace chromeos
-
-#endif // CHROME_BROWSER_CHROMEOS_STATUS_ACCESSIBILITY_MENU_BUTTON_H_
diff --git a/chrome/browser/chromeos/status/caps_lock_menu_button.cc b/chrome/browser/chromeos/status/caps_lock_menu_button.cc
deleted file mode 100644
index 3d69e92..0000000
--- a/chrome/browser/chromeos/status/caps_lock_menu_button.cc
+++ /dev/null
@@ -1,291 +0,0 @@
-// Copyright (c) 2012 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/caps_lock_menu_button.h"
-
-#include <string>
-
-#include "base/chromeos/chromeos_version.h"
-#include "base/utf_string_conversions.h"
-#include "chrome/browser/chromeos/input_method/input_method_manager.h"
-#include "chrome/browser/chromeos/input_method/xkeyboard.h"
-#include "chrome/browser/chromeos/login/screen_locker.h"
-#include "chrome/browser/chromeos/status/status_area_bubble.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_manager.h"
-#include "chrome/common/chrome_notification_types.h"
-#include "chrome/common/pref_names.h"
-#include "content/public/browser/notification_service.h"
-#include "grit/generated_resources.h"
-#include "grit/theme_resources.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/gfx/image/image.h"
-#include "ui/views/controls/image_view.h"
-#include "ui/views/controls/menu/menu_item_view.h"
-#include "ui/views/controls/menu/menu_runner.h"
-#include "ui/views/controls/menu/submenu_view.h"
-#include "ui/views/widget/widget.h"
-
-namespace {
-
-const size_t kMaxBubbleCount = 3;
-
-PrefService* GetPrefService() {
- Profile* profile = ProfileManager::GetDefaultProfile();
- if (profile)
- return profile->GetPrefs();
- return NULL;
-}
-
-views::ImageView* CreateImageViewWithCapsLockIcon() {
- const gfx::Image& image =
- ResourceBundle::GetSharedInstance().GetImageNamed(IDR_CAPS_LOCK_ICON);
- views::ImageView* image_view = new views::ImageView;
- image_view->SetImage(image.ToSkBitmap());
- return image_view;
-}
-
-} // namespace
-
-namespace chromeos {
-
-////////////////////////////////////////////////////////////////////////////////
-// CapsLockMenuButton
-
-CapsLockMenuButton::CapsLockMenuButton(StatusAreaButton::Delegate* delegate)
- : StatusAreaButton(delegate, this),
- initialized_prefs_(false),
- status_(NULL),
- should_show_bubble_(true),
- bubble_count_(0) {
- set_id(VIEW_ID_STATUS_BUTTON_CAPS_LOCK);
-
- if (StatusAreaViewChromeos::IsBrowserMode())
- InitializePrefMember();
-
- SetIcon(*ResourceBundle::GetSharedInstance().GetBitmapNamed(
- IDR_STATUSBAR_CAPS_LOCK));
- UpdateAccessibleName();
-
- input_method::InputMethodManager* ime_manager =
- input_method::InputMethodManager::GetInstance();
- UpdateUIFromCurrentCapsLock(ime_manager->GetXKeyboard()->CapsLockIsEnabled());
-
- // Status bar should be initialized after SystemKeyEventListener on the
- // device. SystemKeyEventListener is never initialized on chrome for cros
- // running on linux.
- DCHECK(SystemKeyEventListener::GetInstance() ||
- !base::chromeos::IsRunningOnChromeOS());
- if (SystemKeyEventListener::GetInstance())
- SystemKeyEventListener::GetInstance()->AddCapsLockObserver(this);
-
-#if defined(USE_ASH)
- if (StatusAreaViewChromeos::IsLoginMode()) {
- // See comments in InputMethodMenu::InputMethodMenu().
- registrar_.Add(this,
- chrome::NOTIFICATION_SESSION_STARTED,
- content::NotificationService::AllSources());
- }
-#endif
-}
-
-CapsLockMenuButton::~CapsLockMenuButton() {
- if (SystemKeyEventListener::GetInstance())
- SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// views::View implementation:
-
-void CapsLockMenuButton::OnLocaleChanged() {
- input_method::InputMethodManager* ime_manager =
- input_method::InputMethodManager::GetInstance();
- UpdateUIFromCurrentCapsLock(ime_manager->GetXKeyboard()->CapsLockIsEnabled());
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// views::MenuDelegate implementation:
-
-string16 CapsLockMenuButton::GetLabel(int id) const {
- return string16();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// views::MenuButtonListener implementation:
-
-void CapsLockMenuButton::OnMenuButtonClicked(views::View* source,
- const gfx::Point& point) {
- static const int kDummyCommandId = 1000;
-
- if (IsBubbleShown())
- HideBubble();
-
- views::MenuItemView* menu = new views::MenuItemView(this);
- // MenuRunner takes ownership of |menu|.
- menu_runner_.reset(new views::MenuRunner(menu));
- views::MenuItemView* submenu = menu->AppendMenuItem(
- kDummyCommandId,
- string16(),
- views::MenuItemView::NORMAL);
- status_ = new StatusAreaBubbleContentView(CreateImageViewWithCapsLockIcon(),
- GetText());
- submenu->AddChildView(status_);
- menu->CreateSubmenu()->set_resize_open_menu(true);
- menu->SetMargins(0, 0);
- submenu->SetMargins(0, 0);
- menu->ChildrenChanged();
-
- gfx::Point screen_location;
- views::View::ConvertPointToScreen(source, &screen_location);
- gfx::Rect bounds(screen_location, source->size());
- if (menu_runner_->RunMenuAt(
- source->GetWidget()->GetTopLevelWidget(), this, bounds,
- views::MenuItemView::TOPRIGHT, views::MenuRunner::HAS_MNEMONICS) ==
- views::MenuRunner::MENU_DELETED)
- return;
- status_ = NULL;
- menu_runner_.reset(NULL);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// SystemKeyEventListener::CapsLockObserver implementation
-
-void CapsLockMenuButton::OnCapsLockChange(bool enabled) {
- if (!enabled && !HasCapsLock() && bubble_count_ > 0) {
- // Both shift keys are pressed. We can assume that the user now recognizes
- // how to turn off Caps Lock.
- should_show_bubble_ = false;
- }
-
- // Update the indicator.
- UpdateUIFromCurrentCapsLock(enabled);
-
- // Update the drop-down menu and bubble. Since the constructor also calls
- // UpdateUIFromCurrentCapsLock, we shouldn't do this in the function.
- if (enabled && IsMenuShown()) {
- // Update the drop-down menu if it's already shown.
- status_->SetMessage(GetText());
- } else if (!enabled && IsMenuShown()) {
- HideMenu();
- }
- if (enabled)
- MaybeShowBubble();
- else if (!enabled && IsBubbleShown())
- HideBubble();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// content::NotificationObserver implementation
-
-void CapsLockMenuButton::Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- switch (type) {
- case chrome::NOTIFICATION_PREF_CHANGED:
- UpdateAccessibleName();
- break;
- case chrome::NOTIFICATION_SESSION_STARTED:
- InitializePrefMember();
- break;
- }
-}
-
-void CapsLockMenuButton::UpdateAccessibleName() {
- int id = IDS_STATUSBAR_CAPS_LOCK_ENABLED_PRESS_SHIFT_AND_SEARCH_KEYS;
- if (HasCapsLock())
- id = IDS_STATUSBAR_CAPS_LOCK_ENABLED_PRESS_SEARCH;
- SetAccessibleName(l10n_util::GetStringUTF16(id));
-}
-
-string16 CapsLockMenuButton::GetText() const {
- int id = IDS_STATUSBAR_CAPS_LOCK_ENABLED_PRESS_SHIFT_AND_SEARCH_KEYS;
- if (HasCapsLock())
- id = IDS_STATUSBAR_CAPS_LOCK_ENABLED_PRESS_SEARCH;
- return l10n_util::GetStringUTF16(id);
-}
-
-void CapsLockMenuButton::UpdateUIFromCurrentCapsLock(bool enabled) {
- SetVisible(enabled);
- SchedulePaint();
-}
-
-bool CapsLockMenuButton::IsMenuShown() const {
- return menu_runner_.get() && status_;
-}
-
-void CapsLockMenuButton::HideMenu() {
- if (!IsMenuShown())
- return;
- menu_runner_->Cancel();
-}
-
-bool CapsLockMenuButton::IsBubbleShown() const {
- return bubble_controller_.get() && bubble_controller_->IsBubbleShown();
-}
-
-void CapsLockMenuButton::MaybeShowBubble() {
- if (IsBubbleShown() ||
- // We've already shown the bubble |kMaxBubbleCount| times.
- !should_show_bubble_ ||
- // Don't show the bubble when Caps Lock key is available.
- HasCapsLock() ||
- // Don't show it when the status area is hidden.
- (parent() && !parent()->visible()) ||
- // Don't show the bubble when screen is locked as this results in two
- // visible caps lock bubbles (crbug.com/105280). The greater problem of
- // displaying bubbles from all caps lock menu buttons regardless of
- // visibility is described in crbug.com/106776.
- ScreenLocker::default_screen_locker())
- return;
-
- ++bubble_count_;
- if (bubble_count_ > kMaxBubbleCount) {
- should_show_bubble_ = false;
- } else {
- CreateAndShowBubble();
- }
-}
-
-void CapsLockMenuButton::CreateAndShowBubble() {
- if (IsBubbleShown()) {
- NOTREACHED();
- return;
- }
- bubble_controller_.reset(
- StatusAreaBubbleController::ShowBubbleUnderViewForAWhile(
- this,
- new StatusAreaBubbleContentView(CreateImageViewWithCapsLockIcon(),
- GetText())));
-}
-
-void CapsLockMenuButton::HideBubble() {
- bubble_controller_.reset();
-}
-
-bool CapsLockMenuButton::HasCapsLock() const {
- // A keyboard for Linux usually has Caps Lock.
- if (!base::chromeos::IsRunningOnChromeOS())
- return true;
- // On the login screen, Caps Lock is not available.
- if (!initialized_prefs_)
- return false;
-
- return remap_search_key_to_.GetValue() == input_method::kCapsLockKey;
-}
-
-void CapsLockMenuButton::InitializePrefMember() {
- if (!initialized_prefs_) {
- PrefService* prefs = GetPrefService();
- if (prefs) {
- initialized_prefs_ = true;
- remap_search_key_to_.Init(
- prefs::kLanguageXkbRemapSearchKeyTo, prefs, this);
- }
- }
-}
-
-} // namespace chromeos
diff --git a/chrome/browser/chromeos/status/caps_lock_menu_button.h b/chrome/browser/chromeos/status/caps_lock_menu_button.h
deleted file mode 100644
index 9e3f0ec..0000000
--- a/chrome/browser/chromeos/status/caps_lock_menu_button.h
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright (c) 2012 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_CAPS_LOCK_MENU_BUTTON_H_
-#define CHROME_BROWSER_CHROMEOS_STATUS_CAPS_LOCK_MENU_BUTTON_H_
-#pragma once
-
-#include <string>
-
-#include "base/compiler_specific.h"
-#include "base/timer.h"
-#include "chrome/browser/chromeos/status/status_area_button.h"
-#include "chrome/browser/chromeos/system_key_event_listener.h"
-#include "chrome/browser/prefs/pref_member.h"
-#include "content/public/browser/notification_observer.h"
-#include "content/public/browser/notification_registrar.h"
-#include "ui/views/controls/button/menu_button_listener.h"
-#include "ui/views/controls/menu/menu_delegate.h"
-
-class Bubble;
-
-namespace views {
-class MenuRunner;
-}
-
-namespace chromeos {
-
-class StatusAreaBubbleContentView;
-class StatusAreaBubbleController;
-
-// A class for the button in the status area which alerts the user when caps
-// lock is active.
-class CapsLockMenuButton : public content::NotificationObserver,
- public StatusAreaButton,
- public views::MenuDelegate,
- public views::MenuButtonListener,
- public SystemKeyEventListener::CapsLockObserver {
- public:
- explicit CapsLockMenuButton(StatusAreaButton::Delegate* delegate);
- virtual ~CapsLockMenuButton();
-
- // views::View implementation.
- virtual void OnLocaleChanged() OVERRIDE;
-
- // views::MenuDelegate implementation.
- virtual string16 GetLabel(int id) const OVERRIDE;
-
- // views::MenuButtonListener implementation.
- virtual void OnMenuButtonClicked(views::View* source,
- const gfx::Point& point) OVERRIDE;
-
- // SystemKeyEventListener::CapsLockObserver implementation
- virtual void OnCapsLockChange(bool enabled) OVERRIDE;
-
- // content::NotificationObserver implementation
- virtual void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) OVERRIDE;
-
- private:
- // Returns true if the Search key is assigned to Caps Lock.
- bool HasCapsLock() const;
-
- bool IsMenuShown() const;
- void HideMenu();
-
- bool IsBubbleShown() const;
- void MaybeShowBubble();
- void CreateAndShowBubble();
- void HideBubble();
-
- // Updates the accessible name.
- void UpdateAccessibleName();
-
- // Gets the text for the drop-down menu and bubble.
- string16 GetText() const;
-
- // Updates the button from the current state.
- void UpdateUIFromCurrentCapsLock(bool enabled);
-
- // Initializes |remap_search_key_to_|.
- void InitializePrefMember();
-
- bool initialized_prefs_;
- content::NotificationRegistrar registrar_;
-
- IntegerPrefMember remap_search_key_to_;
-
- // The currently showing status view. NULL if menu is not being displayed.
- StatusAreaBubbleContentView* status_;
- // If non-null the menu is showing.
- scoped_ptr<views::MenuRunner> menu_runner_;
-
- // The currently showing bubble controller.
- // NULL if bubble is not being displayed.
- scoped_ptr<StatusAreaBubbleController> bubble_controller_;
- // If true, |bubble_| is shown when both shift keys are pressed.
- bool should_show_bubble_;
- // # of times |bubble_| is shown.
- size_t bubble_count_;
- // TODO(yusukes): Save should_show_bubble_ and bubble_count_ in Preferences.
-
- DISALLOW_COPY_AND_ASSIGN(CapsLockMenuButton);
-};
-
-} // namespace chromeos
-
-#endif // CHROME_BROWSER_CHROMEOS_STATUS_CAPS_LOCK_MENU_BUTTON_H_
diff --git a/chrome/browser/chromeos/status/clock_menu_button.cc b/chrome/browser/chromeos/status/clock_menu_button.cc
deleted file mode 100644
index 41904ab..0000000
--- a/chrome/browser/chromeos/status/clock_menu_button.cc
+++ /dev/null
@@ -1,208 +0,0 @@
-// Copyright (c) 2012 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.
-
-// Note: this file is used by Aura on all platforms, even though it is currently
-// in a chromeos specific location.
-
-#include "chrome/browser/chromeos/status/clock_menu_button.h"
-
-#include "base/basictypes.h"
-#include "base/i18n/time_formatting.h"
-#include "base/string_util.h"
-#include "base/time.h"
-#include "base/utf_string_conversions.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_manager.h"
-#include "chrome/common/chrome_notification_types.h"
-#include "chrome/common/pref_names.h"
-#include "content/public/browser/notification_details.h"
-#include "content/public/browser/notification_source.h"
-#include "grit/generated_resources.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/gfx/canvas.h"
-#include "ui/gfx/font.h"
-#include "ui/views/controls/menu/menu_runner.h"
-#include "ui/views/widget/widget.h"
-#include "unicode/datefmt.h"
-
-namespace {
-
-// views::MenuItemView item ids
-enum ClockMenuItem {
- CLOCK_DISPLAY_ITEM,
- CLOCK_OPEN_OPTIONS_ITEM
-};
-
-} // namespace
-
-// Amount of slop to add into the timer to make sure we're into the next minute
-// when the timer goes off.
-const int kTimerSlopSeconds = 1;
-
-ClockMenuButton::ClockMenuButton(StatusAreaButton::Delegate* delegate)
- : StatusAreaButton(delegate, this),
- pref_service_(NULL),
- use_24hour_clock_(false) {
- set_id(VIEW_ID_STATUS_BUTTON_CLOCK);
- UpdateProfile();
- UpdateTextAndSetNextTimer();
-}
-
-ClockMenuButton::~ClockMenuButton() {
- timer_.Stop();
-}
-
-void ClockMenuButton::UpdateProfile() {
-#if defined(OS_CHROMEOS) // See note at top of file
- // Start monitoring the kUse24HourClock preference.
- Profile* profile = ProfileManager::GetDefaultProfile();
- if (profile && profile->GetPrefs() != pref_service_) {
- pref_service_ = profile->GetPrefs();
- use_24hour_clock_ = pref_service_->GetBoolean(prefs::kUse24HourClock);
- registrar_.reset(new PrefChangeRegistrar);
- registrar_->Init(pref_service_);
- registrar_->Add(prefs::kUse24HourClock, this);
- UpdateText();
- }
-#endif
-}
-
-void ClockMenuButton::UpdateTextAndSetNextTimer() {
- UpdateText();
-
- // Try to set the timer to go off at the next change of the minute. We don't
- // want to have the timer go off more than necessary since that will cause
- // the CPU to wake up and consume power.
- base::Time now = base::Time::Now();
- base::Time::Exploded exploded;
- now.LocalExplode(&exploded);
-
- // Often this will be called at minute boundaries, and we'll actually want
- // 60 seconds from now.
- int seconds_left = 60 - exploded.second;
- if (seconds_left == 0)
- seconds_left = 60;
-
- // Make sure that the timer fires on the next minute. Without this, if it is
- // called just a teeny bit early, then it will skip the next minute.
- seconds_left += kTimerSlopSeconds;
-
- timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(seconds_left), this,
- &ClockMenuButton::UpdateTextAndSetNextTimer);
-}
-
-void ClockMenuButton::UpdateText() {
- base::Time time(base::Time::Now());
- SetText(base::TimeFormatTimeOfDayWithHourClockType(
- time,
- use_24hour_clock_ ? base::k24HourClock : base::k12HourClock,
- base::kDropAmPm));
- SetTooltipText(base::TimeFormatFriendlyDate(time));
- SetAccessibleName(base::TimeFormatFriendlyDateAndTime(time));
- SchedulePaint();
-}
-
-void ClockMenuButton::SetUse24HourClock(bool use_24hour_clock) {
- if (use_24hour_clock_ == use_24hour_clock)
- return;
- use_24hour_clock_ = use_24hour_clock;
- UpdateText();
-}
-
-// ClockMenuButton, content::NotificationObserver implementation:
-
-void ClockMenuButton::Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
-#if defined(OS_CHROMEOS) // See note at top of file
- if (type == chrome::NOTIFICATION_PREF_CHANGED) {
- std::string* pref_name = content::Details<std::string>(details).ptr();
- if (*pref_name == prefs::kUse24HourClock) {
- Profile* profile = ProfileManager::GetDefaultProfile();
- if (profile) {
- SetUse24HourClock(
- profile->GetPrefs()->GetBoolean(prefs::kUse24HourClock));
- }
- }
- }
-#endif
-}
-
-// ClockMenuButton, views::MenuDelegate implementation:
-string16 ClockMenuButton::GetLabel(int id) const {
- DCHECK_EQ(CLOCK_DISPLAY_ITEM, id);
- return base::TimeFormatFriendlyDate(base::Time::Now());
-}
-
-bool ClockMenuButton::IsCommandEnabled(int id) const {
- DCHECK(id == CLOCK_DISPLAY_ITEM || id == CLOCK_OPEN_OPTIONS_ITEM);
- return id == CLOCK_OPEN_OPTIONS_ITEM;
-}
-
-void ClockMenuButton::ExecuteCommand(int id) {
- DCHECK_EQ(CLOCK_OPEN_OPTIONS_ITEM, id);
- delegate()->ExecuteStatusAreaCommand(
- this, StatusAreaButton::Delegate::SHOW_DATE_OPTIONS);
-}
-
-// StatusAreaButton implementation
-void ClockMenuButton::SetMenuActive(bool active) {
- // Activation gets updated when we change login state, so profile may change.
- if (active)
- UpdateProfile();
- StatusAreaButton::SetMenuActive(active);
-}
-
-int ClockMenuButton::horizontal_padding() {
- return 3;
-}
-
-// ClockMenuButton, views::MenuButtonListener implementation:
-
-void ClockMenuButton::OnMenuButtonClicked(views::View* source,
- const gfx::Point& point) {
- // View passed in must be a views::MenuButton, i.e. the ClockMenuButton.
- DCHECK_EQ(source, this);
-
- scoped_ptr<views::MenuRunner> menu_runner(CreateMenu());
-
- gfx::Point screen_location;
- views::View::ConvertPointToScreen(source, &screen_location);
- gfx::Rect bounds(screen_location, source->size());
- ignore_result(menu_runner->RunMenuAt(
- source->GetWidget()->GetTopLevelWidget(),
- this,
- bounds,
- views::MenuItemView::TOPRIGHT,
- views::MenuRunner::HAS_MNEMONICS));
-}
-
-// ClockMenuButton, views::View implementation:
-
-void ClockMenuButton::OnLocaleChanged() {
- UpdateText();
-}
-
-views::MenuRunner* ClockMenuButton::CreateMenu() {
- views::MenuItemView* menu = new views::MenuItemView(this);
- // menu_runner takes ownership of menu.
- views::MenuRunner* menu_runner = new views::MenuRunner(menu);
-
- // Text for this item will be set by GetLabel().
- menu->AppendDelegateMenuItem(CLOCK_DISPLAY_ITEM);
-
- // If options UI is available, show a separator and configure menu item.
- if (delegate()->ShouldExecuteStatusAreaCommand(
- this, StatusAreaButton::Delegate::SHOW_DATE_OPTIONS)) {
- menu->AppendSeparator();
-
- const string16 clock_open_options_label =
- l10n_util::GetStringUTF16(IDS_STATUSBAR_CLOCK_OPEN_OPTIONS_DIALOG);
- menu->AppendMenuItemWithLabel(CLOCK_OPEN_OPTIONS_ITEM,
- clock_open_options_label);
- }
- return menu_runner;
-}
diff --git a/chrome/browser/chromeos/status/clock_menu_button.h b/chrome/browser/chromeos/status/clock_menu_button.h
deleted file mode 100644
index 3561bbb..0000000
--- a/chrome/browser/chromeos/status/clock_menu_button.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright (c) 2012 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_CLOCK_MENU_BUTTON_H_
-#define CHROME_BROWSER_CHROMEOS_STATUS_CLOCK_MENU_BUTTON_H_
-#pragma once
-
-#include "base/compiler_specific.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/timer.h"
-#include "chrome/browser/chromeos/status/status_area_button.h"
-#include "chrome/browser/prefs/pref_change_registrar.h"
-#include "chrome/browser/prefs/pref_member.h"
-#include "content/public/browser/notification_observer.h"
-#include "content/public/browser/notification_types.h"
-#include "ui/views/controls/button/menu_button.h"
-#include "ui/views/controls/button/menu_button_listener.h"
-#include "ui/views/controls/menu/menu_delegate.h"
-#include "unicode/calendar.h"
-
-namespace views {
-class MenuRunner;
-}
-
-// The clock menu button in the status area.
-// This button shows the current time.
-class ClockMenuButton : public StatusAreaButton,
- public views::MenuDelegate,
- public views::MenuButtonListener,
- public content::NotificationObserver {
- public:
- explicit ClockMenuButton(StatusAreaButton::Delegate* delegate);
- virtual ~ClockMenuButton();
-
- // content::NotificationObserver implementation.
- virtual void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) OVERRIDE;
-
- // views::MenuDelegate implementation
- virtual string16 GetLabel(int id) const OVERRIDE;
- virtual bool IsCommandEnabled(int id) const OVERRIDE;
- virtual void ExecuteCommand(int id) OVERRIDE;
-
- // Initialize PrefChangeRegistrar with the current default profile.
- void UpdateProfile();
-
- // Updates the time on the menu button.
- void UpdateText();
-
- protected:
- // StatusAreaButton implementation
- virtual void SetMenuActive(bool active) OVERRIDE;
- virtual int horizontal_padding() OVERRIDE;
-
- // views::View implementation
- virtual void OnLocaleChanged() OVERRIDE;
-
- // views::MenuButtonListener implementation.
- virtual void OnMenuButtonClicked(views::View* source,
- const gfx::Point& point) OVERRIDE;
-
- private:
- // Sets default use 24hour clock mode.
- void SetUse24HourClock(bool use_24hour_clock);
-
- // Create menu and return menu runner.
- views::MenuRunner* CreateMenu();
-
- // Updates text and schedules the timer to fire at the next minute interval.
- void UpdateTextAndSetNextTimer();
-
- base::OneShotTimer<ClockMenuButton> timer_;
- PrefService* pref_service_;
- scoped_ptr<PrefChangeRegistrar> registrar_;
-
- // Cached value for use_24hour_clock.
- bool use_24hour_clock_;
-
- DISALLOW_COPY_AND_ASSIGN(ClockMenuButton);
-};
-
-#endif // CHROME_BROWSER_CHROMEOS_STATUS_CLOCK_MENU_BUTTON_H_
diff --git a/chrome/browser/chromeos/status/clock_updater.cc b/chrome/browser/chromeos/status/clock_updater.cc
deleted file mode 100644
index 26ac9c2..0000000
--- a/chrome/browser/chromeos/status/clock_updater.cc
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2012 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/clock_updater.h"
-
-#include "chrome/browser/chromeos/status/clock_menu_button.h"
-#include "chrome/browser/chromeos/system/timezone_settings.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-
-ClockUpdater::ClockUpdater(ClockMenuButton* button)
- : button_(button) {
- chromeos::system::TimezoneSettings::GetInstance()->AddObserver(this);
- chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
- AddObserver(this);
-}
-
-ClockUpdater::~ClockUpdater() {
- chromeos::system::TimezoneSettings::GetInstance()->RemoveObserver(this);
- chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
- RemoveObserver(this);
-}
-
-void ClockUpdater::TimezoneChanged(const icu::TimeZone& timezone) {
- button_->UpdateText();
-}
-
-void ClockUpdater::SystemResumed() {
- button_->UpdateText();
-}
diff --git a/chrome/browser/chromeos/status/clock_updater.h b/chrome/browser/chromeos/status/clock_updater.h
deleted file mode 100644
index db75ea2..0000000
--- a/chrome/browser/chromeos/status/clock_updater.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (c) 2012 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_CLOCK_UPDATER_H_
-#define CHROME_BROWSER_CHROMEOS_STATUS_CLOCK_UPDATER_H_
-#pragma once
-
-#include "chrome/browser/chromeos/system/timezone_settings.h"
-#include "chromeos/dbus/power_manager_client.h"
-
-class ClockMenuButton;
-
-// ClockUpdater is responsible for updating a ClockMenuButton when:
-// 1. the timezone changes.
-// 2. the system resumes from sleep.
-class ClockUpdater : public chromeos::system::TimezoneSettings::Observer,
- public chromeos::PowerManagerClient::Observer {
- public:
- explicit ClockUpdater(ClockMenuButton* button);
- virtual ~ClockUpdater();
-
- // TimezoneSettings::Observer overrides:
- virtual void TimezoneChanged(const icu::TimeZone& timezone) OVERRIDE;
-
- // PowerManagerClient::Observer overrides:
- virtual void SystemResumed() OVERRIDE;
-
- private:
- ClockMenuButton* button_;
-
- DISALLOW_COPY_AND_ASSIGN(ClockUpdater);
-};
-
-#endif // CHROME_BROWSER_CHROMEOS_STATUS_CLOCK_UPDATER_H_
diff --git a/chrome/browser/chromeos/status/data_promo_notification.cc b/chrome/browser/chromeos/status/data_promo_notification.cc
index 73f5566..553336c 100644
--- a/chrome/browser/chromeos/status/data_promo_notification.cc
+++ b/chrome/browser/chromeos/status/data_promo_notification.cc
@@ -12,7 +12,6 @@
#include "chrome/browser/chromeos/login/message_bubble.h"
#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/chromeos/mobile_config.h"
-#include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -126,6 +125,11 @@ DataPromoNotification::~DataPromoNotification() {
mobile_data_bubble_->GetWidget()->Close();
}
+void DataPromoNotification::RegisterPrefs(PrefService* local_state) {
+ // Carrier deal notification shown count defaults to 0.
+ local_state->RegisterIntegerPref(prefs::kCarrierDealPromoShown, 0);
+}
+
void DataPromoNotification::ShowOptionalMobileDataPromoNotification(
NetworkLibrary* cros,
views::View* host,
@@ -133,7 +137,7 @@ void DataPromoNotification::ShowOptionalMobileDataPromoNotification(
// Display one-time notification for non-Guest users on first use
// of Mobile Data connection or if there's a carrier deal defined
// show that even if user has already seen generic promo.
- if (StatusAreaViewChromeos::IsBrowserMode() &&
+ if (UserManager::Get()->IsUserLoggedIn() &&
!UserManager::Get()->IsLoggedInAsGuest() &&
check_for_promo_ &&
cros->cellular_connected() && !cros->ethernet_connected() &&
diff --git a/chrome/browser/chromeos/status/data_promo_notification.h b/chrome/browser/chromeos/status/data_promo_notification.h
index e41efdd..5e3c79e 100644
--- a/chrome/browser/chromeos/status/data_promo_notification.h
+++ b/chrome/browser/chromeos/status/data_promo_notification.h
@@ -10,6 +10,8 @@
#include "base/memory/weak_ptr.h"
#include "ui/views/widget/widget.h"
+class PrefService;
+
namespace views {
class View;
} // namespace views
@@ -24,6 +26,8 @@ class DataPromoNotification : public views::Widget::Observer {
DataPromoNotification();
virtual ~DataPromoNotification();
+ static void RegisterPrefs(PrefService* local_state);
+
const std::string& deal_info_url() const { return deal_info_url_; }
const std::string& deal_topup_url() const { return deal_topup_url_; }
diff --git a/chrome/browser/chromeos/status/input_method_menu.cc b/chrome/browser/chromeos/status/input_method_menu.cc
deleted file mode 100644
index 886458c..0000000
--- a/chrome/browser/chromeos/status/input_method_menu.cc
+++ /dev/null
@@ -1,537 +0,0 @@
-// Copyright (c) 2012 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/input_method_menu.h"
-
-#include <string>
-#include <vector>
-
-#include "base/string_split.h"
-#include "base/string_util.h"
-#include "base/time.h"
-#include "base/utf_string_conversions.h"
-#include "chrome/browser/browser_process.h"
-#include "chrome/browser/chromeos/input_method/input_method_util.h"
-#include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
-#include "content/public/browser/user_metrics.h"
-#include "grit/generated_resources.h"
-#include "grit/theme_resources.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/models/simple_menu_model.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/views/controls/menu/menu_model_adapter.h"
-#include "ui/views/controls/menu/menu_runner.h"
-#include "ui/views/controls/menu/submenu_view.h"
-#include "ui/views/widget/widget.h"
-
-using content::UserMetricsAction;
-
-// The language menu consists of 3 parts (in this order):
-//
-// (1) input method names. The size of the list is always >= 1.
-// (2) input method properties. This list might be empty.
-// (3) "Customize language and input..." button.
-//
-// Example of the menu (Japanese):
-//
-// ============================== (border of the popup window)
-// [ ] English (|index| in the following functions is 0)
-// [*] Japanese
-// [ ] Chinese (Simplified)
-// ------------------------------ (separator)
-// [*] Hiragana (index = 5, The property has 2 radio groups)
-// [ ] Katakana
-// [ ] HalfWidthKatakana
-// [*] Roman
-// [ ] Kana
-// ------------------------------ (separator)
-// Customize language and input...(index = 11)
-// ============================== (border of the popup window)
-//
-// Example of the menu (Simplified Chinese):
-//
-// ============================== (border of the popup window)
-// [ ] English
-// [ ] Japanese
-// [*] Chinese (Simplified)
-// ------------------------------ (separator)
-// Switch to full letter mode (The property has 2 command buttons)
-// Switch to half punctuation mode
-// ------------------------------ (separator)
-// Customize language and input...
-// ============================== (border of the popup window)
-//
-
-namespace {
-
-// Constants to specify the type of items in |model_|.
-enum {
- COMMAND_ID_INPUT_METHODS = 0, // English, Chinese, Japanese, Arabic, ...
- COMMAND_ID_IME_PROPERTIES, // Hiragana, Katakana, ...
- COMMAND_ID_CUSTOMIZE_LANGUAGE, // "Customize language and input..." button.
-};
-
-// A group ID for IME properties starts from 0. We use the huge value for the
-// input method list to avoid conflict.
-const int kRadioGroupLanguage = 1 << 16;
-const int kRadioGroupNone = -1;
-
-// Returns the language name for the given |language_code|.
-string16 GetLanguageName(const std::string& language_code) {
- const string16 language_name = l10n_util::GetDisplayNameForLocale(
- language_code, g_browser_process->GetApplicationLocale(), true);
- return language_name;
-}
-
-} // namespace
-
-namespace chromeos {
-
-using input_method::InputMethodManager;
-
-////////////////////////////////////////////////////////////////////////////////
-// InputMethodMenu
-
-InputMethodMenu::InputMethodMenu()
- : input_method_descriptors_(
- InputMethodManager::GetInstance()->GetActiveInputMethods()),
- model_(new ui::SimpleMenuModel(NULL)),
- ALLOW_THIS_IN_INITIALIZER_LIST(input_method_menu_delegate_(
- new views::MenuModelAdapter(this))),
- input_method_menu_(
- new views::MenuItemView(input_method_menu_delegate_.get())),
- input_method_menu_runner_(new views::MenuRunner(input_method_menu_)),
- minimum_input_method_menu_width_(0),
- menu_alignment_(views::MenuItemView::TOPRIGHT) {
- DCHECK(input_method_descriptors_.get() &&
- !input_method_descriptors_->empty());
- AddObserver();
-}
-
-InputMethodMenu::~InputMethodMenu() {
- // RemoveObserver() is no-op if |this| object is already removed from the
- // observer list
- RemoveObserver();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// ui::MenuModel implementation:
-
-int InputMethodMenu::GetCommandIdAt(int index) const {
- return index;
-}
-
-bool InputMethodMenu::IsItemDynamicAt(int index) const {
- // Menu content for the language button could change time by time.
- return true;
-}
-
-bool InputMethodMenu::GetAcceleratorAt(
- int index, ui::Accelerator* accelerator) const {
- // Views for Chromium OS does not support accelerators yet.
- return false;
-}
-
-bool InputMethodMenu::IsItemCheckedAt(int index) const {
- DCHECK_GE(index, 0);
- DCHECK(input_method_descriptors_.get());
-
- if (IndexIsInInputMethodList(index)) {
- const input_method::InputMethodDescriptor& input_method
- = input_method_descriptors_->at(index);
- return input_method == InputMethodManager::GetInstance()->
- GetCurrentInputMethod();
- }
-
- if (GetPropertyIndex(index, &index)) {
- const input_method::InputMethodPropertyList& property_list
- = InputMethodManager::GetInstance()->GetCurrentInputMethodProperties();
- return property_list.at(index).is_selection_item_checked;
- }
-
- // Separator(s) or the "Customize language and input..." button.
- return false;
-}
-
-int InputMethodMenu::GetGroupIdAt(int index) const {
- DCHECK_GE(index, 0);
-
- if (IndexIsInInputMethodList(index))
- return kRadioGroupLanguage;
-
- if (GetPropertyIndex(index, &index)) {
- const input_method::InputMethodPropertyList& property_list
- = InputMethodManager::GetInstance()->GetCurrentInputMethodProperties();
- return property_list.at(index).selection_item_id;
- }
-
- return kRadioGroupNone;
-}
-
-bool InputMethodMenu::HasIcons() const {
- // We don't support icons on Chrome OS.
- return false;
-}
-
-bool InputMethodMenu::GetIconAt(int index, SkBitmap* icon) {
- return false;
-}
-
-ui::ButtonMenuItemModel* InputMethodMenu::GetButtonMenuItemAt(
- int index) const {
- return NULL;
-}
-
-bool InputMethodMenu::IsEnabledAt(int index) const {
- // Just return true so all input method names and input method propertie names
- // could be clicked.
- return true;
-}
-
-ui::MenuModel* InputMethodMenu::GetSubmenuModelAt(int index) const {
- // We don't use nested menus.
- return NULL;
-}
-
-void InputMethodMenu::HighlightChangedTo(int index) {
- // Views for Chromium OS does not support this interface yet.
-}
-
-void InputMethodMenu::MenuWillShow() {
- // Views for Chromium OS does not support this interface yet.
-}
-
-void InputMethodMenu::SetMenuModelDelegate(ui::MenuModelDelegate* delegate) {
- // Not needed for current usage.
-}
-
-int InputMethodMenu::GetItemCount() const {
- if (!model_.get()) {
- // Model is not constructed yet. This means that
- // InputMethodMenu is being constructed. Return zero.
- return 0;
- }
- return model_->GetItemCount();
-}
-
-ui::MenuModel::ItemType InputMethodMenu::GetTypeAt(int index) const {
- DCHECK_GE(index, 0);
-
- if (IndexPointsToConfigureImeMenuItem(index)) {
- return ui::MenuModel::TYPE_COMMAND; // "Customize language and input"
- }
-
- if (IndexIsInInputMethodList(index))
- return ui::MenuModel::TYPE_RADIO;
-
- if (GetPropertyIndex(index, &index)) {
- const input_method::InputMethodPropertyList& property_list
- = InputMethodManager::GetInstance()->GetCurrentInputMethodProperties();
- if (property_list.at(index).is_selection_item) {
- return ui::MenuModel::TYPE_RADIO;
- }
- return ui::MenuModel::TYPE_COMMAND;
- }
-
- return ui::MenuModel::TYPE_SEPARATOR;
-}
-
-string16 InputMethodMenu::GetLabelAt(int index) const {
- DCHECK_GE(index, 0);
- DCHECK(input_method_descriptors_.get());
-
- // We use IDS_OPTIONS_SETTINGS_LANGUAGES_CUSTOMIZE here as the button
- // opens the same dialog that is opened from the main options dialog.
- if (IndexPointsToConfigureImeMenuItem(index)) {
- return l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_LANGUAGES_CUSTOMIZE);
- }
-
- string16 name;
- if (IndexIsInInputMethodList(index)) {
- name = GetTextForMenu(input_method_descriptors_->at(index));
- } else if (GetPropertyIndex(index, &index)) {
- InputMethodManager* manager = InputMethodManager::GetInstance();
- const input_method::InputMethodPropertyList& property_list =
- manager->GetCurrentInputMethodProperties();
- return manager->GetInputMethodUtil()->TranslateString(
- property_list.at(index).label);
- }
-
- return name;
-}
-
-void InputMethodMenu::ActivatedAt(int index) {
- DCHECK_GE(index, 0);
- DCHECK(input_method_descriptors_.get());
-
- if (IndexPointsToConfigureImeMenuItem(index)) {
- OpenConfigUI();
- return;
- }
-
- if (IndexIsInInputMethodList(index)) {
- // Inter-IME switching.
- const input_method::InputMethodDescriptor& input_method
- = input_method_descriptors_->at(index);
- InputMethodManager::GetInstance()->ChangeInputMethod(
- input_method.id());
- content::RecordAction(
- UserMetricsAction("LanguageMenuButton_InputMethodChanged"));
- return;
- }
-
- if (GetPropertyIndex(index, &index)) {
- // Intra-IME switching (e.g. Japanese-Hiragana to Japanese-Katakana).
- const input_method::InputMethodPropertyList& property_list
- = InputMethodManager::GetInstance()->GetCurrentInputMethodProperties();
- const std::string key = property_list.at(index).key;
- if (property_list.at(index).is_selection_item) {
- // Radio button is clicked.
- const int id = property_list.at(index).selection_item_id;
- // First, deactivate all other properties in the same radio group.
- for (int i = 0; i < static_cast<int>(property_list.size()); ++i) {
- if (i != index && id == property_list.at(i).selection_item_id) {
- InputMethodManager::GetInstance()->SetImePropertyActivated(
- property_list.at(i).key, false);
- }
- }
- // Then, activate the property clicked.
- InputMethodManager::GetInstance()->SetImePropertyActivated(
- key, true);
- } else {
- // Command button like "Switch to half punctuation mode" is clicked.
- // We can always use "Deactivate" for command buttons.
- InputMethodManager::GetInstance()->SetImePropertyActivated(
- key, false);
- }
- return;
- }
-
- LOG(ERROR) << "Unexpected index: " << index;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// views::MenuButtonListener implementation:
-
-void InputMethodMenu::OnMenuButtonClicked(views::View* source,
- const gfx::Point& point) {
- PrepareForMenuOpen();
-
- if (minimum_input_method_menu_width_ > 0) {
- DCHECK(input_method_menu_->HasSubmenu());
- views::SubmenuView* submenu = input_method_menu_->GetSubmenu();
- submenu->set_minimum_preferred_width(minimum_input_method_menu_width_);
- }
-
- gfx::Point screen_location;
- views::View::ConvertPointToScreen(source, &screen_location);
- gfx::Rect bounds(screen_location, source->size());
- if (input_method_menu_runner_->RunMenuAt(
- source->GetWidget()->GetTopLevelWidget(), NULL, bounds,
- menu_alignment_, views::MenuRunner::HAS_MNEMONICS) ==
- views::MenuRunner::MENU_DELETED)
- return;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// InputMethodManager::Observer implementation:
-
-void InputMethodMenu::InputMethodChanged(
- InputMethodManager* manager,
- const input_method::InputMethodDescriptor& current_input_method,
- size_t num_active_input_methods) {
- UpdateUIFromInputMethod(current_input_method, num_active_input_methods);
-}
-
-void InputMethodMenu::PropertyListChanged(
- InputMethodManager* manager,
- const input_method::InputMethodPropertyList& current_ime_properties) {
- // Usual order of notifications of input method change is:
- // 1. RegisterProperties(empty)
- // 2. RegisterProperties(list-of-new-properties)
- // 3. GlobalInputMethodChanged
- // However, due to the asynchronicity, we occasionally (but rarely) face to
- // 1. RegisterProperties(empty)
- // 2. GlobalInputMethodChanged
- // 3. RegisterProperties(list-of-new-properties)
- // this order. On this unusual case, we must rebuild the menu after the last
- // RegisterProperties. For the other cases, no rebuild is needed. Actually
- // it is better to be avoided. Otherwise users can sometimes observe the
- // awkward clear-then-register behavior.
- if (!current_ime_properties.empty()) {
- const input_method::InputMethodDescriptor& input_method =
- manager->GetCurrentInputMethod();
- size_t num_active_input_methods = manager->GetNumActiveInputMethods();
- UpdateUIFromInputMethod(input_method, num_active_input_methods);
- }
-}
-
-void InputMethodMenu::PrepareForMenuOpen() {
- content::RecordAction(UserMetricsAction("LanguageMenuButton_Open"));
- PrepareMenuModel();
-}
-
-void InputMethodMenu::PrepareMenuModel() {
- input_method_descriptors_.reset(InputMethodManager::GetInstance()->
- GetActiveInputMethods());
- RebuildModel();
-}
-
-void InputMethodMenu::ActiveInputMethodsChanged(
- InputMethodManager* manager,
- const input_method::InputMethodDescriptor& current_input_method,
- size_t num_active_input_methods) {
- // Update the icon if active input methods are changed. See also
- // comments in UpdateUI() in input_method_menu_button.cc.
- UpdateUIFromInputMethod(current_input_method, num_active_input_methods);
-}
-
-void InputMethodMenu::UpdateUIFromInputMethod(
- const input_method::InputMethodDescriptor& input_method,
- size_t num_active_input_methods) {
- InputMethodManager* manager = InputMethodManager::GetInstance();
- const string16 name = manager->GetInputMethodUtil()->
- GetInputMethodShortName(input_method);
- const string16 tooltip = GetTextForMenu(input_method);
- UpdateUI(input_method.id(), name, tooltip, num_active_input_methods);
-}
-
-void InputMethodMenu::RebuildModel() {
- model_->Clear();
- string16 dummy_label = UTF8ToUTF16("");
- // Indicates if separator's needed before each section.
- bool need_separator = false;
-
- if (!input_method_descriptors_->empty()) {
- // We "abuse" the command_id and group_id arguments of AddRadioItem method.
- // A COMMAND_ID_XXX enum value is passed as command_id, and array index of
- // |input_method_descriptors_| or |property_list| is passed as group_id.
- for (size_t i = 0; i < input_method_descriptors_->size(); ++i) {
- model_->AddRadioItem(COMMAND_ID_INPUT_METHODS, dummy_label, i);
- }
-
- need_separator = true;
- }
-
- const input_method::InputMethodPropertyList& property_list
- = InputMethodManager::GetInstance()->GetCurrentInputMethodProperties();
- if (!property_list.empty()) {
- if (need_separator) {
- model_->AddSeparator();
- }
- for (size_t i = 0; i < property_list.size(); ++i) {
- model_->AddRadioItem(COMMAND_ID_IME_PROPERTIES, dummy_label, i);
- }
- need_separator = true;
- }
-
- if (ShouldSupportConfigUI()) {
- // 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_CUSTOMIZE_LANGUAGE, dummy_label,
- 0 /* dummy */);
- }
-
- // Rebuild the menu from the model.
- input_method_menu_delegate_->BuildMenu(input_method_menu_);
-}
-
-bool InputMethodMenu::IndexIsInInputMethodList(int index) const {
- DCHECK_GE(index, 0);
- DCHECK(model_.get());
- if (index >= model_->GetItemCount()) {
- return false;
- }
-
- return ((model_->GetTypeAt(index) == ui::MenuModel::TYPE_RADIO) &&
- (model_->GetCommandIdAt(index) == COMMAND_ID_INPUT_METHODS) &&
- input_method_descriptors_.get() &&
- (index < static_cast<int>(input_method_descriptors_->size())));
-}
-
-bool InputMethodMenu::GetPropertyIndex(int index, int* property_index) const {
- DCHECK_GE(index, 0);
- DCHECK(property_index);
- DCHECK(model_.get());
- if (index >= model_->GetItemCount()) {
- return false;
- }
-
- if ((model_->GetTypeAt(index) == ui::MenuModel::TYPE_RADIO) &&
- (model_->GetCommandIdAt(index) == COMMAND_ID_IME_PROPERTIES)) {
- const int tmp_property_index = model_->GetGroupIdAt(index);
- const input_method::InputMethodPropertyList& property_list
- = InputMethodManager::GetInstance()->GetCurrentInputMethodProperties();
- if (tmp_property_index < static_cast<int>(property_list.size())) {
- *property_index = tmp_property_index;
- return true;
- }
- }
- return false;
-}
-
-bool InputMethodMenu::IndexPointsToConfigureImeMenuItem(int index) const {
- DCHECK_GE(index, 0);
- DCHECK(model_.get());
- if (index >= model_->GetItemCount()) {
- return false;
- }
-
- return ((model_->GetTypeAt(index) == ui::MenuModel::TYPE_RADIO) &&
- (model_->GetCommandIdAt(index) == COMMAND_ID_CUSTOMIZE_LANGUAGE));
-}
-
-string16 InputMethodMenu::GetTextForMenu(
- const input_method::InputMethodDescriptor& input_method) {
- if (!input_method.name().empty()) {
- // If the descriptor has a name, use it.
- return UTF8ToUTF16(input_method.name());
- }
-
- // We don't show language here. Name of keyboard layout or input method
- // usually imply (or explicitly include) its language.
-
- input_method::InputMethodManager* manager =
- input_method::InputMethodManager::GetInstance();
-
- // Special case for German, French and Dutch: these languages have multiple
- // keyboard layouts and share the same layout of keyboard (Belgian). We need
- // to show explicitly the language for the layout. For Arabic, Amharic, and
- // Indic languages: they share "Standard Input Method".
- const string16 standard_input_method_text = l10n_util::GetStringUTF16(
- IDS_OPTIONS_SETTINGS_LANGUAGES_M17N_STANDARD_INPUT_METHOD);
- const std::string language_code = input_method.language_code();
-
- string16 text =
- manager->GetInputMethodUtil()->TranslateString(input_method.id());
- if (text == standard_input_method_text ||
- language_code == "de" ||
- language_code == "fr" ||
- language_code == "nl") {
- text = GetLanguageName(language_code) + UTF8ToUTF16(" - ") + text;
- }
-
- DCHECK(!text.empty());
- return text;
-}
-
-void InputMethodMenu::SetMinimumWidth(int width) {
- // On the OOBE network selection screen, fixed width menu would be preferable.
- minimum_input_method_menu_width_ = width;
-}
-
-void InputMethodMenu::AddObserver() {
- InputMethodManager* manager = InputMethodManager::GetInstance();
- manager->AddObserver(this);
-}
-
-void InputMethodMenu::RemoveObserver() {
- InputMethodManager* manager = InputMethodManager::GetInstance();
- manager->RemoveObserver(this);
-}
-
-} // namespace chromeos
diff --git a/chrome/browser/chromeos/status/input_method_menu.h b/chrome/browser/chromeos/status/input_method_menu.h
deleted file mode 100644
index 3658a20..0000000
--- a/chrome/browser/chromeos/status/input_method_menu.h
+++ /dev/null
@@ -1,167 +0,0 @@
-// Copyright (c) 2012 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_INPUT_METHOD_MENU_H_
-#define CHROME_BROWSER_CHROMEOS_STATUS_INPUT_METHOD_MENU_H_
-#pragma once
-
-#include <string>
-
-#include "base/compiler_specific.h"
-#include "chrome/browser/chromeos/input_method/input_method_manager.h"
-#include "ui/base/models/menu_model.h"
-#include "ui/views/controls/button/menu_button_listener.h"
-#include "ui/views/controls/menu/menu_item_view.h"
-
-class PrefService;
-class SkBitmap;
-
-namespace ui {
-class SimpleMenuModel;
-} // namespace ui
-
-namespace views {
-class MenuItemView;
-class MenuModelAdapter;
-class MenuRunner;
-} // namespace views
-
-namespace chromeos {
-
-// A class for the dropdown menu for switching input method and keyboard layout.
-// Since the class provides the views::MenuButtonListener interface, it's easy
-// to create a button widget (e.g. views::MenuButton, StatusAreaButton) which
-// shows the dropdown menu on click.
-class InputMethodMenu
- : public views::MenuButtonListener,
- public ui::MenuModel,
- public input_method::InputMethodManager::Observer {
- public:
- InputMethodMenu();
- virtual ~InputMethodMenu();
-
- // ui::MenuModel implementation.
- virtual bool HasIcons() const OVERRIDE;
- virtual int GetItemCount() const OVERRIDE;
- virtual ui::MenuModel::ItemType GetTypeAt(int index) const OVERRIDE;
- virtual int GetCommandIdAt(int index) const OVERRIDE;
- virtual string16 GetLabelAt(int index) const OVERRIDE;
- virtual bool IsItemDynamicAt(int index) const OVERRIDE;
- virtual bool GetAcceleratorAt(int index,
- ui::Accelerator* accelerator) const OVERRIDE;
- virtual bool IsItemCheckedAt(int index) const OVERRIDE;
- virtual int GetGroupIdAt(int index) const OVERRIDE;
- virtual bool GetIconAt(int index, SkBitmap* icon) OVERRIDE;
- virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt(
- int index) const OVERRIDE;
- virtual bool IsEnabledAt(int index) const OVERRIDE;
- virtual ui::MenuModel* GetSubmenuModelAt(int index) const OVERRIDE;
- virtual void HighlightChangedTo(int index) OVERRIDE;
- virtual void ActivatedAt(int index) OVERRIDE;
- virtual void MenuWillShow() OVERRIDE;
- virtual void SetMenuModelDelegate(ui::MenuModelDelegate* delegate) OVERRIDE;
-
- // views::MenuButtonListener implementation.
- virtual void OnMenuButtonClicked(views::View* source,
- const gfx::Point& point) OVERRIDE;
-
- // InputMethodManager::Observer implementation.
- virtual void InputMethodChanged(
- input_method::InputMethodManager* manager,
- const input_method::InputMethodDescriptor& current_input_method,
- size_t num_active_input_methods) OVERRIDE;
- virtual void ActiveInputMethodsChanged(
- input_method::InputMethodManager* manager,
- const input_method::InputMethodDescriptor& current_input_method,
- size_t num_active_input_methods) OVERRIDE;
- virtual void PropertyListChanged(
- input_method::InputMethodManager* manager,
- const input_method::InputMethodPropertyList& properties) OVERRIDE;
-
- // Specify menu alignment (default TOPRIGHT).
- void set_menu_alignment(views::MenuItemView::AnchorPosition menu_alignment) {
- menu_alignment_ = menu_alignment;
- }
-
- // Sets the minimum width of the dropdown menu.
- void SetMinimumWidth(int width);
-
- // Rebuilds menu model.
- void PrepareMenuModel();
-
- // Returns a string for the drop-down menu and the tooltip for the indicator.
- // The method is public for unit tests.
- static string16 GetTextForMenu(
- const input_method::InputMethodDescriptor& input_method);
-
- protected:
- // Prepares menu: saves user metrics and rebuilds.
- void PrepareForMenuOpen();
-
- private:
- // Updates UI of a container of the menu (e.g. the "US" menu button in the
- // status area). Sub classes have to implement the interface for their own UI.
- virtual void UpdateUI(const std::string& input_method_id, // e.g. "mozc"
- const string16& name, // e.g. "US", "INTL"
- const string16& tooltip,
- size_t num_active_input_methods) = 0;
-
- // Sub classes have to implement the interface. This interface should return
- // true if the dropdown menu should show an item like "Customize languages
- // and input..." WebUI.
- virtual bool ShouldSupportConfigUI() = 0;
-
- // Sub classes have to implement the interface which opens an UI for
- // customizing languages and input.
- virtual void OpenConfigUI() = 0;
-
- // Parses |input_method| and then calls UpdateUI().
- void UpdateUIFromInputMethod(
- const input_method::InputMethodDescriptor& input_method,
- size_t num_active_input_methods);
-
- // Rebuilds |model_|. This function should be called whenever
- // |input_method_descriptors_| is updated, or ImePropertiesChanged() is
- // called.
- void RebuildModel();
-
- // Returns true if the zero-origin |index| points to one of the input methods.
- bool IndexIsInInputMethodList(int index) const;
-
- // Returns true if the zero-origin |index| points to one of the IME
- // properties. When returning true, |property_index| is updated so that
- // property_list.at(property_index) points to the menu item.
- bool GetPropertyIndex(int index, int* property_index) const;
-
- // Returns true if the zero-origin |index| points to the "Configure IME" menu
- // item.
- bool IndexPointsToConfigureImeMenuItem(int index) const;
-
- // Add / Remove InputMethodManager observer.
- void AddObserver();
- void RemoveObserver();
-
- // The current input method list.
- scoped_ptr<input_method::InputMethodDescriptors> input_method_descriptors_;
-
- // We borrow ui::SimpleMenuModel implementation to maintain the current
- // content of the pop-up menu. The ui::MenuModel is implemented using this
- // |model_|. The MenuModelAdapter wraps the model with the
- // views::MenuDelegate interface required for MenuItemView.
- scoped_ptr<ui::SimpleMenuModel> model_;
- scoped_ptr<views::MenuModelAdapter> input_method_menu_delegate_;
- views::MenuItemView* input_method_menu_;
- scoped_ptr<views::MenuRunner> input_method_menu_runner_;
-
- int minimum_input_method_menu_width_;
-
- // Menu alignment (default TOPRIGHT).
- views::MenuItemView::AnchorPosition menu_alignment_;
-
- DISALLOW_COPY_AND_ASSIGN(InputMethodMenu);
-};
-
-} // namespace chromeos
-
-#endif // CHROME_BROWSER_CHROMEOS_STATUS_INPUT_METHOD_MENU_H_
diff --git a/chrome/browser/chromeos/status/input_method_menu_button.cc b/chrome/browser/chromeos/status/input_method_menu_button.cc
deleted file mode 100644
index 6b2f027..0000000
--- a/chrome/browser/chromeos/status/input_method_menu_button.cc
+++ /dev/null
@@ -1,158 +0,0 @@
-// Copyright (c) 2012 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/input_method_menu_button.h"
-
-#include <string>
-
-#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_view_chromeos.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
-#include "chrome/browser/ui/browser_window.h"
-#include "ui/views/widget/widget.h"
-
-namespace {
-
-// A class which implements interfaces of chromeos::InputMethodMenu. This class
-// is just for avoiding multiple inheritance.
-class MenuImpl : public chromeos::InputMethodMenu {
- public:
- explicit MenuImpl(chromeos::InputMethodMenuButton* button)
- : button_(button) {}
-
- private:
- // InputMethodMenu implementation.
- virtual void UpdateUI(const std::string& input_method_id,
- const string16& name,
- const string16& tooltip,
- size_t num_active_input_methods) {
- button_->UpdateUI(input_method_id, name, tooltip, num_active_input_methods);
- }
- virtual bool ShouldSupportConfigUI() {
- return button_->ShouldSupportConfigUI();
- }
- virtual void OpenConfigUI() {
- button_->OpenConfigUI();
- }
- // The UI (views button) to which this class delegates all requests.
- chromeos::InputMethodMenuButton* button_;
-
- DISALLOW_COPY_AND_ASSIGN(MenuImpl);
-};
-
-} // namespace
-
-namespace chromeos {
-
-////////////////////////////////////////////////////////////////////////////////
-// InputMethodMenuButton
-
-InputMethodMenuButton::InputMethodMenuButton(
- StatusAreaButton::Delegate* delegate)
- : StatusAreaButton(delegate, this),
- menu_(new MenuImpl(this)) {
- set_id(VIEW_ID_STATUS_BUTTON_INPUT_METHOD);
- UpdateUIFromCurrentInputMethod();
-}
-
-InputMethodMenuButton::~InputMethodMenuButton() {}
-
-////////////////////////////////////////////////////////////////////////////////
-// views::View implementation:
-
-void InputMethodMenuButton::OnLocaleChanged() {
- input_method::InputMethodManager* manager =
- input_method::InputMethodManager::GetInstance();
- manager->GetInputMethodUtil()->OnLocaleChanged();
- UpdateUIFromCurrentInputMethod();
- Layout();
- SchedulePaint();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// views::MenuButtonListener implementation:
-
-void InputMethodMenuButton::OnMenuButtonClicked(views::View* source,
- const gfx::Point& point) {
- menu_->OnMenuButtonClicked(source, point);
-}
-
-bool InputMethodMenuButton::StatusAreaIsVisible() {
-#if defined(USE_ASH)
- return true;
-#else
- Browser* active_browser = BrowserList::GetLastActive();
- if (!active_browser) {
- // Can't get an active browser. Just return true, which is safer.
- return true;
- }
- BrowserWindow* active_window = active_browser->window();
- const views::Widget* current_window = GetWidget();
- if (!active_window || !current_window) {
- // Can't get an active or current window. Just return true as well.
- return true;
- }
- return active_window->GetNativeHandle() == current_window->GetNativeWindow();
-#endif
-}
-
-void InputMethodMenuButton::UpdateUI(const std::string& input_method_id,
- const string16& name,
- const string16& tooltip,
- size_t num_active_input_methods) {
- // Hide the button only if there is only one input method, and the input
- // method is a XKB keyboard layout. We don't hide the button for other
- // types of input methods as these might have intra input method modes,
- // like Hiragana and Katakana modes in Japanese input methods.
- const bool hide_button =
- num_active_input_methods == 1 &&
- input_method::InputMethodUtil::IsKeyboardLayout(input_method_id) &&
- StatusAreaViewChromeos::IsBrowserMode();
- SetVisible(!hide_button);
- SetText(name);
- SetTooltipText(tooltip);
- SetAccessibleName(tooltip);
-
- if (StatusAreaIsVisible()) {
- // We don't call these functions if the |current_window| is not active since
- // the calls are relatively expensive (crosbug.com/9206). Please note that
- // PrepareMenuModel() is necessary for fixing crosbug.com/7522 when the
- // window is active.
- menu_->PrepareMenuModel();
- SchedulePaint();
- }
-
- // TODO(yusukes): For a window which isn't on top, probably it's better to
- // update the texts when the window gets activated because SetTooltipText()
- // and SetText() are also expensive.
-}
-
-void InputMethodMenuButton::OpenConfigUI() {
- // Ask browser to open the WebUI page.
- delegate()->ExecuteStatusAreaCommand(
- this, StatusAreaButton::Delegate::SHOW_LANGUAGE_OPTIONS);
-}
-
-bool InputMethodMenuButton::ShouldSupportConfigUI() {
- return delegate()->ShouldExecuteStatusAreaCommand(
- this, StatusAreaButton::Delegate::SHOW_LANGUAGE_OPTIONS);
-}
-
-void InputMethodMenuButton::UpdateUIFromCurrentInputMethod() {
- input_method::InputMethodManager* input_method_manager =
- input_method::InputMethodManager::GetInstance();
- const input_method::InputMethodDescriptor& input_method =
- input_method_manager->GetCurrentInputMethod();
- const string16 name = input_method_manager->GetInputMethodUtil()->
- GetInputMethodShortName(input_method);
- const string16 tooltip = InputMethodMenu::GetTextForMenu(input_method);
- const size_t num_active_input_methods =
- input_method_manager->GetNumActiveInputMethods();
- UpdateUI(input_method.id(), name, tooltip, num_active_input_methods);
-}
-
-} // namespace chromeos
diff --git a/chrome/browser/chromeos/status/input_method_menu_button.h b/chrome/browser/chromeos/status/input_method_menu_button.h
deleted file mode 100644
index 782e72d..0000000
--- a/chrome/browser/chromeos/status/input_method_menu_button.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (c) 2012 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_INPUT_METHOD_MENU_BUTTON_H_
-#define CHROME_BROWSER_CHROMEOS_STATUS_INPUT_METHOD_MENU_BUTTON_H_
-#pragma once
-
-#include <string>
-
-#include "base/compiler_specific.h"
-#include "chrome/browser/chromeos/status/input_method_menu.h"
-#include "chrome/browser/chromeos/status/status_area_button.h"
-#include "ui/views/controls/button/menu_button_listener.h"
-
-namespace chromeos {
-
-// 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::MenuButtonListener {
- public:
- explicit InputMethodMenuButton(StatusAreaButton::Delegate* delegate);
- virtual ~InputMethodMenuButton();
-
- // views::View implementation.
- virtual void OnLocaleChanged() OVERRIDE;
-
- // views::MenuButtonListener implementation.
- virtual void OnMenuButtonClicked(views::View* source,
- const gfx::Point& point) OVERRIDE;
-
- // InputMethodMenu implementation.
- virtual void UpdateUI(const std::string& input_method_id,
- const string16& name,
- const string16& tooltip,
- size_t num_active_input_methods);
- virtual bool ShouldSupportConfigUI();
- virtual void OpenConfigUI();
-
- // Updates the UI from the current input method.
- void UpdateUIFromCurrentInputMethod();
-
- private:
- // Returns true if the Chrome window where the button lives is active. When
- // Ash is in use, the function always returns true.
- bool StatusAreaIsVisible();
-
- scoped_ptr<InputMethodMenu> menu_;
-
- DISALLOW_COPY_AND_ASSIGN(InputMethodMenuButton);
-};
-
-} // namespace chromeos
-
-#endif // CHROME_BROWSER_CHROMEOS_STATUS_INPUT_METHOD_MENU_BUTTON_H_
diff --git a/chrome/browser/chromeos/status/input_method_menu_unittest.cc b/chrome/browser/chromeos/status/input_method_menu_unittest.cc
deleted file mode 100644
index 9361c74..0000000
--- a/chrome/browser/chromeos/status/input_method_menu_unittest.cc
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright (c) 2012 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/input_method_menu.h"
-
-#include "base/memory/scoped_ptr.h"
-#include "base/utf_string_conversions.h"
-#include "chrome/browser/chromeos/input_method/ibus_controller.h"
-#include "chrome/test/base/testing_browser_process.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace chromeos {
-
-using input_method::IBusController;
-using input_method::InputMethodDescriptor;
-
-namespace {
-
-InputMethodDescriptor GetDesc(IBusController* controller,
- const std::string& id,
- const std::string& raw_layout,
- const std::string& language_code) {
- return controller->CreateInputMethodDescriptor(id, "", raw_layout,
- language_code);
-}
-
-} // namespace
-
-// Test whether the function returns language name for non-ambiguous languages.
-TEST(InputMethodMenuTest, GetTextForMenuTest) {
- scoped_ptr<IBusController> controller(IBusController::Create());
-
- // For most languages input method or keyboard layout name is returned.
- // See below for exceptions.
- {
- InputMethodDescriptor desc =
- GetDesc(controller.get(), "m17n:fa:isiri", "us", "fa");
- EXPECT_EQ(ASCIIToUTF16("Persian input method (ISIRI 2901 layout)"),
- InputMethodMenu::GetTextForMenu(desc));
- }
- {
- InputMethodDescriptor desc =
- GetDesc(controller.get(), "mozc-hangul", "us", "ko");
- EXPECT_EQ(ASCIIToUTF16("Korean input method"),
- InputMethodMenu::GetTextForMenu(desc));
- }
- {
- InputMethodDescriptor desc =
- GetDesc(controller.get(), "m17n:vi:tcvn", "us", "vi");
- EXPECT_EQ(ASCIIToUTF16("Vietnamese input method (TCVN6064)"),
- InputMethodMenu::GetTextForMenu(desc));
- }
- {
- InputMethodDescriptor desc = GetDesc(controller.get(), "mozc", "us", "ja");
-#if !defined(GOOGLE_CHROME_BUILD)
- EXPECT_EQ(ASCIIToUTF16("Japanese input method (for US keyboard)"),
-#else
- EXPECT_EQ(ASCIIToUTF16("Google Japanese Input (for US keyboard)"),
-#endif // defined(GOOGLE_CHROME_BUILD)
- InputMethodMenu::GetTextForMenu(desc));
- }
- {
- InputMethodDescriptor desc =
- GetDesc(controller.get(), "xkb:jp::jpn", "jp", "ja");
- EXPECT_EQ(ASCIIToUTF16("Japanese keyboard"),
- InputMethodMenu::GetTextForMenu(desc));
- }
- {
- InputMethodDescriptor desc =
- GetDesc(controller.get(), "xkb:us:dvorak:eng", "us(dvorak)", "en-US");
- EXPECT_EQ(ASCIIToUTF16("US Dvorak keyboard"),
- InputMethodMenu::GetTextForMenu(desc));
- }
- {
- InputMethodDescriptor desc =
- GetDesc(controller.get(), "xkb:gb:dvorak:eng", "gb(dvorak)", "en-US");
- EXPECT_EQ(ASCIIToUTF16("UK Dvorak keyboard"),
- InputMethodMenu::GetTextForMenu(desc));
- }
-
- // For Arabic, Dutch, French, German and Hindi,
- // "language - keyboard layout" pair is returned.
- {
- InputMethodDescriptor desc =
- GetDesc(controller.get(), "m17n:ar:kbd", "us", "ar");
- EXPECT_EQ(ASCIIToUTF16("Arabic - Standard input method"),
- InputMethodMenu::GetTextForMenu(desc));
- }
- {
- InputMethodDescriptor desc =
- GetDesc(controller.get(), "xkb:be::nld", "be", "nl");
- EXPECT_EQ(ASCIIToUTF16("Dutch - Belgian keyboard"),
- InputMethodMenu::GetTextForMenu(desc));
- }
- {
- InputMethodDescriptor desc =
- GetDesc(controller.get(), "xkb:fr::fra", "fr", "fr");
- EXPECT_EQ(ASCIIToUTF16("French - French keyboard"),
- InputMethodMenu::GetTextForMenu(desc));
- }
- {
- InputMethodDescriptor desc =
- GetDesc(controller.get(), "xkb:be::fra", "be", "fr");
- EXPECT_EQ(ASCIIToUTF16("French - Belgian keyboard"),
- InputMethodMenu::GetTextForMenu(desc));
- }
- {
- InputMethodDescriptor desc =
- GetDesc(controller.get(), "xkb:de::ger", "de", "de");
- EXPECT_EQ(ASCIIToUTF16("German - German keyboard"),
- InputMethodMenu::GetTextForMenu(desc));
- }
- {
- InputMethodDescriptor desc =
- GetDesc(controller.get(), "xkb:be::ger", "be", "de");
- EXPECT_EQ(ASCIIToUTF16("German - Belgian keyboard"),
- InputMethodMenu::GetTextForMenu(desc));
- }
- {
- InputMethodDescriptor desc =
- GetDesc(controller.get(), "m17n:hi:itrans", "us", "hi");
- EXPECT_EQ(ASCIIToUTF16("Hindi - Standard input method"),
- InputMethodMenu::GetTextForMenu(desc));
- }
-
- {
- InputMethodDescriptor desc =
- GetDesc(controller.get(), "invalid-id", "us", "xx");
- // You can safely ignore the "Resouce ID is not found for: invalid-id"
- // error.
- EXPECT_EQ(ASCIIToUTF16("invalid-id"),
- InputMethodMenu::GetTextForMenu(desc));
- }
-}
-
-} // namespace chromeos
diff --git a/chrome/browser/chromeos/status/memory_menu_button.cc b/chrome/browser/chromeos/status/memory_menu_button.cc
deleted file mode 100644
index 28cdde7..0000000
--- a/chrome/browser/chromeos/status/memory_menu_button.cc
+++ /dev/null
@@ -1,282 +0,0 @@
-// Copyright (c) 2012 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.
-
-// Note: this file is used by Aura on all linux platforms, even though it
-// is currently in a chromeos specific location.
-
-#include "chrome/browser/chromeos/status/memory_menu_button.h"
-
-#include "base/file_util.h"
-#include "base/process_util.h" // GetSystemMemoryInfo
-#include "base/stringprintf.h"
-#include "base/threading/thread_restrictions.h"
-#include "base/utf_string_conversions.h"
-#include "chrome/browser/chromeos/view_ids.h"
-#include "chrome/browser/memory_purger.h"
-#include "chrome/common/render_messages.h"
-#include "content/public/browser/notification_service.h"
-#include "content/public/browser/notification_types.h"
-#include "content/public/browser/render_process_host.h"
-#include "grit/generated_resources.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/views/controls/menu/menu_runner.h"
-#include "ui/views/widget/widget.h"
-
-#if defined(USE_TCMALLOC)
-#include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h"
-#endif
-
-#if defined(USE_TCMALLOC)
-const char kProfileDumpFilePrefix[] = "/tmp/chrome_tcmalloc";
-#endif
-
-namespace {
-
-// views::MenuItemView item ids
-enum {
- MEM_TOTAL_ITEM,
- MEM_FREE_ITEM,
- MEM_BUFFERS_ITEM,
- MEM_CACHE_ITEM,
- SHMEM_ITEM,
- PURGE_MEMORY_ITEM,
-#if defined(USE_TCMALLOC)
- TOGGLE_PROFILING_ITEM,
- DUMP_PROFILING_ITEM,
-#endif
-};
-
-} // namespace
-
-// Delay between updates, in seconds.
-const int kUpdateIntervalSeconds = 5;
-
-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,
- content::NotificationService::AllSources());
- UpdateTextAndSetNextTimer();
-}
-
-MemoryMenuButton::~MemoryMenuButton() {
-}
-
-void MemoryMenuButton::UpdateTextAndSetNextTimer() {
- UpdateText();
-
- timer_.Start(FROM_HERE,
- base::TimeDelta::FromSeconds(kUpdateIntervalSeconds), this,
- &MemoryMenuButton::UpdateTextAndSetNextTimer);
-}
-
-void MemoryMenuButton::UpdateText() {
- base::GetSystemMemoryInfo(meminfo_.get());
- // "Anonymous" memory, meaning not mapped to a file (which has a name),
- // represents memory that has been dynamically allocated to a process.
- // It thus approximates heap memory usage across all processes.
- int anon_kb = meminfo_->active_anon + meminfo_->inactive_anon;
- std::string label = base::StringPrintf("%d MB (%d)",
- anon_kb / 1024,
- renderer_kills_);
- SetText(ASCIIToUTF16(label));
- std::string tooltip = base::StringPrintf("%d MB allocated (anonymous)\n"
- "%d renderer kill(s)",
- anon_kb / 1024,
- renderer_kills_);
- SetTooltipText(ASCIIToUTF16(tooltip));
- SchedulePaint();
-}
-
-// MemoryMenuButton, views::MenuDelegate implementation:
-string16 MemoryMenuButton::GetLabel(int id) const {
- std::string label;
- switch (id) {
- case MEM_TOTAL_ITEM:
- label = base::StringPrintf("%d MB total", meminfo_->total / 1024);
- break;
- case MEM_FREE_ITEM:
- label = base::StringPrintf("%d MB free", meminfo_->free / 1024);
- break;
- case MEM_BUFFERS_ITEM:
- label = base::StringPrintf("%d MB buffers", meminfo_->buffers / 1024);
- break;
- case MEM_CACHE_ITEM:
- label = base::StringPrintf("%d MB cache", meminfo_->cached / 1024);
- break;
- case SHMEM_ITEM:
- label = base::StringPrintf("%d MB shmem", meminfo_->shmem / 1024);
- break;
- case PURGE_MEMORY_ITEM:
- return ASCIIToUTF16("Purge memory");
-#if defined(USE_TCMALLOC)
- case TOGGLE_PROFILING_ITEM:
- if (!IsHeapProfilerRunning())
- return ASCIIToUTF16("Start profiling");
- else
- return ASCIIToUTF16("Stop profiling");
- case DUMP_PROFILING_ITEM:
- return ASCIIToUTF16("Dump profile");
-#endif
- default:
- return string16();
- }
- return UTF8ToUTF16(label);
-}
-
-bool MemoryMenuButton::IsCommandEnabled(int id) const {
- switch (id) {
- case PURGE_MEMORY_ITEM:
- return true;
-#if defined(USE_TCMALLOC)
- case TOGGLE_PROFILING_ITEM:
- case DUMP_PROFILING_ITEM:
- return true;
-#endif
- default:
- return false;
- }
-}
-
-namespace {
-#if defined(USE_TCMALLOC)
-FilePath::StringType GetProfileDumpFilePath(base::ProcessId pid) {
- int int_pid = static_cast<int>(pid);
- FilePath::StringType filepath = StringPrintf(
- FILE_PATH_LITERAL("%s.%d.heap"),
- FILE_PATH_LITERAL(kProfileDumpFilePrefix), int_pid);
- return filepath;
-}
-#endif
-}
-
-void MemoryMenuButton::SendCommandToRenderers(int id) {
-#if defined(USE_TCMALLOC)
- // Use the "is running" value for this process to determine whether to
- // start or stop profiling on the renderer processes.
- bool started = IsHeapProfilerRunning();
- for (content::RenderProcessHost::iterator it =
- content::RenderProcessHost::AllHostsIterator();
- !it.IsAtEnd(); it.Advance()) {
- switch (id) {
- case TOGGLE_PROFILING_ITEM:
- it.GetCurrentValue()->Send(new ChromeViewMsg_SetTcmallocHeapProfiling(
- started, std::string(kProfileDumpFilePrefix)));
- break;
- case DUMP_PROFILING_ITEM:
- it.GetCurrentValue()->Send(new ChromeViewMsg_WriteTcmallocHeapProfile(
- GetProfileDumpFilePath(
- base::GetProcId(it.GetCurrentValue()->GetHandle()))));
- break;
- default:
- NOTREACHED();
- }
- }
-#endif
-}
-
-void MemoryMenuButton::ExecuteCommand(int id) {
- switch (id) {
- case PURGE_MEMORY_ITEM:
- MemoryPurger::PurgeAll();
- break;
-#if defined(USE_TCMALLOC)
- case TOGGLE_PROFILING_ITEM: {
- if (!IsHeapProfilerRunning())
- HeapProfilerStart(kProfileDumpFilePrefix);
- else
- HeapProfilerStop();
- SendCommandToRenderers(id);
- break;
- }
- case DUMP_PROFILING_ITEM: {
- char* profile = GetHeapProfile();
- if (profile) {
- FilePath::StringType filepath =
- GetProfileDumpFilePath(base::GetProcId(base::GetCurrentProcId()));
- VLOG(0) << "Writing browser heap profile dump to: " << filepath;
- base::ThreadRestrictions::ScopedAllowIO allow_io;
- file_util::WriteFile(FilePath(filepath), profile, strlen(profile));
- delete profile;
- }
- SendCommandToRenderers(id);
- break;
- }
-#endif
- default:
- NOTREACHED();
- break;
- }
-}
-
-int MemoryMenuButton::horizontal_padding() {
- return 3;
-}
-
-// MemoryMenuButton, views::MenuButtonListener implementation:
-
-void MemoryMenuButton::OnMenuButtonClicked(views::View* source,
- const gfx::Point& point) {
- // View passed in must be a views::MenuButton, i.e. the MemoryMenuButton.
- DCHECK_EQ(source, this);
-
- menu_runner_.reset(new views::MenuRunner(CreateMenu()));
- gfx::Point screen_location;
- views::View::ConvertPointToScreen(source, &screen_location);
- gfx::Rect bounds(screen_location, source->size());
- if (menu_runner_->RunMenuAt(
- source->GetWidget()->GetTopLevelWidget(), this, bounds,
- views::MenuItemView::TOPRIGHT, views::MenuRunner::HAS_MNEMONICS) ==
- views::MenuRunner::MENU_DELETED)
- return;
-}
-
-views::MenuItemView* MemoryMenuButton::CreateMenu() {
- // Just rebuild the menu each time to ensure the labels are up-to-date.
- views::MenuItemView* menu = new views::MenuItemView(this);
- // Text for these items will be set by GetLabel().
- menu->AppendDelegateMenuItem(MEM_TOTAL_ITEM);
- menu->AppendDelegateMenuItem(MEM_FREE_ITEM);
- menu->AppendDelegateMenuItem(MEM_BUFFERS_ITEM);
- menu->AppendDelegateMenuItem(MEM_CACHE_ITEM);
- menu->AppendDelegateMenuItem(SHMEM_ITEM);
- menu->AppendSeparator();
- menu->AppendDelegateMenuItem(PURGE_MEMORY_ITEM);
-#if defined(USE_TCMALLOC)
- menu->AppendSeparator();
- menu->AppendDelegateMenuItem(TOGGLE_PROFILING_ITEM);
- if (IsHeapProfilerRunning())
- menu->AppendDelegateMenuItem(DUMP_PROFILING_ITEM);
-#endif
- return menu;
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// content::NotificationObserver overrides.
-
-void MemoryMenuButton::Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- switch (type) {
- case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: {
- content::RenderProcessHost::RendererClosedDetails* process_details =
- content::Details<content::RenderProcessHost::RendererClosedDetails>(
- details).ptr();
- if (process_details->status ==
- base::TERMINATION_STATUS_PROCESS_WAS_KILLED) {
- renderer_kills_++;
- // A kill is a very interesting event, so repaint immediately.
- UpdateText();
- }
- break;
- }
- default:
- NOTREACHED() << L"Received unexpected notification";
- break;
- }
-}
diff --git a/chrome/browser/chromeos/status/memory_menu_button.h b/chrome/browser/chromeos/status/memory_menu_button.h
deleted file mode 100644
index 9747c47..0000000
--- a/chrome/browser/chromeos/status/memory_menu_button.h
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (c) 2012 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_MEMORY_MENU_BUTTON_H_
-#define CHROME_BROWSER_CHROMEOS_STATUS_MEMORY_MENU_BUTTON_H_
-#pragma once
-
-#include "base/memory/scoped_ptr.h"
-#include "base/timer.h"
-#include "chrome/browser/chromeos/status/status_area_button.h"
-#include "content/public/browser/notification_observer.h"
-#include "content/public/browser/notification_registrar.h"
-#include "ui/views/controls/button/menu_button_listener.h"
-#include "ui/views/controls/menu/menu_delegate.h"
-
-namespace base {
-struct SystemMemoryInfoKB;
-}
-
-namespace views {
-class MenuItemView;
-class MenuRunner;
-}
-
-// Memory debugging display that lives in the status area.
-class MemoryMenuButton : public StatusAreaButton,
- public views::MenuDelegate,
- public views::MenuButtonListener,
- public content::NotificationObserver {
- public:
- explicit MemoryMenuButton(StatusAreaButton::Delegate* delegate);
- virtual ~MemoryMenuButton();
-
- // views::MenuDelegate implementation
- virtual string16 GetLabel(int id) const OVERRIDE;
- virtual bool IsCommandEnabled(int id) const OVERRIDE;
- virtual void ExecuteCommand(int id) OVERRIDE;
-
- // views::MenuButtonListener implementation.
- virtual void OnMenuButtonClicked(views::View* source,
- const gfx::Point& point) OVERRIDE;
-
- // content::NotificationObserver overrides.
- virtual void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) OVERRIDE;
-
- // Updates the text on the menu button.
- void UpdateText();
-
- protected:
- virtual int horizontal_padding() OVERRIDE;
-
- private:
- // Execute command id for each renderer. Used for heap profiling.
- void SendCommandToRenderers(int id);
-
- // Creates and returns the menu. The caller owns the returned value.
- views::MenuItemView* CreateMenu();
-
- // Updates text and schedules the timer to fire at the next minute interval.
- void UpdateTextAndSetNextTimer();
-
- base::OneShotTimer<MemoryMenuButton> timer_;
-
- // Raw data from /proc/meminfo
- scoped_ptr<base::SystemMemoryInfoKB> meminfo_;
-
- content::NotificationRegistrar registrar_;
-
- // Number of renderer kills we have observed.
- int renderer_kills_;
-
- scoped_ptr<views::MenuRunner> menu_runner_;
-
- DISALLOW_COPY_AND_ASSIGN(MemoryMenuButton);
-};
-
-#endif // CHROME_BROWSER_CHROMEOS_STATUS_MEMORY_MENU_BUTTON_H_
diff --git a/chrome/browser/chromeos/status/network_menu.cc b/chrome/browser/chromeos/status/network_menu.cc
index e7d2859..1702290 100644
--- a/chrome/browser/chromeos/status/network_menu.cc
+++ b/chrome/browser/chromeos/status/network_menu.cc
@@ -19,7 +19,6 @@
#include "chrome/browser/chromeos/options/network_config_view.h"
#include "chrome/browser/chromeos/sim_dialog_delegate.h"
#include "chrome/browser/chromeos/status/network_menu_icon.h"
-#include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
#include "chrome/browser/defaults.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
@@ -627,9 +626,9 @@ void MainMenuModel::InitMenuItems(bool should_open_button_options) {
chromeos::ActivationState activation_state =
cell_networks[i]->activation_state();
- // If we are on the OOBE/login screen, do not show activating 3G option.
- if (!StatusAreaViewChromeos::IsBrowserMode() &&
- activation_state != ACTIVATION_STATE_ACTIVATED)
+ // This is currently only used in the OOBE/login screen, do not show
+ // activating 3G option.
+ if (activation_state != ACTIVATION_STATE_ACTIVATED)
continue;
// Ampersand is a valid character in a network name, but menu2 uses it
@@ -694,27 +693,8 @@ void MainMenuModel::InitMenuItems(bool should_open_button_options) {
}
const NetworkDevice* cellular_device = cros->FindCellularDevice();
if (cellular_device) {
- // Add "View Account" with top up URL if we know that.
- MobileConfig* config = MobileConfig::GetInstance();
- if (StatusAreaViewChromeos::IsBrowserMode() && config->IsReady()) {
- std::string carrier_id = cros->GetCellularHomeCarrierId();
- // If we don't have top up URL cached.
- if (carrier_id != carrier_id_) {
- // Mark that we've checked this carrier ID.
- carrier_id_ = carrier_id;
- top_up_url_.clear();
- const MobileConfig::Carrier* carrier = config->GetCarrier(carrier_id);
- if (carrier && !carrier->top_up_url().empty())
- top_up_url_ = carrier->top_up_url();
- }
- if (!top_up_url_.empty()) {
- menu_items_.push_back(MenuItem(
- ui::MenuModel::TYPE_COMMAND,
- l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_VIEW_ACCOUNT),
- SkBitmap(),
- std::string(), FLAG_VIEW_ACCOUNT));
- }
- }
+ // NOTE: This is currently only used in login/OOBE screen. So do not add
+ // "View Account" with top up URL.
if (cellular_device->support_network_scan()) {
// For GSM add mobile network scan.
@@ -740,20 +720,6 @@ void MainMenuModel::InitMenuItems(bool should_open_button_options) {
SkBitmap(), std::string(), FLAG_DISABLED));
}
- // If we are logged in and there is a connected network or a connected VPN,
- // add submenu for Private Networks.
- if (StatusAreaViewChromeos::IsBrowserMode()) {
- if (cros->connected_network() || cros->virtual_network_connected()) {
- menu_items_.push_back(MenuItem()); // Separator
- const SkBitmap icon = NetworkMenuIcon::GetVpnBitmap();
- menu_items_.push_back(MenuItem(
- ui::MenuModel::TYPE_SUBMENU,
- l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_PRIVATE_NETWORKS),
- icon, vpn_menu_model_.get(), FLAG_NONE));
- vpn_menu_model_->InitMenuItems(should_open_button_options);
- }
- }
-
bool show_wifi_scanning = wifi_available && cros->wifi_scanning();
// Do not show disable wifi during oobe
bool show_toggle_wifi = wifi_available &&
@@ -827,18 +793,10 @@ void MainMenuModel::InitMenuItems(bool should_open_button_options) {
more_menu_model_->InitMenuItems(should_open_button_options);
if (!more_menu_model_->menu_items().empty()) {
menu_items_.push_back(MenuItem()); // Separator
- if (StatusAreaViewChromeos::IsBrowserMode()) {
- // In browser mode we do not want separate submenu, inline items.
- menu_items_.insert(
- menu_items_.end(),
- more_menu_model_->menu_items().begin(),
- more_menu_model_->menu_items().end());
- } else {
- menu_items_.push_back(MenuItem(
- ui::MenuModel::TYPE_SUBMENU,
- l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_MORE),
- SkBitmap(), more_menu_model_.get(), FLAG_NONE));
- }
+ menu_items_.push_back(MenuItem(
+ ui::MenuModel::TYPE_SUBMENU,
+ l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_MORE),
+ SkBitmap(), more_menu_model_.get(), FLAG_NONE));
}
}
@@ -924,9 +882,7 @@ void MoreMenuModel::InitMenuItems(bool should_open_button_options) {
bool connected = cros->Connected(); // always call for test expectations.
int message_id = -1;
- if (StatusAreaViewChromeos::IsBrowserMode())
- message_id = IDS_STATUSBAR_NETWORK_OPEN_OPTIONS_DIALOG;
- else if (connected)
+ if (connected)
message_id = IDS_STATUSBAR_NETWORK_OPEN_PROXY_SETTINGS_DIALOG;
if (message_id != -1) {
link_items.push_back(MenuItem(ui::MenuModel::TYPE_COMMAND,
@@ -943,34 +899,32 @@ void MoreMenuModel::InitMenuItems(bool should_open_button_options) {
}
}
- if (!StatusAreaViewChromeos::IsBrowserMode()) {
- const NetworkDevice* ether = cros->FindEthernetDevice();
- if (ether) {
+ const NetworkDevice* ether = cros->FindEthernetDevice();
+ if (ether) {
+ std::string hardware_address;
+ cros->GetIPConfigs(ether->device_path(), &hardware_address,
+ NetworkLibrary::FORMAT_COLON_SEPARATED_HEX);
+ if (!hardware_address.empty()) {
+ std::string label = l10n_util::GetStringUTF8(
+ IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET) + " " + hardware_address;
+ address_items.push_back(MenuItem(ui::MenuModel::TYPE_COMMAND,
+ UTF8ToUTF16(label), SkBitmap(), std::string(), FLAG_DISABLED));
+ }
+ }
+
+ if (cros->wifi_enabled()) {
+ const NetworkDevice* wifi = cros->FindWifiDevice();
+ if (wifi) {
std::string hardware_address;
- cros->GetIPConfigs(ether->device_path(), &hardware_address,
- NetworkLibrary::FORMAT_COLON_SEPARATED_HEX);
+ cros->GetIPConfigs(wifi->device_path(),
+ &hardware_address, NetworkLibrary::FORMAT_COLON_SEPARATED_HEX);
if (!hardware_address.empty()) {
std::string label = l10n_util::GetStringUTF8(
- IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET) + " " + hardware_address;
+ IDS_STATUSBAR_NETWORK_DEVICE_WIFI) + " " + hardware_address;
address_items.push_back(MenuItem(ui::MenuModel::TYPE_COMMAND,
UTF8ToUTF16(label), SkBitmap(), std::string(), FLAG_DISABLED));
}
}
-
- if (cros->wifi_enabled()) {
- const NetworkDevice* wifi = cros->FindWifiDevice();
- if (wifi) {
- std::string hardware_address;
- cros->GetIPConfigs(wifi->device_path(),
- &hardware_address, NetworkLibrary::FORMAT_COLON_SEPARATED_HEX);
- if (!hardware_address.empty()) {
- std::string label = l10n_util::GetStringUTF8(
- IDS_STATUSBAR_NETWORK_DEVICE_WIFI) + " " + hardware_address;
- address_items.push_back(MenuItem(ui::MenuModel::TYPE_COMMAND,
- UTF8ToUTF16(label), SkBitmap(), std::string(), FLAG_DISABLED));
- }
- }
- }
}
menu_items_ = link_items;
diff --git a/chrome/browser/chromeos/status/network_menu_button.cc b/chrome/browser/chromeos/status/network_menu_button.cc
deleted file mode 100644
index 38ae792..0000000
--- a/chrome/browser/chromeos/status/network_menu_button.cc
+++ /dev/null
@@ -1,237 +0,0 @@
-// Copyright (c) 2012 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/network_menu_button.h"
-
-#include <algorithm>
-#include <limits>
-#include <vector>
-
-#include "base/bind.h"
-#include "base/logging.h"
-#include "base/message_loop.h"
-#include "base/string_util.h"
-#include "base/stringprintf.h"
-#include "chrome/browser/chromeos/cros/cros_library.h"
-#include "chrome/browser/chromeos/login/base_login_display_host.h"
-#include "chrome/browser/chromeos/options/network_config_view.h"
-#include "chrome/browser/chromeos/sim_dialog_delegate.h"
-#include "chrome/browser/chromeos/status/data_promo_notification.h"
-#include "chrome/browser/chromeos/view_ids.h"
-#include "chrome/browser/prefs/pref_service.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
-#include "chrome/common/pref_names.h"
-
-namespace chromeos {
-
-////////////////////////////////////////////////////////////////////////////////
-// NetworkMenuButton
-
-NetworkMenuButton::NetworkMenuButton(StatusAreaButton::Delegate* delegate)
- : StatusAreaButton(delegate, this),
- data_promo_notification_(new DataPromoNotification()) {
- set_id(VIEW_ID_STATUS_BUTTON_NETWORK_MENU);
- network_menu_.reset(new NetworkMenu(this));
- network_icon_.reset(
- new NetworkMenuIcon(this, NetworkMenuIcon::MENU_MODE));
-
- NetworkLibrary* network_library = CrosLibrary::Get()->GetNetworkLibrary();
- OnNetworkManagerChanged(network_library);
- network_library->AddNetworkManagerObserver(this);
- network_library->AddCellularDataPlanObserver(this);
- const NetworkDevice* cellular = network_library->FindCellularDevice();
- if (cellular) {
- cellular_device_path_ = cellular->device_path();
- network_library->AddNetworkDeviceObserver(cellular_device_path_, this);
- }
-}
-
-NetworkMenuButton::~NetworkMenuButton() {
- NetworkLibrary* netlib = CrosLibrary::Get()->GetNetworkLibrary();
- netlib->RemoveNetworkManagerObserver(this);
- netlib->RemoveObserverForAllNetworks(this);
- netlib->RemoveCellularDataPlanObserver(this);
- if (!cellular_device_path_.empty())
- netlib->RemoveNetworkDeviceObserver(cellular_device_path_, this);
-}
-
-// static
-void NetworkMenuButton::RegisterPrefs(PrefService* local_state) {
- // Carrier deal notification shown count defaults to 0.
- local_state->RegisterIntegerPref(prefs::kCarrierDealPromoShown, 0);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NetworkLibrary::NetworkDeviceObserver implementation:
-
-void NetworkMenuButton::OnNetworkDeviceChanged(NetworkLibrary* cros,
- const NetworkDevice* device) {
- // Device status, such as SIMLock may have changed.
- SetNetworkIcon();
- network_menu_->UpdateMenu();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NetworkMenuButton, NetworkLibrary::NetworkManagerObserver implementation:
-
-void NetworkMenuButton::OnNetworkManagerChanged(NetworkLibrary* cros) {
- // This gets called on initialization, so any changes should be reflected
- // in CrosMock::SetNetworkLibraryStatusAreaExpectations().
- SetNetworkIcon();
- network_menu_->UpdateMenu();
- RefreshNetworkObserver(cros);
- RefreshNetworkDeviceObserver(cros);
- data_promo_notification_->ShowOptionalMobileDataPromoNotification(cros, this,
- this);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NetworkMenuButton, NetworkLibrary::NetworkObserver implementation:
-void NetworkMenuButton::OnNetworkChanged(NetworkLibrary* cros,
- const Network* network) {
- SetNetworkIcon();
- network_menu_->UpdateMenu();
-}
-
-void NetworkMenuButton::OnCellularDataPlanChanged(NetworkLibrary* cros) {
- // Call OnNetworkManagerChanged which will update the icon.
- SetNetworkIcon();
- network_menu_->UpdateMenu();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NetworkMenuButton, NetworkMenu implementation:
-
-views::MenuButton* NetworkMenuButton::GetMenuButton() {
- return this;
-}
-
-gfx::NativeWindow NetworkMenuButton::GetNativeWindow() const {
- if (BaseLoginDisplayHost::default_host()) {
- // When not in browser mode i.e. login screen, status area is hosted in
- // a separate widget.
- return BaseLoginDisplayHost::default_host()->GetNativeWindow();
- } else {
- // This must always have a parent, which must have a widget ancestor.
- return parent()->GetWidget()->GetNativeWindow();
- }
-}
-
-void NetworkMenuButton::OpenButtonOptions() {
- delegate()->ExecuteStatusAreaCommand(
- this, StatusAreaButton::Delegate::SHOW_NETWORK_OPTIONS);
-}
-
-bool NetworkMenuButton::ShouldOpenButtonOptions() const {
- return delegate()->ShouldExecuteStatusAreaCommand(
- this, StatusAreaButton::Delegate::SHOW_NETWORK_OPTIONS);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NetworkMenuButton, views::View implementation:
-
-void NetworkMenuButton::OnLocaleChanged() {
- SetNetworkIcon();
- network_menu_->UpdateMenu();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NetworkMenuButton, views::MenuButtonListener implementation:
-void NetworkMenuButton::OnMenuButtonClicked(views::View* source,
- const gfx::Point& point) {
- network_menu_->RunMenu(source);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NetworkMenuButton, NetworkMenuIcon::Delegate implementation:
-void NetworkMenuButton::NetworkMenuIconChanged() {
- const SkBitmap bitmap = network_icon_->GetIconAndText(NULL);
- SetIcon(bitmap);
- SchedulePaint();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// MessageBubbleLinkListener implementation:
-
-void NetworkMenuButton::OnLinkActivated(size_t index) {
- // If we have deal info URL defined that means that there're
- // 2 links in bubble. Let the user close it manually then thus giving ability
- // to navigate to second link.
- // mobile_data_bubble_ will be set to NULL in BubbleClosing callback.
- std::string deal_info_url = data_promo_notification_->deal_info_url();
- std::string deal_topup_url = data_promo_notification_->deal_topup_url();
- if (deal_info_url.empty())
- data_promo_notification_->CloseNotification();
-
- std::string deal_url_to_open;
- if (index == 0) {
- if (!deal_topup_url.empty()) {
- deal_url_to_open = deal_topup_url;
- } else {
- const Network* cellular =
- CrosLibrary::Get()->GetNetworkLibrary()->cellular_network();
- if (!cellular)
- return;
- network_menu_->ShowTabbedNetworkSettings(cellular);
- return;
- }
- } else if (index == 1) {
- deal_url_to_open = deal_info_url;
- }
-
- if (!deal_url_to_open.empty()) {
- Browser* browser = BrowserList::GetLastActive();
- if (!browser)
- return;
- browser->ShowSingletonTab(GURL(deal_url_to_open));
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NetworkMenuButton, private methods:
-
-void NetworkMenuButton::SetNetworkIcon() {
- string16 tooltip;
- const SkBitmap bitmap = network_icon_->GetIconAndText(&tooltip);
- SetIcon(bitmap);
- SetTooltipAndAccessibleName(tooltip);
- SchedulePaint();
-}
-
-void NetworkMenuButton::RefreshNetworkObserver(NetworkLibrary* cros) {
- const Network* network = cros->active_network();
- std::string new_network = network ? network->service_path() : std::string();
- if (active_network_ != new_network) {
- if (!active_network_.empty()) {
- cros->RemoveNetworkObserver(active_network_, this);
- }
- if (!new_network.empty()) {
- cros->AddNetworkObserver(new_network, this);
- }
- active_network_ = new_network;
- }
-}
-
-void NetworkMenuButton::RefreshNetworkDeviceObserver(NetworkLibrary* cros) {
- const NetworkDevice* cellular = cros->FindCellularDevice();
- std::string new_cellular_device_path = cellular ?
- cellular->device_path() : std::string();
- if (cellular_device_path_ != new_cellular_device_path) {
- if (!cellular_device_path_.empty()) {
- cros->RemoveNetworkDeviceObserver(cellular_device_path_, this);
- }
- if (!new_cellular_device_path.empty()) {
- cros->AddNetworkDeviceObserver(new_cellular_device_path, this);
- }
- cellular_device_path_ = new_cellular_device_path;
- }
-}
-
-void NetworkMenuButton::SetTooltipAndAccessibleName(const string16& label) {
- SetTooltipText(label);
- SetAccessibleName(label);
-}
-
-} // namespace chromeos
diff --git a/chrome/browser/chromeos/status/network_menu_button.h b/chrome/browser/chromeos/status/network_menu_button.h
deleted file mode 100644
index a7cc8d4..0000000
--- a/chrome/browser/chromeos/status/network_menu_button.h
+++ /dev/null
@@ -1,132 +0,0 @@
-// Copyright (c) 2012 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_NETWORK_MENU_BUTTON_H_
-#define CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_BUTTON_H_
-#pragma once
-
-#include <string>
-
-#include "base/memory/weak_ptr.h"
-#include "base/timer.h"
-#include "chrome/browser/chromeos/cros/network_library.h"
-#include "chrome/browser/chromeos/login/message_bubble.h"
-#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"
-
-class PrefService;
-
-namespace chromeos {
-
-class DataPromoNotification;
-
-// 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
-// wifi/cellular network.
-//
-// The network menu looks like this:
-//
-// <icon> Ethernet
-// <icon> Wifi Network A
-// <icon> Wifi Network B
-// <icon> Wifi Network C
-// <icon> Cellular Network A
-// <icon> Cellular Network B
-// <icon> Cellular Network C
-// <icon> Other...
-// --------------------------------
-// Disable Wifi
-// Disable Celluar
-// --------------------------------
-// <IP Address>
-// Network settings...
-//
-// <icon> will show the strength of the wifi/cellular networks.
-// The label will be BOLD if the network is currently connected.
-class NetworkMenuButton : public StatusAreaButton,
- public views::MenuButtonListener,
- public NetworkMenu::Delegate,
- public NetworkMenuIcon::Delegate,
- public NetworkLibrary::NetworkDeviceObserver,
- public NetworkLibrary::NetworkManagerObserver,
- public NetworkLibrary::NetworkObserver,
- public NetworkLibrary::CellularDataPlanObserver,
- public MessageBubbleLinkListener {
- public:
- explicit NetworkMenuButton(StatusAreaButton::Delegate* delegate);
- virtual ~NetworkMenuButton();
-
- static void RegisterPrefs(PrefService* local_state);
-
- // NetworkLibrary::NetworkDeviceObserver implementation.
- virtual void OnNetworkDeviceChanged(NetworkLibrary* cros,
- const NetworkDevice* device) OVERRIDE;
-
- // NetworkLibrary::NetworkManagerObserver implementation.
- virtual void OnNetworkManagerChanged(NetworkLibrary* cros) OVERRIDE;
-
- // NetworkLibrary::NetworkObserver implementation.
- virtual void OnNetworkChanged(NetworkLibrary* cros,
- const Network* network) OVERRIDE;
-
- // NetworkLibrary::CellularDataPlanObserver implementation.
- virtual void OnCellularDataPlanChanged(NetworkLibrary* cros) OVERRIDE;
-
- // NetworkMenu::Delegate implementation:
- virtual views::MenuButton* GetMenuButton() OVERRIDE;
- virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE;
- virtual void OpenButtonOptions() OVERRIDE;
- virtual bool ShouldOpenButtonOptions() const OVERRIDE;
-
- // NetworkMenuIcon::Delegate implementation:
- virtual void NetworkMenuIconChanged() OVERRIDE;
-
- // views::View
- virtual void OnLocaleChanged() OVERRIDE;
-
- // views::MenuButtonListener implementation.
- virtual void OnMenuButtonClicked(views::View* source,
- const gfx::Point& point) OVERRIDE;
-
- // MessageBubbleLinkListener implementation:
- virtual void OnLinkActivated(size_t index) OVERRIDE;
-
- private:
- // Set the network icon based on the status of the |network|
- void SetNetworkIcon();
-
- // Called when the list of devices has possibly changed. This will remove
- // old network device observers and add a network observers
- // for the new devices.
- void RefreshNetworkDeviceObserver(NetworkLibrary* cros);
-
- // Called when the active network has possibly changed. This will remove
- // old network observer and add a network observer for the active network.
- void RefreshNetworkObserver(NetworkLibrary* cros);
-
- void SetTooltipAndAccessibleName(const string16& label);
-
- // The Network menu.
- scoped_ptr<NetworkMenu> network_menu_;
-
- // Path of the Cellular device that we monitor property updates from.
- std::string cellular_device_path_;
-
- // The network icon and associated data.
- scoped_ptr<NetworkMenuIcon> network_icon_;
-
- // If any network is currently active, this is the service path of the one
- // whose status is displayed in the network menu button.
- std::string active_network_;
-
- scoped_ptr<DataPromoNotification> data_promo_notification_;
-
- DISALLOW_COPY_AND_ASSIGN(NetworkMenuButton);
-};
-
-} // namespace chromeos
-
-#endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_BUTTON_H_
diff --git a/chrome/browser/chromeos/status/power_menu_button.cc b/chrome/browser/chromeos/status/power_menu_button.cc
deleted file mode 100644
index 5369b79..0000000
--- a/chrome/browser/chromeos/status/power_menu_button.cc
+++ /dev/null
@@ -1,384 +0,0 @@
-// Copyright (c) 2012 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/power_menu_button.h"
-
-#include <algorithm>
-
-#include "base/auto_reset.h"
-#include "base/string_number_conversions.h"
-#include "base/stringprintf.h"
-#include "base/time.h"
-#include "base/utf_string_conversions.h"
-#include "chrome/browser/chromeos/status/status_area_bubble.h"
-#include "chrome/browser/chromeos/view_ids.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "grit/generated_resources.h"
-#include "grit/theme_resources.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/gfx/canvas.h"
-#include "ui/gfx/font.h"
-#include "ui/gfx/image/image.h"
-#include "ui/views/controls/menu/menu_item_view.h"
-#include "ui/views/controls/menu/menu_runner.h"
-#include "ui/views/controls/menu/submenu_view.h"
-#include "ui/views/widget/widget.h"
-
-namespace {
-
-// Menu item ids.
-enum {
- POWER_BATTERY_PERCENTAGE_ITEM = 1000,
- POWER_BATTERY_IS_CHARGED_ITEM,
- POWER_NO_BATTERY,
-};
-
-enum ImageType {
- DISCHARGING,
- CHARGING,
- BOLT
-};
-
-enum ImageSize {
- SMALL,
- LARGE
-};
-
-// Initialize time deltas to large values so they will be replaced when set
-// to small values.
-const int64 kInitialMS = 0x7fffffff;
-// Width and height of small images.
-const int kSmallImageWidth = 26, kSmallImageHeight = 24;
-// Width and height of large images.
-const int kLargeImageWidth = 57, kLargeImageHeight = 35;
-// Number of different power states.
-const int kNumPowerImages = 20;
-
-// Color of text embedded within battery.
-const SkColor kPercentageColor = 0xFF333333;
-// Used for embossing text.
-const SkColor kPercentageShadowColor = 0x80ffffff;
-// Size of percentage w/in battery.
-const int kBatteryFontSizeDelta = 3;
-
-// Battery images come from two collections (small and large). In each there
-// are |kNumPowerImages| battery states for both on and off charge, followed
-// by the missing battery image and the unknown image.
-// They are layed out like this:
-// Discharging Charging Bolt
-// | | +
-// || || +
-// ...
-// ||||| ||||| +
-// ||X|| ||?||
-SkBitmap GetImage(ImageSize size, ImageType type, int index) {
- int image_width, image_height, image_index;
-
- if (size == SMALL) {
- image_index = IDR_STATUSBAR_BATTERY_SMALL_ALL;
- image_width = kSmallImageWidth;
- image_height = kSmallImageHeight;
- } else {
- image_index = IDR_STATUSBAR_BATTERY_LARGE_ALL;
- image_width = kLargeImageWidth;
- image_height = kLargeImageHeight;
- }
- const SkBitmap* all_images = ResourceBundle::GetSharedInstance().
- GetImageNamed(image_index).ToSkBitmap();
- SkIRect subset =
- SkIRect::MakeXYWH(
- static_cast<int>(type) * image_width,
- index * image_height,
- image_width,
- image_height);
-
- SkBitmap image;
- all_images->extractSubset(&image, subset);
- return image;
-}
-
-SkBitmap GetImageWithPercentage(ImageSize size, ImageType type,
- double battery_percentage) {
- // Preserve the fully charged icon for 100% only.
- int battery_index = 0;
- if (battery_percentage >= 100) {
- battery_index = kNumPowerImages - 1;
- } else {
- battery_index = static_cast<int> (
- battery_percentage / 100.0 *
- nextafter(static_cast<double>(kNumPowerImages - 1), 0));
- battery_index =
- std::max(std::min(battery_index, kNumPowerImages - 2), 0);
- }
- return GetImage(size, type, battery_index);
-}
-
-SkBitmap GetUnknownImage(ImageSize size) {
- return GetImage(size, CHARGING, kNumPowerImages);
-}
-
-class BatteryIconView : public views::View {
- public:
- BatteryIconView()
- : battery_percentage_(0),
- battery_is_present_(false),
- line_power_on_(false),
- percentage_font_(ResourceBundle::GetSharedInstance().
- GetFont(ResourceBundle::BaseFont).
- DeriveFont(kBatteryFontSizeDelta, gfx::Font::BOLD)) {
- }
-
- virtual gfx::Size GetPreferredSize() OVERRIDE {
- return gfx::Size(kLargeImageWidth, kLargeImageHeight);
- }
-
- void set_battery_percentage(double battery_percentage) {
- battery_percentage_ = battery_percentage;
- SchedulePaint();
- }
-
- void set_battery_is_present(bool battery_is_present) {
- battery_is_present_ = battery_is_present;
- SchedulePaint();
- }
-
- void set_line_power_on(bool line_power_on) {
- line_power_on_ = line_power_on;
- SchedulePaint();
- }
-
- protected:
- virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
- SkBitmap image;
- if (battery_is_present_) {
- image = GetImageWithPercentage(LARGE,
- line_power_on_ ? CHARGING : DISCHARGING,
- battery_percentage_);
- } else {
- NOTREACHED();
- return;
- }
- const int image_x = 0;
- const int image_y = (height() - image.height()) / 2;
- canvas->DrawBitmapInt(image, image_x, image_y);
-
- if (battery_is_present_ && (battery_percentage_ < 100 || !line_power_on_)) {
- const string16 text = UTF8ToUTF16(base::StringPrintf(
- "%d%%", static_cast<int>(battery_percentage_)));
- const int text_h = percentage_font_.GetHeight();
- const int text_y = ((height() - text_h) / 2);
- canvas->DrawStringInt(
- text, percentage_font_, kPercentageShadowColor,
- image_x, text_y + 1, image.width(), text_h,
- gfx::Canvas::TEXT_ALIGN_CENTER | gfx::Canvas::NO_ELLIPSIS);
- canvas->DrawStringInt(
- text, percentage_font_, kPercentageColor,
- image_x, text_y, image.width(), text_h,
- gfx::Canvas::TEXT_ALIGN_CENTER | gfx::Canvas::NO_ELLIPSIS);
- if (line_power_on_)
- canvas->DrawBitmapInt(
- GetImageWithPercentage(LARGE, BOLT, battery_percentage_),
- image_x, image_y);
- }
- }
-
- private:
- double battery_percentage_;
- bool battery_is_present_;
- bool line_power_on_;
- gfx::Font percentage_font_;
-
- DISALLOW_COPY_AND_ASSIGN(BatteryIconView);
-};
-
-} // namespace
-
-namespace chromeos {
-
-using base::TimeDelta;
-
-////////////////////////////////////////////////////////////////////////////////
-// PowerMenuButton
-
-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();
- DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this);
- DBusThreadManager::Get()->GetPowerManagerClient()->RequestStatusUpdate(
- PowerManagerClient::UPDATE_INITIAL);
-}
-
-PowerMenuButton::~PowerMenuButton() {
- DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this);
-}
-
-string16 PowerMenuButton::GetBatteryIsChargedText() const {
- // The second item shows the battery is charged if it is.
- if (battery_percentage_ >= 100 && line_power_on_)
- return l10n_util::GetStringUTF16(IDS_STATUSBAR_BATTERY_IS_CHARGED);
-
- // If battery is in an intermediate charge state, show how much time left.
- TimeDelta time = line_power_on_ ? battery_time_to_full_ :
- battery_time_to_empty_;
- if (time.InSeconds() == 0) {
- // If time is 0, then that means we are still calculating how much time.
- // Depending if line power is on, we either show a message saying that we
- // are calculating time until full or calculating remaining time.
- int msg = line_power_on_ ?
- IDS_STATUSBAR_BATTERY_CALCULATING_TIME_UNTIL_FULL :
- IDS_STATUSBAR_BATTERY_CALCULATING_TIME_UNTIL_EMPTY;
- return l10n_util::GetStringUTF16(msg);
- } else {
- // Depending if line power is on, we either show a message saying XX:YY
- // until full or XX:YY remaining where XX is number of hours and YY is
- // number of minutes.
- int msg = line_power_on_ ? IDS_STATUSBAR_BATTERY_TIME_UNTIL_FULL :
- IDS_STATUSBAR_BATTERY_TIME_UNTIL_EMPTY;
- int hour = time.InHours();
- int min = (time - TimeDelta::FromHours(hour)).InMinutes();
- string16 hour_str = base::IntToString16(hour);
- string16 min_str = base::IntToString16(min);
- // Append a "0" before the minute if it's only a single digit.
- if (min < 10)
- min_str = ASCIIToUTF16("0") + min_str;
- return l10n_util::GetStringFUTF16(msg, hour_str, min_str);
- }
-}
-
-int PowerMenuButton::icon_width() {
- return 26;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// PowerMenuButton, views::View implementation:
-void PowerMenuButton::OnLocaleChanged() {
- UpdateIconAndLabelInfo();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// PowerMenuButton, views::MenuButtonListener implementation:
-
-void PowerMenuButton::OnMenuButtonClicked(views::View* source,
- const gfx::Point& point) {
- // Explicitly query the power status.
- DBusThreadManager::Get()->GetPowerManagerClient()->RequestStatusUpdate(
- PowerManagerClient::UPDATE_USER);
-
- views::MenuItemView* menu = new views::MenuItemView(this);
- // MenuRunner takes ownership of |menu|.
- menu_runner_.reset(new views::MenuRunner(menu));
- views::MenuItemView* submenu = menu->AppendMenuItem(
- POWER_BATTERY_PERCENTAGE_ITEM,
- string16(),
- views::MenuItemView::NORMAL);
- status_ = new StatusAreaBubbleContentView(new BatteryIconView, string16());
- UpdateStatusView();
- submenu->AddChildView(status_);
- menu->CreateSubmenu()->set_resize_open_menu(true);
- menu->SetMargins(0, 0);
- submenu->SetMargins(0, 0);
- menu->ChildrenChanged();
-
- gfx::Point screen_location;
- views::View::ConvertPointToScreen(source, &screen_location);
- gfx::Rect bounds(screen_location, source->size());
- if (menu_runner_->RunMenuAt(
- source->GetWidget()->GetTopLevelWidget(), this, bounds,
- views::MenuItemView::TOPRIGHT, views::MenuRunner::HAS_MNEMONICS) ==
- views::MenuRunner::MENU_DELETED)
- return;
- status_ = NULL;
- menu_runner_.reset(NULL);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// PowerMenuButton, PowerManagerClient::Observer implementation:
-
-void PowerMenuButton::PowerChanged(const PowerSupplyStatus& power_status) {
- power_status_ = power_status;
- UpdateIconAndLabelInfo();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// PowerMenuButton, StatusAreaButton implementation:
-
-void PowerMenuButton::UpdateIconAndLabelInfo() {
- battery_is_present_ = power_status_.battery_is_present;
- line_power_on_ = power_status_.line_power_on;
-
- bool should_be_visible = battery_is_present_;
- if (should_be_visible != visible())
- SetVisible(should_be_visible);
-
- if (!should_be_visible)
- return;
-
- // If fully charged, always show 100% even if internal number is a bit less.
- if (power_status_.battery_is_full)
- battery_percentage_ = 100.0;
- else
- battery_percentage_ = power_status_.battery_percentage;
-
- UpdateBatteryTime(&battery_time_to_full_,
- TimeDelta::FromSeconds(
- power_status_.battery_seconds_to_full));
- UpdateBatteryTime(&battery_time_to_empty_,
- TimeDelta::FromSeconds(
- power_status_.battery_seconds_to_empty));
-
- SetIcon(GetImageWithPercentage(
- SMALL, line_power_on_ ? CHARGING : DISCHARGING, battery_percentage_));
- const int message_id = line_power_on_ ?
- IDS_STATUSBAR_BATTERY_CHARGING_PERCENTAGE :
- IDS_STATUSBAR_BATTERY_USING_PERCENTAGE;
- string16 tooltip_text = l10n_util::GetStringFUTF16(
- message_id, base::IntToString16(static_cast<int>(battery_percentage_)));
- SetTooltipText(tooltip_text);
- SetAccessibleName(tooltip_text);
- SchedulePaint();
- UpdateStatusView();
-}
-
-void PowerMenuButton::UpdateStatusView() {
- if (status_) {
- string16 charging_text;
- if (battery_is_present_) {
- charging_text = GetBatteryIsChargedText();
- } else {
- charging_text = l10n_util::GetStringUTF16(IDS_STATUSBAR_NO_BATTERY);
- }
- status_->SetMessage(charging_text);
- BatteryIconView* battery_icon_view =
- static_cast<BatteryIconView*>(status_->icon_view());
- battery_icon_view->set_battery_percentage(battery_percentage_);
- battery_icon_view->set_battery_is_present(battery_is_present_);
- battery_icon_view->set_line_power_on(line_power_on_);
- }
-}
-
-void PowerMenuButton::UpdateBatteryTime(TimeDelta* previous,
- const TimeDelta& current) {
- static const TimeDelta kMaxDiff(TimeDelta::FromMinutes(10));
- static const TimeDelta kMinDiff(TimeDelta::FromMinutes(0));
- const TimeDelta diff = current - *previous;
- // If the diff is small and positive, ignore it in favor of
- // keeping time monotonically decreasing.
- // If previous is 0, then it either was never set (initial condition)
- // or got down to 0.
- if (*previous == TimeDelta::FromMicroseconds(kInitialMS) ||
- diff < kMinDiff ||
- diff > kMaxDiff) {
- *previous = current;
- }
-}
-
-} // namespace chromeos
diff --git a/chrome/browser/chromeos/status/power_menu_button.h b/chrome/browser/chromeos/status/power_menu_button.h
deleted file mode 100644
index 7d29144..0000000
--- a/chrome/browser/chromeos/status/power_menu_button.h
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright (c) 2012 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_POWER_MENU_BUTTON_H_
-#define CHROME_BROWSER_CHROMEOS_STATUS_POWER_MENU_BUTTON_H_
-#pragma once
-
-#include "base/compiler_specific.h"
-#include "chrome/browser/chromeos/status/status_area_button.h"
-#include "chromeos/dbus/power_manager_client.h"
-#include "ui/views/controls/button/menu_button_listener.h"
-#include "ui/views/controls/menu/menu_delegate.h"
-
-namespace base {
-class TimeDelta;
-}
-
-namespace views {
-class MenuRunner;
-}
-
-namespace chromeos {
-
-class StatusAreaBubbleContentView;
-
-// The power menu button in the status area.
-// This class will handle getting the power status and populating the menu.
-class PowerMenuButton : public StatusAreaButton,
- public views::MenuDelegate,
- public views::MenuButtonListener,
- public PowerManagerClient::Observer {
- public:
- explicit PowerMenuButton(StatusAreaButton::Delegate* delegate);
- virtual ~PowerMenuButton();
-
- // PowerManagerClient::Observer implementation.
- virtual void PowerChanged(const PowerSupplyStatus& power_status) OVERRIDE;
- virtual void SystemResumed() OVERRIDE {}
-
- protected:
- virtual int icon_width() OVERRIDE;
-
- private:
- // views::View
- virtual void OnLocaleChanged() OVERRIDE;
-
- // views::MenuButtonListener implementation.
- virtual void OnMenuButtonClicked(views::View* source,
- const gfx::Point& point) OVERRIDE;
-
- // Format strings with power status
- string16 GetBatteryIsChargedText() const;
-
- // Update the power icon and menu label info depending on the power status.
- void UpdateIconAndLabelInfo();
-
- // Update status view
- void UpdateStatusView();
-
- // Update Battery time. Try to make it monotonically decreasing unless
- // there's a large delta.
- void UpdateBatteryTime(base::TimeDelta* previous,
- const base::TimeDelta& current);
-
- // Stored data gathered from PowerManagerClient.
- bool battery_is_present_;
- bool line_power_on_;
- double battery_percentage_;
- int battery_index_;
- PowerSupplyStatus power_status_;
-
- base::TimeDelta battery_time_to_full_;
- base::TimeDelta battery_time_to_empty_;
-
- // The currently showing status view. NULL if menu is not being displayed.
- StatusAreaBubbleContentView* status_;
-
- // If non-null the menu is showing.
- scoped_ptr<views::MenuRunner> menu_runner_;
-
- DISALLOW_COPY_AND_ASSIGN(PowerMenuButton);
-};
-
-} // namespace chromeos
-
-#endif // CHROME_BROWSER_CHROMEOS_STATUS_POWER_MENU_BUTTON_H_
diff --git a/chrome/browser/chromeos/status/status_area_bubble.cc b/chrome/browser/chromeos/status/status_area_bubble.cc
deleted file mode 100644
index 9b5f01e..0000000
--- a/chrome/browser/chromeos/status/status_area_bubble.cc
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright (c) 2012 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_bubble.h"
-
-#include "chrome/browser/ui/views/window.h"
-#include "ui/base/accessibility/accessible_view_state.h"
-#include "ui/views/bubble/bubble_delegate.h"
-#include "ui/views/controls/label.h"
-#include "ui/views/layout/box_layout.h"
-#include "ui/views/layout/fill_layout.h"
-
-namespace {
-
-const size_t kCloseBubbleTimerInSec = 5;
-
-} // namespace
-
-namespace chromeos {
-
-StatusAreaBubbleContentView::StatusAreaBubbleContentView(
- views::View* icon_view,
- const string16& message)
- : icon_view_(icon_view),
- message_view_(new views::Label(message)) {
- // Padding around status.
- const int kPadX = 10, kPadY = 5;
- // Padding between image and text.
- const int kTextPadX = 10;
-
- SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal,
- kPadX, kPadY, kTextPadX));
- AddChildView(icon_view_);
- message_view_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
- AddChildView(message_view_);
-}
-
-StatusAreaBubbleContentView::~StatusAreaBubbleContentView() {
-}
-
-string16 StatusAreaBubbleContentView::GetMessage() const {
- return message_view_->text();
-}
-
-void StatusAreaBubbleContentView::SetMessage(const string16& message) {
- message_view_->SetText(message);
-}
-
-void StatusAreaBubbleContentView::GetAccessibleState(
- ui::AccessibleViewState* state) {
- state->role = ui::AccessibilityTypes::ROLE_STATICTEXT;
- state->state = ui::AccessibilityTypes::STATE_READONLY;
- state->name = GetMessage();
-}
-
-
-// A BubbleDelegateView implementation to be used by StatusAreaBubbleController.
-// This class is also responsible for handling events while
-// StatusAreaContentView is only responsible for showing the content.
-class StatusAreaBubbleController::StatusAreaBubbleDelegateView
- : public views::BubbleDelegateView {
- public:
- explicit StatusAreaBubbleDelegateView(views::View* anchor_view)
- : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT) {
- }
-
- protected:
- // views::View override
- bool OnMousePressed(const views::MouseEvent& event) OVERRIDE {
- // Handle mouse events to close when clicked.
- return true;
- }
- // views::View override
- void OnMouseReleased(const views::MouseEvent& event) OVERRIDE {
- GetWidget()->Close();
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(StatusAreaBubbleDelegateView);
-};
-
-
-StatusAreaBubbleController::StatusAreaBubbleController()
- : bubble_(NULL) {
-}
-
-StatusAreaBubbleController::~StatusAreaBubbleController() {
- HideBubble();
-}
-
-// static
-StatusAreaBubbleController* StatusAreaBubbleController::
-ShowBubbleUnderViewForAWhile(views::View* view,
- StatusAreaBubbleContentView* content) {
- StatusAreaBubbleController* controller = new StatusAreaBubbleController;
- StatusAreaBubbleDelegateView* bubble = new StatusAreaBubbleDelegateView(view);
- bubble->SetLayoutManager(new views::FillLayout);
- bubble->AddChildView(content);
- controller->bubble_ = bubble;
- bubble->set_use_focusless(true);
- browser::CreateViewsBubbleAboveLockScreen(bubble);
- bubble->Show();
- controller->timer_.Start(FROM_HERE,
- base::TimeDelta::FromSeconds(kCloseBubbleTimerInSec),
- controller,
- &StatusAreaBubbleController::HideBubble);
-
- bubble->GetWidget()->AddObserver(controller);
- return controller;
-}
-
-void StatusAreaBubbleController::OnWidgetClosing(views::Widget* widget) {
- // There are two ways to close the bubble.
- // 1. Call Widget::Close. (This way is used by the bubble implementation.)
- // 2. Call HideBubble. (This way is used by code outside the bubble impl.)
- // OnWidgetClosing is only called in the case of 1.
- bubble_ = NULL;
-}
-
-bool StatusAreaBubbleController::IsBubbleShown() const {
- return bubble_;
-}
-
-void StatusAreaBubbleController::HideBubble() {
- if (!IsBubbleShown())
- return;
- timer_.Stop(); // no-op if it's not running.
-
- // Instead of setting |bubble_| NULL in OnWidgetClosing, do it here because
- // |this| may be deleted when OnWidgetClosing is called.
- bubble_->GetWidget()->RemoveObserver(this);
- bubble_->GetWidget()->Close();
- bubble_ = NULL;
-}
-
-} // namespace chromeos
diff --git a/chrome/browser/chromeos/status/status_area_bubble.h b/chrome/browser/chromeos/status/status_area_bubble.h
deleted file mode 100644
index 5d2ab2e..0000000
--- a/chrome/browser/chromeos/status/status_area_bubble.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_BUBBLE_H_
-#define CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_BUBBLE_H_
-#pragma once
-
-#include "base/timer.h"
-#include "ui/views/widget/widget.h"
-
-namespace views {
-class Label;
-}
-
-namespace chromeos {
-
-// StatusAreaBubbleContentView is used as the content view of
-// StatusAreaBubbleController.
-// It can be also used to show a bubble-like menu under the status area.
-class StatusAreaBubbleContentView : public views::View {
- public:
- // |icon_view| is used to show icon, |this| will take its ownership.
- StatusAreaBubbleContentView(views::View* icon_view, const string16& message);
- virtual ~StatusAreaBubbleContentView();
-
- string16 GetMessage() const;
- void SetMessage(const string16& message);
-
- views::View* icon_view() const { return icon_view_; }
-
- // views::View override
- virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
-
- private:
- views::View* icon_view_;
- views::Label* message_view_;
-
- DISALLOW_COPY_AND_ASSIGN(StatusAreaBubbleContentView);
-};
-
-// StatusAreaBubbleController is used to show a bubble under the status area
-class StatusAreaBubbleController : public views::Widget::Observer {
- public:
- virtual ~StatusAreaBubbleController();
-
- // Show bubble under |view| for a while.
- static StatusAreaBubbleController* ShowBubbleUnderViewForAWhile(
- views::View* view,
- StatusAreaBubbleContentView* content);
-
- // views::Widget::Observer override
- virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;
-
- bool IsBubbleShown() const;
- void HideBubble();
-
- private:
- class StatusAreaBubbleDelegateView;
-
- StatusAreaBubbleController();
-
- StatusAreaBubbleDelegateView* bubble_;
- // A timer to hide this bubble.
- base::OneShotTimer<StatusAreaBubbleController> timer_;
-
- DISALLOW_COPY_AND_ASSIGN(StatusAreaBubbleController);
-};
-
-} // namespace chromeos
-
-#endif // CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_BUBBLE_H_
diff --git a/chrome/browser/chromeos/status/status_area_button.cc b/chrome/browser/chromeos/status/status_area_button.cc
deleted file mode 100644
index 89bd8e2..0000000
--- a/chrome/browser/chromeos/status/status_area_button.cc
+++ /dev/null
@@ -1,171 +0,0 @@
-// Copyright (c) 2012 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_button.h"
-
-#include "grit/theme_resources.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/gfx/canvas.h"
-#include "ui/gfx/skbitmap_operations.h"
-#include "ui/views/border.h"
-#include "ui/views/view.h"
-
-namespace {
-
-// Colors for different text styles.
-const SkColor kWhitePlainTextColor = 0x99ffffff;
-const SkColor kGrayPlainTextColor = 0xff666666;
-const SkColor kWhiteHaloedTextColor = 0xb3ffffff;
-const SkColor kWhiteHaloedHaloColor = 0xb3000000;
-const SkColor kGrayEmbossedTextColor = 0xff4c4c4c;
-const SkColor kGrayEmbossedShadowColor = 0x80ffffff;
-
-// Status area font is bigger.
-const int kFontSizeDelta = 3;
-
-// Pad for status icons.
-const int kIconHorizontalPad = 2;
-
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// StatusAreaButton
-
-StatusAreaButton::StatusAreaButton(Delegate* button_delegate,
- views::MenuButtonListener* listener)
- : MenuButton(NULL, string16(), listener, false),
- menu_active_(true),
- delegate_(button_delegate) {
- set_border(NULL);
-
- light_font_ =
- ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont).
- DeriveFont(kFontSizeDelta);
- bold_font_ = light_font_.DeriveFont(0, gfx::Font::BOLD);
-
- SetShowMultipleIconStates(false);
- set_alignment(TextButton::ALIGN_CENTER);
- set_border(views::Border::CreateEmptyBorder(
- 0, kIconHorizontalPad, 0, kIconHorizontalPad));
-
- // Use an offset that is top aligned with toolbar.
- set_menu_offset(0, 4);
-
- UpdateTextStyle();
-}
-
-void StatusAreaButton::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) {
- if (state() == BS_PUSHED) {
- // Apply 10% white when pushed down.
- canvas->FillRect(GetLocalBounds(), SkColorSetARGB(0x19, 0xFF, 0xFF, 0xFF));
- }
-
- views::MenuButton::PaintButton(canvas, mode);
-}
-
-void StatusAreaButton::SetText(const string16& text) {
- // TextButtons normally remember the max text size, so the button's preferred
- // size will always be as large as the largest text ever put in it.
- // We clear that max text size, so we can adjust the size to fit the text.
- // The order is important. ClearMaxTextSize sets the size to that of the
- // current text, so it must be called after SetText.
- views::MenuButton::SetText(text);
- ClearMaxTextSize();
- PreferredSizeChanged();
-}
-
-bool StatusAreaButton::Activate() {
- if (menu_active_)
- return views::MenuButton::Activate();
- else
- return true;
-}
-
-gfx::Size StatusAreaButton::GetPreferredSize() {
- gfx::Insets insets = views::MenuButton::GetInsets();
- gfx::Size prefsize(icon_width() + insets.width(),
- icon_height() + insets.height());
-
- // Adjusts size when 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());
- }
-
- // Add padding.
- prefsize.Enlarge(2 * horizontal_padding(), 0);
-
- return prefsize;
-}
-
-gfx::Insets StatusAreaButton::GetInsets() const {
- return insets_;
-}
-
-void StatusAreaButton::OnThemeChanged() {
- UpdateTextStyle();
-}
-
-void StatusAreaButton::SetVisible(bool is_visible) {
- if (is_visible != visible()) {
- views::MenuButton::SetVisible(is_visible);
- delegate_->ButtonVisibilityChanged(this);
- }
-}
-
-bool StatusAreaButton::HitTest(const gfx::Point& l) const {
- // BrowserFrameViewChromeos adds a few pixels of pad to the top of the
- // status area. For mouse events in this area to activate the button,
- // hit testing need to be successful. We do this by clamping y to the
- // position of the menu button view.
- gfx::Point point(l.x(), std::max(y(), l.y()));
- return MenuButton::HitTest(point);
-}
-
-void StatusAreaButton::SetMenuActive(bool active) {
- menu_active_ = active;
-}
-
-void StatusAreaButton::UpdateTextStyle() {
- ClearEmbellishing();
- switch (delegate_->GetStatusAreaTextStyle()) {
- case WHITE_PLAIN_BOLD:
- SetFont(bold_font_);
- SetEnabledColor(kWhitePlainTextColor);
- break;
- case GRAY_PLAIN_LIGHT:
- SetFont(light_font_);
- SetEnabledColor(kGrayPlainTextColor);
- break;
- case WHITE_HALOED_BOLD:
- SetFont(bold_font_);
- SetEnabledColor(kWhiteHaloedTextColor);
- SetTextHaloColor(kWhiteHaloedHaloColor);
- break;
- case GRAY_EMBOSSED_BOLD:
- SetFont(bold_font_);
- SetEnabledColor(kGrayEmbossedTextColor);
- SetTextShadowColors(kGrayEmbossedShadowColor, kGrayEmbossedShadowColor);
- SetTextShadowOffset(0, 1);
- break;
- }
- SchedulePaint();
-}
-
-int StatusAreaButton::icon_height() {
- return 24;
-}
-
-int StatusAreaButton::icon_width() {
- return 23;
-}
-
-int StatusAreaButton::horizontal_padding() {
- return 1;
-}
diff --git a/chrome/browser/chromeos/status/status_area_button.h b/chrome/browser/chromeos/status/status_area_button.h
deleted file mode 100644
index 1da2407..0000000
--- a/chrome/browser/chromeos/status/status_area_button.h
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright (c) 2012 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_BUTTON_H_
-#define CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_BUTTON_H_
-#pragma once
-
-#include "base/compiler_specific.h"
-#include "base/string16.h"
-#include "ui/gfx/font.h"
-#include "ui/views/controls/button/menu_button.h"
-#include "ui/views/controls/button/menu_button_listener.h"
-
-// 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:
- // Different text styles for different types of backgrounds.
- enum TextStyle {
- WHITE_PLAIN_BOLD,
- GRAY_PLAIN_LIGHT,
- WHITE_HALOED_BOLD,
- GRAY_EMBOSSED_BOLD
- };
-
- class Delegate {
- public:
- // Commands to be passed to ExecuteCommand().
- enum Command {
- SHOW_LANGUAGE_OPTIONS,
- SHOW_NETWORK_OPTIONS,
- SHOW_DATE_OPTIONS
- };
-
- // |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;
-
- // Get the style that should currently be used in rendering the button's
- // text.
- 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::MenuButtonListener* menu_button_listener);
- virtual ~StatusAreaButton() {}
- virtual void PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) OVERRIDE;
-
- // Overrides TextButton's SetText to clear max text size before seting new
- // text content so that the button size would fit the new text size.
- virtual void SetText(const string16& text) OVERRIDE;
-
- // views::MenuButton overrides.
- virtual bool Activate() OVERRIDE;
-
- // View overrides.
- virtual gfx::Size GetPreferredSize() OVERRIDE;
- virtual gfx::Insets GetInsets() const OVERRIDE;
- virtual void OnThemeChanged() OVERRIDE;
- virtual void SetVisible(bool visible) OVERRIDE;
- virtual bool HitTest(const gfx::Point& l) const OVERRIDE;
-
- // Sets menu_active_. Override this to perform additional actions when
- // menus are activated.
- virtual void SetMenuActive(bool active);
-
- // Refresh the style used to paint this button's text. Schedules repaint.
- void UpdateTextStyle();
-
- 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();
-
- // Subclasses can override this method to return more or less padding.
- // The padding is added to both the left and right side.
- virtual int horizontal_padding();
-
- // Insets to use for this button.
- gfx::Insets insets_;
-
- // 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:
- Delegate* delegate_;
-
- // Fonts used to render the button's text.
- gfx::Font light_font_;
- gfx::Font bold_font_;
-
- DISALLOW_COPY_AND_ASSIGN(StatusAreaButton);
-};
-
-#endif // CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_BUTTON_H_
diff --git a/chrome/browser/chromeos/status/status_area_view.cc b/chrome/browser/chromeos/status/status_area_view.cc
deleted file mode 100644
index 74c4791..0000000
--- a/chrome/browser/chromeos/status/status_area_view.cc
+++ /dev/null
@@ -1,213 +0,0 @@
-// Copyright (c) 2012 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.h"
-
-#include <algorithm>
-
-#include "base/bind.h"
-#include "base/command_line.h"
-#include "base/message_loop.h"
-#include "chrome/browser/chromeos/view_ids.h"
-#include "ui/gfx/canvas.h"
-#include "ui/views/border.h"
-
-#if defined(USE_ASH)
-#include "ash/focus_cycler.h"
-#include "ash/shell.h"
-#endif
-
-// Number of pixels to separate each icon.
-const int kSeparation = 0;
-
-StatusAreaView::StatusAreaView()
- : need_return_focus_(false),
- skip_next_focus_return_(true) {
- set_id(VIEW_ID_STATUS_AREA);
-}
-
-StatusAreaView::~StatusAreaView() {
-}
-
-void StatusAreaView::AddButton(StatusAreaButton* button, ButtonBorder border) {
- buttons_.push_back(button);
- if (border == HAS_BORDER)
- button->set_border(views::Border::CreateEmptyBorder(0, 1, 0, 0));
- AddChildView(button);
- UpdateButtonVisibility();
-}
-
-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;
-
- for (int i = 0; i < child_count(); i++) {
- views::View* cur = child_at(i);
- gfx::Size cur_size = cur->GetPreferredSize();
- if (cur->visible() && !cur_size.IsEmpty()) {
- if (result_w == 0)
- result_w = kSeparation;
-
- // Add each width.
- result_w += cur_size.width() + kSeparation;
- // Use max height.
- result_h = std::max(result_h, cur_size.height());
- }
- }
- return gfx::Size(result_w, result_h);
-}
-
-void StatusAreaView::Layout() {
- int cur_x = kSeparation;
- for (int i = 0; i < child_count(); i++) {
- views::View* cur = child_at(i);
- gfx::Size cur_size = cur->GetPreferredSize();
- if (cur->visible() && !cur_size.IsEmpty()) {
- int cur_y = (height() - cur_size.height()) / 2;
-
- // Handle odd number of pixels.
- cur_y += (height() - cur_size.height()) % 2;
-
- // Put next in row horizontally, and center vertically.
- cur->SetBounds(cur_x, cur_y, cur_size.width(), cur_size.height());
- cur_x += cur_size.width() + kSeparation;
- }
- }
-}
-
-void StatusAreaView::PreferredSizeChanged() {
- if (GetWidget())
- GetWidget()->SetSize(GetPreferredSize());
- views::AccessiblePaneView::PreferredSizeChanged();
-}
-
-void StatusAreaView::ChildPreferredSizeChanged(View* child) {
- // When something like the clock menu button's size changes, we need to
- // relayout. Also mark that this view's size has changed. This will let
- // BrowserView know to relayout, which will reset the bounds of this view.
- Layout();
- PreferredSizeChanged();
-}
-
-bool StatusAreaView::CanActivate() const {
-#if defined(USE_ASH)
- // We don't want mouse clicks to activate us, but we need to allow
- // activation when the user is using the keyboard, such as by the FocusCycler
- // or on the Login screen.
- ash::internal::FocusCycler* focus_cycler =
- ash::Shell::GetInstance()->focus_cycler();
- return focus_cycler->widget_activating() == GetWidget() ||
- need_return_focus_;
-#else
- return false;
-#endif
-}
-
-void StatusAreaView::DeleteDelegate() {
-#if defined(USE_ASH)
- // If this is used as the content-view of the widget, then do nothing, since
- // deleting the widget will end up deleting this. But if this is used only as
- // the widget-delegate, then delete this now.
- if (!GetWidget()) {
- delete this;
- return;
- }
-#endif
- WidgetDelegate::DeleteDelegate();
-}
-
-views::Widget* StatusAreaView::GetWidget() {
- return View::GetWidget();
-}
-
-const views::Widget* StatusAreaView::GetWidget() const {
- return View::GetWidget();
-}
-
-void StatusAreaView::MakeButtonsActive(bool active) {
- for (std::list<StatusAreaButton*>::iterator iter = buttons_.begin();
- iter != buttons_.end(); ++iter) {
- (*iter)->SetMenuActive(active);
- }
-}
-
-void StatusAreaView::UpdateButtonVisibility() {
- Layout();
- PreferredSizeChanged();
-}
-
-void StatusAreaView::UpdateButtonTextStyle() {
- for (std::list<StatusAreaButton*>::const_iterator it = buttons_.begin();
- it != buttons_.end(); ++it) {
- StatusAreaButton* button = *it;
- button->UpdateTextStyle();
- }
-}
-
-void StatusAreaView::TakeFocus(
- bool reverse,
- const ReturnFocusCallback& return_focus_cb) {
- SetPaneFocus(reverse ? GetLastFocusableChild() : GetFirstFocusableChild());
- need_return_focus_ = true;
- return_focus_cb_ = return_focus_cb;
- GetWidget()->AddObserver(this);
-}
-
-void StatusAreaView::ReturnFocus(bool reverse) {
- ClearFocus();
- return_focus_cb_.Run(reverse);
-}
-
-void StatusAreaView::ClearFocus() {
- GetWidget()->RemoveObserver(this);
- RemovePaneFocus();
- focus_manager_->ClearFocus();
- need_return_focus_ = false;
-}
-
-void StatusAreaView::OnDidChangeFocus(views::View* focused_before,
- views::View* focused_now) {
- views::AccessiblePaneView::OnDidChangeFocus(focused_before, focused_now);
- if (need_return_focus_ && !skip_next_focus_return_) {
- const views::View* first = GetFirstFocusableChild();
- const views::View* last = GetLastFocusableChild();
- const bool first_to_last = (focused_before == first && focused_now == last);
- const bool last_to_first = (focused_now == first && focused_before == last);
-
- if (first_to_last || last_to_first)
- ReturnFocus(first_to_last);
- }
- skip_next_focus_return_ = false;
-}
-
-void StatusAreaView::OnWidgetActivationChanged(views::Widget* widget,
- bool active) {
- if (!active)
- ClearFocus();
-}
-
-bool StatusAreaView::AcceleratorPressed(const ui::Accelerator& accelerator) {
- if (need_return_focus_ && accelerator.key_code() == ui::VKEY_ESCAPE) {
- // Override Escape handling to return focus back.
- ReturnFocus(false);
- return true;
- } else if (accelerator.key_code() == ui::VKEY_HOME ||
- accelerator.key_code() == ui::VKEY_END) {
- // Do not return focus if it wraps right after pressing Home/End.
- skip_next_focus_return_ = true;
- }
- return AccessiblePaneView::AcceleratorPressed(accelerator);
-}
diff --git a/chrome/browser/chromeos/status/status_area_view.h b/chrome/browser/chromeos/status/status_area_view.h
deleted file mode 100644
index 6864b0b..0000000
--- a/chrome/browser/chromeos/status/status_area_view.h
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright (c) 2012 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_H_
-#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 "ui/views/accessible_pane_view.h"
-#include "ui/views/view.h"
-#include "ui/views/widget/widget.h"
-#include "ui/views/widget/widget_delegate.h"
-
-// 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 views::AccessiblePaneView,
- public views::Widget::Observer,
- public base::SupportsWeakPtr<StatusAreaView>,
- public views::WidgetDelegate {
- public:
- enum ButtonBorder {
- NO_BORDER,
- HAS_BORDER
- };
-
- StatusAreaView();
- virtual ~StatusAreaView();
-
- void AddButton(StatusAreaButton* button, ButtonBorder border);
- void RemoveButton(StatusAreaButton* button);
-
- void MakeButtonsActive(bool active);
- void UpdateButtonVisibility();
-
- // Refresh the style used to paint all buttons' text. Schedules repaint.
- void UpdateButtonTextStyle();
-
- // Takes focus and transfers it to the first (last if |reverse| is true).
- // After focus has traversed through all elements, clears focus and calls
- // |return_focus_cb(reverse)| from the message loop.
- typedef base::Callback<void(bool)> ReturnFocusCallback;
- void TakeFocus(bool reverse,
- const ReturnFocusCallback& return_focus_cb);
-
- // views::View* overrides.
- virtual gfx::Size GetPreferredSize() OVERRIDE;
- virtual void Layout() OVERRIDE;
- virtual void PreferredSizeChanged() OVERRIDE;
- virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE;
-
- // views::WidgetDelegate overrides:
- virtual bool CanActivate() const OVERRIDE;
- virtual void DeleteDelegate() OVERRIDE;
- virtual views::Widget* GetWidget() OVERRIDE;
- virtual const views::Widget* GetWidget() const OVERRIDE;
-
- private:
- // Overridden from views::FocusChangeListener:
- virtual void OnDidChangeFocus(views::View* focused_before,
- views::View* focused_now) OVERRIDE;
-
- // Overriden from views::Widget::Observer:
- virtual void OnWidgetActivationChanged(views::Widget* widget,
- bool active) OVERRIDE;
-
- // Overriden from views::AccessiblePaneView:
- virtual bool AcceleratorPressed(const ui::Accelerator& accelerator)
- OVERRIDE;
-
- StatusAreaButton::Delegate* delegate_;
-
- // True if focus needs to be returned via |return_focus_cb_| when it wraps.
- bool need_return_focus_;
- // True if focus return should be skipped for next focus change.
- bool skip_next_focus_return_;
- ReturnFocusCallback return_focus_cb_;
-
- std::list<StatusAreaButton*> buttons_;
-
- // Clears focus and calls |return_focus_cb_|.
- void ReturnFocus(bool reverse);
-
- // Clears focus (called when widget is deactivated).
- void ClearFocus();
-
- DISALLOW_COPY_AND_ASSIGN(StatusAreaView);
-};
-
-#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
deleted file mode 100644
index 5503b49..0000000
--- a/chrome/browser/chromeos/status/status_area_view_chromeos.cc
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright (c) 2012 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/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/status/volume_menu_button.h"
-#include "chrome/browser/chromeos/view_ids.h"
-#include "chrome/common/chrome_switches.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-
-namespace chromeos {
-
-// static
-StatusAreaViewChromeos::ScreenMode
- StatusAreaViewChromeos::screen_mode_ = BROWSER_MODE;
-
-// static
-bool StatusAreaViewChromeos::IsBrowserMode() {
- return screen_mode_ == BROWSER_MODE;
-}
-
-// static
-bool StatusAreaViewChromeos::IsLoginMode() {
- return screen_mode_ == LOGIN_MODE_WEBUI;
-}
-
-// static
-bool StatusAreaViewChromeos::IsScreenLockMode() {
- return screen_mode_ == SCREEN_LOCKER_MODE;
-}
-
-// static
-void StatusAreaViewChromeos::SetScreenMode(ScreenMode mode) {
- screen_mode_ = mode;
-}
-
-StatusAreaViewChromeos::StatusAreaViewChromeos() {
- DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this);
- system::TimezoneSettings::GetInstance()->AddObserver(this);
-}
-
-StatusAreaViewChromeos::~StatusAreaViewChromeos() {
- DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this);
- system::TimezoneSettings::GetInstance()->RemoveObserver(this);
-}
-
-void StatusAreaViewChromeos::Init(StatusAreaButton::Delegate* delegate) {
- AddChromeosButtons(this, delegate, NULL);
-}
-
-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();
-}
-
-// static
-void StatusAreaViewChromeos::AddChromeosButtons(
- StatusAreaView* status_area,
- StatusAreaButton::Delegate* delegate,
- ClockMenuButton** clock_button) {
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kMemoryWidget))
- status_area->AddButton(new MemoryMenuButton(delegate),
- StatusAreaView::NO_BORDER);
-
- status_area->AddButton(new AccessibilityMenuButton(delegate),
- StatusAreaView::HAS_BORDER);
- status_area->AddButton(new CapsLockMenuButton(delegate),
- StatusAreaView::HAS_BORDER);
- ClockMenuButton* clock = new ClockMenuButton(delegate);
- status_area->AddButton(clock, StatusAreaView::HAS_BORDER);
- if (clock_button)
- *clock_button = clock;
-
- status_area->AddButton(new VolumeMenuButton(delegate),
- StatusAreaView::NO_BORDER);
- status_area->AddButton(new InputMethodMenuButton(delegate),
- StatusAreaView::NO_BORDER);
- status_area->AddButton(new NetworkMenuButton(delegate),
- StatusAreaView::NO_BORDER);
- status_area->AddButton(new PowerMenuButton(delegate),
- StatusAreaView::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
deleted file mode 100644
index 6e6a42b..0000000
--- a/chrome/browser/chromeos/status/status_area_view_chromeos.h
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright (c) 2012 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/system/timezone_settings.h"
-#include "chrome/browser/chromeos/view_ids.h"
-#include "chromeos/dbus/power_manager_client.h"
-
-class ClockMenuButton;
-
-namespace chromeos {
-
-class StatusAreaViewChromeos : public StatusAreaView,
- public PowerManagerClient::Observer,
- public system::TimezoneSettings::Observer {
- public:
- // The type of screen the host window is on.
- enum ScreenMode {
- 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.
- };
-
- // True if the browser is visible (i.e. not login/OOBE).
- static bool IsBrowserMode();
-
- // True if not logged in into user session (i.e. login/OOBE).
- // It's not always !IsBrowserMode() as there's SCREEN_LOCKER_MODE which
- // is inside user session, using login host and browser is not available.
- static bool IsLoginMode();
-
- // True if user is logged in but browser session is not available
- // as screen lock is active.
- static bool IsScreenLockMode();
-
- // Sets current screen mode.
- static void SetScreenMode(ScreenMode mode);
-
- explicit StatusAreaViewChromeos();
- virtual ~StatusAreaViewChromeos();
-
- void Init(StatusAreaButton::Delegate* delegate);
-
- // PowerManagerClient::Observer:
- virtual void SystemResumed() OVERRIDE;
-
- // TimezoneSettings::Observer:
- virtual void TimezoneChanged(const icu::TimeZone& timezone) OVERRIDE;
-
- // Convenience function to add buttons to a status area for ChromeOS.
- // |clock_button| (if non-NULL) is set to the ClockMenuButton that is created
- // by this method.
- static void AddChromeosButtons(StatusAreaView* status_area,
- StatusAreaButton::Delegate* delegate,
- ClockMenuButton** clock_button);
-
- private:
- // Current screen mode of the status area.
- static ScreenMode screen_mode_;
-
- 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/status/volume_menu_button.cc b/chrome/browser/chromeos/status/volume_menu_button.cc
deleted file mode 100644
index e67295eb..0000000
--- a/chrome/browser/chromeos/status/volume_menu_button.cc
+++ /dev/null
@@ -1,265 +0,0 @@
-// Copyright (c) 2012 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/volume_menu_button.h"
-
-#include <algorithm>
-
-#include "base/command_line.h"
-#include "base/string_number_conversions.h"
-#include "chrome/browser/chromeos/status/status_area_bubble.h"
-#include "chrome/browser/chromeos/view_ids.h"
-#include "chrome/common/chrome_switches.h"
-#include "grit/generated_resources.h"
-#include "grit/theme_resources.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/gfx/canvas.h"
-#include "ui/gfx/image/image.h"
-#include "ui/views/controls/menu/menu_item_view.h"
-#include "ui/views/controls/menu/menu_runner.h"
-#include "ui/views/controls/menu/submenu_view.h"
-
-namespace chromeos {
-
-namespace {
-
-const int kMenuItemId = 100; // arbitrary menu id.
-// TODO(achuith): Minimum width of MenuItemView is 27, which is too wide.
-const int kVolumeMenuWidth = 27;
-const int kVolumeIconWidth = 20;
-
-bool ShouldShowStatusAreaVolume() {
- return CommandLine::ForCurrentProcess()->
- HasSwitch(switches::kShowVolumeStatus);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// AudioHandler helpers
-
-// Used when not running on a ChromeOS device.
-static int g_volume_percent = 0;
-
-int GetVolumePercent() {
- AudioHandler* audio_handler = AudioHandler::GetInstance();
- if (audio_handler)
- return audio_handler->IsMuted() ? 0 : audio_handler->GetVolumePercent();
- return g_volume_percent;
-}
-
-void SetVolumePercent(int percent) {
- AudioHandler* audio_handler = AudioHandler::GetInstance();
- if (audio_handler)
- audio_handler->SetVolumePercent(percent);
- g_volume_percent = percent;
-}
-
-void AddVolumeObserver(AudioHandler::VolumeObserver* volume_observer) {
- AudioHandler::GetInstance()->AddVolumeObserver(volume_observer);
-}
-
-void RemoveVolumeObserver(AudioHandler::VolumeObserver* volume_observer) {
- if (AudioHandler::GetInstance())
- AudioHandler::GetInstance()->RemoveVolumeObserver(volume_observer);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// SkBitmap helpers
-
-const SkBitmap* GetImageNamed(int image_index) {
- return ResourceBundle::GetSharedInstance().
- GetImageNamed(image_index).ToSkBitmap();
-}
-
-const SkBitmap* GetIcon() {
- const int volume_percent = GetVolumePercent();
- int image_index = IDR_STATUSBAR_VOLUME_ICON_MUTE;
-
- if (volume_percent > 67)
- image_index = IDR_STATUSBAR_VOLUME_ICON3;
- else if (volume_percent > 33)
- image_index = IDR_STATUSBAR_VOLUME_ICON2;
- else if (volume_percent > 0)
- image_index = IDR_STATUSBAR_VOLUME_ICON1;
-
- return GetImageNamed(image_index);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// VolumeControlView
-
-class VolumeControlView : public views::View,
- public AudioHandler::VolumeObserver {
- public:
- explicit VolumeControlView(VolumeMenuButton* volume_menu_button);
- virtual ~VolumeControlView();
-
- private:
- // views::View overrides:
- virtual gfx::Size GetPreferredSize() OVERRIDE;
- virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
- virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE;
- virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE;
-
- // AudioHandler::VolumeObserver overrides:
- virtual void OnVolumeChanged() OVERRIDE;
-
- VolumeMenuButton* volume_menu_button_; // not owned.
-
- const SkBitmap* slider_empty_;
- const SkBitmap* slider_full_;
- const SkBitmap* thumb_;
-
- int slider_w_;
- int slider_h_;
- int thumb_h_;
-
- DISALLOW_COPY_AND_ASSIGN(VolumeControlView);
-};
-
-VolumeControlView::VolumeControlView(
- VolumeMenuButton* volume_menu_button)
- : volume_menu_button_(volume_menu_button),
- slider_empty_(GetImageNamed(IDR_STATUSBAR_VOLUME_SLIDER_EMPTY)),
- slider_full_(GetImageNamed(IDR_STATUSBAR_VOLUME_SLIDER_FULL)),
- thumb_(GetImageNamed(IDR_STATUSBAR_VOLUME_SLIDER_THUMB)),
- slider_w_(slider_empty_->width()),
- slider_h_(slider_empty_->height()),
- thumb_h_(thumb_->height()) {
- DCHECK_EQ(slider_w_, slider_full_->width());
- AddVolumeObserver(this);
-}
-
-VolumeControlView::~VolumeControlView() {
- RemoveVolumeObserver(this);
-}
-
-gfx::Size VolumeControlView::GetPreferredSize() {
- return gfx::Size(kVolumeMenuWidth, slider_h_ + thumb_h_);
-}
-
-void VolumeControlView::OnPaint(gfx::Canvas* canvas) {
- const int slider_x = (width() - slider_w_) / 2;
- const int thumb_x = (width() - thumb_->width()) / 2;
- const int slider_empty_y = thumb_->height() / 2.0;
-
- const int slider_empty_h = slider_h_ * (100 - GetVolumePercent()) / 100;
- const int slider_full_y = slider_empty_h + slider_empty_y;
- const int slider_full_h = slider_h_ - slider_empty_h;
-
- const int thumb_y = slider_empty_h;
-
- if (slider_empty_h != 0) {
- canvas->DrawBitmapInt(*slider_empty_,
- 0, 0, slider_w_, slider_empty_h,
- slider_x, slider_empty_y, slider_w_, slider_empty_h,
- false);
- }
-
- if (slider_full_h != 0) {
- canvas->DrawBitmapInt(*slider_full_,
- 0, slider_empty_h, slider_w_, slider_full_h,
- slider_x, slider_full_y, slider_w_, slider_full_h,
- false);
- }
-
- canvas->DrawBitmapInt(*thumb_, thumb_x, thumb_y);
-}
-
-bool VolumeControlView::OnMousePressed(const views::MouseEvent& event) {
- return OnMouseDragged(event);
-}
-
-bool VolumeControlView::OnMouseDragged(const views::MouseEvent& event) {
- const int slider_empty_y = thumb_->height() / 2.0;
- const int new_volume = 100 - (std::max(std::min((event.y() - slider_empty_y),
- slider_h_), 0) * 100 / slider_h_);
- if (new_volume != GetVolumePercent()) {
- SetVolumePercent(new_volume);
- SchedulePaint();
- volume_menu_button_->UpdateIcon();
- }
- return true;
-}
-
-void VolumeControlView::OnVolumeChanged() {
- SchedulePaint();
-}
-
-} // namespace
-
-////////////////////////////////////////////////////////////////////////////////
-// VolumeMenuButton
-
-VolumeMenuButton::VolumeMenuButton(StatusAreaButton::Delegate* delegate)
- : StatusAreaButton(delegate, this) {
- set_id(VIEW_ID_STATUS_BUTTON_VOLUME);
- UpdateIcon();
- SetVisible(ShouldShowStatusAreaVolume());
- AddVolumeObserver(this);
-}
-
-VolumeMenuButton::~VolumeMenuButton() {
- RemoveVolumeObserver(this);
-}
-
-int VolumeMenuButton::icon_width() {
- return kVolumeIconWidth;
-}
-
-void VolumeMenuButton::UpdateIcon() {
- const int volume_percent = GetVolumePercent();
- string16 tooltip_text = (volume_percent == 0)
- ? l10n_util::GetStringUTF16(IDS_STATUSBAR_VOLUME_MUTE)
- : l10n_util::GetStringFUTF16(IDS_STATUSBAR_VOLUME_PERCENTAGE,
- base::IntToString16(volume_percent));
- SetTooltipText(tooltip_text);
- SetAccessibleName(tooltip_text);
-
- SetIcon(*GetIcon());
- SchedulePaint();
-}
-
-void VolumeMenuButton::OnLocaleChanged() {
- UpdateIcon();
-}
-
-void VolumeMenuButton::OnVolumeChanged() {
- UpdateIcon();
-}
-
-void VolumeMenuButton::OnMenuButtonClicked(views::View* source,
- const gfx::Point& point) {
- // TODO(achuith): Minimum width of MenuItemView is 27 pix which is too wide
- // for our purposes here.
- views::MenuItemView* menu = new views::MenuItemView(this);
- // MenuRunner takes ownership of |menu|.
- views::MenuRunner* menu_runner = new views::MenuRunner(menu);
- views::MenuItemView* submenu = menu->AppendMenuItem(
- kMenuItemId,
- string16(),
- views::MenuItemView::NORMAL);
- submenu->AddChildView(new StatusAreaBubbleContentView(
- new VolumeControlView(this), string16()));
- menu->CreateSubmenu()->set_resize_open_menu(true);
- menu->SetMargins(0, 0);
- submenu->SetMargins(0, 0);
- menu->ChildrenChanged();
-
- gfx::Point screen_location;
- views::View::ConvertPointToScreen(source, &screen_location);
- gfx::Rect bounds(screen_location, source->size());
-
- views::MenuRunner::RunResult result = menu_runner->RunMenuAt(
- source->GetWidget()->GetTopLevelWidget(),
- this,
- bounds,
- views::MenuItemView::TOPRIGHT,
- views::MenuRunner::HAS_MNEMONICS);
-
- if (result != views::MenuRunner::MENU_DELETED)
- delete menu_runner;
-}
-
-} // namespace chromeos
diff --git a/chrome/browser/chromeos/status/volume_menu_button.h b/chrome/browser/chromeos/status/volume_menu_button.h
deleted file mode 100644
index 9d236b7..0000000
--- a/chrome/browser/chromeos/status/volume_menu_button.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (c) 2012 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_VOLUME_MENU_BUTTON_H_
-#define CHROME_BROWSER_CHROMEOS_STATUS_VOLUME_MENU_BUTTON_H_
-#pragma once
-
-#include "base/compiler_specific.h"
-#include "chrome/browser/chromeos/audio/audio_handler.h"
-#include "chrome/browser/chromeos/status/status_area_button.h"
-#include "ui/views/controls/button/menu_button_listener.h"
-#include "ui/views/controls/menu/menu_delegate.h"
-
-namespace chromeos {
-
-// The volume button in the status area.
-class VolumeMenuButton : public StatusAreaButton,
- public views::MenuDelegate,
- public views::MenuButtonListener,
- public AudioHandler::VolumeObserver {
- public:
- explicit VolumeMenuButton(StatusAreaButton::Delegate* delegate);
- virtual ~VolumeMenuButton();
-
- // Update the volume icon.
- void UpdateIcon();
-
- protected:
- // StatusAreaButton implementation.
- virtual int icon_width() OVERRIDE;
-
- private:
- // views::View implementation.
- virtual void OnLocaleChanged() OVERRIDE;
-
- // views::MenuButtonListener implementation.
- virtual void OnMenuButtonClicked(views::View* source,
- const gfx::Point& point) OVERRIDE;
-
- // AudioHandler::VolumeObserver implementation.
- virtual void OnVolumeChanged() OVERRIDE;
-
- DISALLOW_COPY_AND_ASSIGN(VolumeMenuButton);
-};
-
-} // namespace chromeos
-
-#endif // CHROME_BROWSER_CHROMEOS_STATUS_VOLUME_MENU_BUTTON_H_
diff --git a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
index 10887c8..f1f5f26 100644
--- a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
+++ b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
@@ -84,12 +84,7 @@ void ExtractIMEInfo(const input_method::InputMethodDescriptor& ime,
const input_method::InputMethodUtil& util,
ash::IMEInfo* info) {
info->id = ime.id();
- std::string name = util.GetInputMethodDisplayNameFromId(info->id);
- if (name.empty()) {
- name = ime.name();
- }
- info->name = UTF8ToUTF16(name);
-
+ info->name = util.GetInputMethodLongName(ime);
info->short_name = util.GetInputMethodShortName(ime);
}
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index a1bf4ce..4082f01 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -90,8 +90,7 @@
#include "chrome/browser/chromeos/login/wizard_controller.h"
#include "chrome/browser/chromeos/preferences.h"
#include "chrome/browser/chromeos/proxy_config_service_impl.h"
-#include "chrome/browser/chromeos/status/input_method_menu.h"
-#include "chrome/browser/chromeos/status/network_menu_button.h"
+#include "chrome/browser/chromeos/status/data_promo_notification.h"
#include "chrome/browser/policy/auto_enrollment_client.h"
#include "chrome/browser/policy/device_status_collector.h"
#else
@@ -157,7 +156,7 @@ void RegisterLocalState(PrefService* local_state) {
#if defined(OS_CHROMEOS)
chromeos::AudioHandler::RegisterPrefs(local_state);
chromeos::language_prefs::RegisterPrefs(local_state);
- chromeos::NetworkMenuButton::RegisterPrefs(local_state);
+ chromeos::DataPromoNotification::RegisterPrefs(local_state);
chromeos::ProxyConfigServiceImpl::RegisterPrefs(local_state);
chromeos::UserManager::RegisterPrefs(local_state);
chromeos::ServicesCustomizationDocument::RegisterPrefs(local_state);
diff --git a/chrome/browser/ui/views/ash/chrome_shell_delegate.cc b/chrome/browser/ui/views/ash/chrome_shell_delegate.cc
index 4aa8672..c7713de 100644
--- a/chrome/browser/ui/views/ash/chrome_shell_delegate.cc
+++ b/chrome/browser/ui/views/ash/chrome_shell_delegate.cc
@@ -15,7 +15,6 @@
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/views/ash/app_list/app_list_view_delegate.h"
#include "chrome/browser/ui/views/ash/launcher/chrome_launcher_delegate.h"
-#include "chrome/browser/ui/views/ash/status_area_host_aura.h"
#include "chrome/browser/ui/views/ash/window_positioner.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/common/chrome_notification_types.h"
@@ -52,17 +51,6 @@ ChromeShellDelegate::~ChromeShellDelegate() {
instance_ = NULL;
}
-StatusAreaView* ChromeShellDelegate::GetStatusArea() {
- return status_area_host_->GetStatusArea();
-}
-
-views::Widget* ChromeShellDelegate::CreateStatusArea() {
- status_area_host_.reset(new StatusAreaHostAura());
- views::Widget* status_area_widget =
- status_area_host_.get()->CreateStatusArea();
- return status_area_widget;
-}
-
bool ChromeShellDelegate::IsUserLoggedIn() {
#if defined(OS_CHROMEOS)
// When running a Chrome OS build outside of a device (i.e. on a developer's
diff --git a/chrome/browser/ui/views/ash/chrome_shell_delegate.h b/chrome/browser/ui/views/ash/chrome_shell_delegate.h
index bad11ac..ac3ef43 100644
--- a/chrome/browser/ui/views/ash/chrome_shell_delegate.h
+++ b/chrome/browser/ui/views/ash/chrome_shell_delegate.h
@@ -14,8 +14,6 @@
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
-class StatusAreaHostAura;
-class StatusAreaView;
class WindowPositioner;
namespace views {
@@ -30,16 +28,9 @@ class ChromeShellDelegate : public ash::ShellDelegate,
static ChromeShellDelegate* instance() { return instance_; }
- StatusAreaHostAura* status_area_host() {
- return status_area_host_.get();
- }
-
- StatusAreaView* GetStatusArea();
-
WindowPositioner* window_positioner() { return window_positioner_.get(); }
// ash::ShellDelegate overrides;
- virtual views::Widget* CreateStatusArea() OVERRIDE;
virtual bool IsUserLoggedIn() OVERRIDE;
virtual void LockScreen() OVERRIDE;
virtual void UnlockScreen() OVERRIDE;
@@ -65,7 +56,6 @@ class ChromeShellDelegate : public ash::ShellDelegate,
content::NotificationRegistrar registrar_;
- scoped_ptr<StatusAreaHostAura> status_area_host_;
scoped_ptr<WindowPositioner> window_positioner_;
DISALLOW_COPY_AND_ASSIGN(ChromeShellDelegate);
diff --git a/chrome/browser/ui/views/ash/status_area_host_aura.cc b/chrome/browser/ui/views/ash/status_area_host_aura.cc
deleted file mode 100644
index 1afc059..0000000
--- a/chrome/browser/ui/views/ash/status_area_host_aura.cc
+++ /dev/null
@@ -1,230 +0,0 @@
-// Copyright (c) 2012 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/ui/views/ash/status_area_host_aura.h"
-
-#include "ash/shell_window_ids.h"
-#include "base/command_line.h"
-#include "chrome/browser/chromeos/status/clock_menu_button.h"
-#include "chrome/browser/chromeos/status/memory_menu_button.h"
-#include "chrome/browser/chromeos/status/status_area_view.h"
-#include "chrome/browser/defaults.h"
-#include "chrome/browser/prefs/incognito_mode_prefs.h"
-#include "chrome/browser/profiles/profile_manager.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/view_ids.h"
-#include "chrome/browser/ui/views/ash/chrome_shell_delegate.h"
-#include "chrome/common/chrome_notification_types.h"
-#include "chrome/common/chrome_switches.h"
-#include "content/public/browser/notification_service.h"
-#include "ui/aura/window.h"
-#include "ui/views/widget/widget.h"
-
-#if defined(OS_CHROMEOS)
-#include "base/chromeos/chromeos_version.h"
-#include "chrome/browser/chromeos/login/base_login_display_host.h"
-#include "chrome/browser/chromeos/login/proxy_settings_dialog.h"
-#include "chrome/browser/chromeos/login/screen_locker.h"
-#include "chrome/browser/chromeos/login/user_manager.h"
-#include "chrome/browser/chromeos/status/clock_updater.h"
-#include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
-#include "ui/gfx/native_widget_types.h"
-#endif
-
-StatusAreaHostAura::StatusAreaHostAura()
- : status_area_widget_(NULL),
- status_area_view_(NULL) {
- BrowserList::AddObserver(this);
- registrar_.Add(this,
- chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
- content::NotificationService::AllSources());
-#if defined(OS_CHROMEOS)
- registrar_.Add(this,
- chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED,
- content::NotificationService::AllSources());
-#endif
-}
-
-StatusAreaHostAura::~StatusAreaHostAura() {
- BrowserList::RemoveObserver(this);
-}
-
-StatusAreaView* StatusAreaHostAura::GetStatusArea() {
- return status_area_view_;
-}
-
-views::Widget* StatusAreaHostAura::CreateStatusArea() {
- ash::Shell* shell = ash::Shell::GetInstance();
- aura::Window* status_window = shell->GetContainer(
- ash::internal::kShellWindowId_StatusContainer);
-
- // Create status area view.
- status_area_view_ = new StatusAreaView();
-
- // Create widget to hold status area view.
- status_area_widget_ = new views::Widget;
- views::Widget::InitParams params(
- views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
- gfx::Size ps = status_area_view_->GetPreferredSize();
- params.bounds = gfx::Rect(0, 0, ps.width(), ps.height());
- params.delegate = status_area_view_;
- params.parent = status_window;
- params.transparent = true;
- status_area_widget_->Init(params);
- status_area_widget_->GetNativeWindow()->SetName("StatusAreaWindow");
- // Turn off focus on creation, otherwise the status area will request focus
- // every time it is shown.
- status_area_widget_->set_focus_on_creation(false);
- status_area_widget_->SetContentsView(status_area_view_);
- status_area_widget_->Show();
- status_area_widget_->GetNativeView()->SetName("StatusAreaView");
-
- UpdateAppearance();
-
- return status_area_widget_;
-}
-
-void StatusAreaHostAura::AddButtons() {
-#if defined(OS_CHROMEOS)
- ClockMenuButton* clock = NULL;
- chromeos::StatusAreaViewChromeos::AddChromeosButtons(status_area_view_,
- this,
- &clock);
- if (clock)
- clock_updater_.reset(new ClockUpdater(clock));
-#else
-#if defined(OS_LINUX)
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kMemoryWidget))
- status_area_view_->AddButton(new MemoryMenuButton(this),
- StatusAreaView::NO_BORDER);
-#endif
- status_area_view_->AddButton(new ClockMenuButton(this),
- StatusAreaView::HAS_BORDER);
-#endif
-}
-
-// StatusAreaButton::Delegate implementation.
-
-bool StatusAreaHostAura::ShouldExecuteStatusAreaCommand(
- const views::View* button_view, int command_id) const {
-#if defined(OS_CHROMEOS)
- if (chromeos::StatusAreaViewChromeos::IsLoginMode()) {
- // In login mode network options command means proxy settings dialog.
- return command_id == StatusAreaButton::Delegate::SHOW_NETWORK_OPTIONS;
- } else {
- return !chromeos::StatusAreaViewChromeos::IsScreenLockMode();
- }
-#else
- // TODO(stevenjb): system options for non-chromeos Aura?
- return false;
-#endif
-}
-
-void StatusAreaHostAura::ExecuteStatusAreaCommand(
- const views::View* button_view, int command_id) {
-#if defined(OS_CHROMEOS)
- if (chromeos::StatusAreaViewChromeos::IsBrowserMode()) {
- Profile* profile = ProfileManager::GetDefaultProfile();
- if (browser_defaults::kAlwaysOpenIncognitoWindow &&
- IncognitoModePrefs::ShouldLaunchIncognito(
- *CommandLine::ForCurrentProcess(),
- profile->GetPrefs())) {
- profile = profile->GetOffTheRecordProfile();
- }
- Browser* browser = BrowserList::FindBrowserWithProfile(profile);
- if (!browser)
- browser = Browser::Create(profile);
- switch (command_id) {
- case StatusAreaButton::Delegate::SHOW_NETWORK_OPTIONS:
- browser->OpenInternetOptionsDialog();
- break;
- case StatusAreaButton::Delegate::SHOW_LANGUAGE_OPTIONS:
- browser->OpenLanguageOptionsDialog();
- break;
- case StatusAreaButton::Delegate::SHOW_DATE_OPTIONS:
- browser->ShowDateOptions();
- break;
- default:
- NOTREACHED();
- }
- } else if (chromeos::StatusAreaViewChromeos::IsLoginMode()) {
- if (command_id == StatusAreaButton::Delegate::SHOW_NETWORK_OPTIONS &&
- chromeos::BaseLoginDisplayHost::default_host()) {
- gfx::NativeWindow native_window =
- chromeos::BaseLoginDisplayHost::default_host()->GetNativeWindow();
- chromeos::ProxySettingsDialog* dialog =
- new chromeos::ProxySettingsDialog(NULL, native_window);
- dialog->Show();
- } else {
- NOTREACHED();
- }
- } else if (chromeos::StatusAreaViewChromeos::IsScreenLockMode()) {
- if (command_id == StatusAreaButton::Delegate::SHOW_NETWORK_OPTIONS &&
- chromeos::ScreenLocker::default_screen_locker()) {
- gfx::NativeWindow native_window =
- chromeos::ScreenLocker::default_screen_locker()->delegate()->
- GetNativeWindow();
- chromeos::ProxySettingsDialog* dialog =
- new chromeos::ProxySettingsDialog(NULL, native_window);
- dialog->Show();
- } else {
- NOTREACHED();
- }
- }
-#endif
-}
-
-StatusAreaButton::TextStyle StatusAreaHostAura::GetStatusAreaTextStyle() const {
-#if defined(OS_CHROMEOS)
- if (IsLoginOrLockScreenDisplayed())
- return StatusAreaButton::GRAY_PLAIN_LIGHT;
-#endif
- return StatusAreaButton::WHITE_HALOED_BOLD;
-}
-
-void StatusAreaHostAura::ButtonVisibilityChanged(views::View* button_view) {
- if (status_area_view_)
- status_area_view_->UpdateButtonVisibility();
-}
-
-void StatusAreaHostAura::OnBrowserSetLastActive(const Browser* browser) {
- UpdateAppearance();
-}
-
-void StatusAreaHostAura::Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- switch (type) {
- case chrome::NOTIFICATION_BROWSER_THEME_CHANGED:
- UpdateAppearance();
- break;
-#if defined(OS_CHROMEOS)
- case chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED:
- UpdateAppearance();
- ash::Shell::GetInstance()->UpdateShelfVisibility();
- break;
-#endif
- default:
- NOTREACHED() << "Unexpected notification " << type;
- }
-}
-
-bool StatusAreaHostAura::IsLoginOrLockScreenDisplayed() const {
-#if defined(OS_CHROMEOS)
- if (!chromeos::UserManager::Get()->IsUserLoggedIn() &&
- base::chromeos::IsRunningOnChromeOS())
- return true;
-
- const chromeos::ScreenLocker* locker =
- chromeos::ScreenLocker::default_screen_locker();
- if (locker && locker->locked())
- return true;
-#endif
-
- return false;
-}
-
-void StatusAreaHostAura::UpdateAppearance() {
- status_area_view_->UpdateButtonTextStyle();
-}
diff --git a/chrome/browser/ui/views/ash/status_area_host_aura.h b/chrome/browser/ui/views/ash/status_area_host_aura.h
deleted file mode 100644
index 5a0ac46..0000000
--- a/chrome/browser/ui/views/ash/status_area_host_aura.h
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright (c) 2012 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_UI_VIEWS_ASH_STATUS_AREA_HOST_AURA_H_
-#define CHROME_BROWSER_UI_VIEWS_ASH_STATUS_AREA_HOST_AURA_H_
-#pragma once
-
-#include "base/compiler_specific.h"
-#include "chrome/browser/chromeos/status/status_area_button.h"
-#include "chrome/browser/ui/browser_list.h"
-#include "content/public/browser/notification_observer.h"
-#include "content/public/browser/notification_registrar.h"
-
-#if defined(OS_CHROMEOS)
-#include "base/memory/scoped_ptr.h"
-#include "chrome/browser/chromeos/login/login_html_dialog.h"
-#endif
-
-class ClockUpdater;
-class StatusAreaView;
-
-namespace views {
-class Views;
-class Widget;
-}
-
-class StatusAreaHostAura : public StatusAreaButton::Delegate,
- public BrowserList::Observer,
- public content::NotificationObserver {
- public:
- StatusAreaHostAura();
- virtual ~StatusAreaHostAura();
-
- // Returns the status area view.
- StatusAreaView* GetStatusArea();
-
- // Instantiates and sets |status_area_view_|, and sets it as the contents of
- // a new views::Widget |status_area_widget_| which is returned.
- // The caller is expected to take ownership of |status_area_widget_|.
- views::Widget* CreateStatusArea();
-
- // Adds the buttons to the status area. This is called separately, after
- // the profile has been initialized.
- void AddButtons();
-
- // StatusAreaButton::Delegate implementation.
- 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 StatusAreaButton::TextStyle GetStatusAreaTextStyle() const OVERRIDE;
- virtual void ButtonVisibilityChanged(views::View* button_view) OVERRIDE;
-
- // BrowserList::Observer implementation.
- virtual void OnBrowserAdded(const Browser* browser) OVERRIDE {}
- virtual void OnBrowserRemoved(const Browser* browser) OVERRIDE {}
- virtual void OnBrowserSetLastActive(const Browser* browser) OVERRIDE;
-
- // content::NotificationObserver implementation.
- virtual void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) OVERRIDE;
-
- private:
- // Is either the login or lock screen currently displayed?
- bool IsLoginOrLockScreenDisplayed() const;
-
- // Triggers an update of the status area text style and position.
- void UpdateAppearance();
-
- // Owned by caller of CreateStatusArea().
- views::Widget* status_area_widget_;
- // Owned by status_area_widget_.
- StatusAreaView* status_area_view_;
-
-#if defined(OS_CHROMEOS)
- scoped_ptr<ClockUpdater> clock_updater_;
-#endif
-
- content::NotificationRegistrar registrar_;
-
- DISALLOW_COPY_AND_ASSIGN(StatusAreaHostAura);
-};
-
-#endif // CHROME_BROWSER_UI_VIEWS_ASH_STATUS_AREA_HOST_AURA_H_
diff --git a/chrome/browser/ui/views/ash/status_area_host_aura_browsertest.cc b/chrome/browser/ui/views/ash/status_area_host_aura_browsertest.cc
deleted file mode 100644
index 6afeea9..0000000
--- a/chrome/browser/ui/views/ash/status_area_host_aura_browsertest.cc
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright (c) 2012 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 "ash/shell.h"
-#include "base/command_line.h"
-#include "base/memory/scoped_ptr.h"
-#include "chrome/browser/chromeos/status/status_area_button.h"
-#include "chrome/browser/profiles/profile_manager.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_window.h"
-#include "chrome/browser/ui/views/ash/chrome_shell_delegate.h"
-#include "chrome/browser/ui/views/ash/status_area_host_aura.h"
-#include "chrome/common/chrome_notification_types.h"
-#include "chrome/common/chrome_switches.h"
-#include "chrome/test/base/in_process_browser_test.h"
-#include "chrome/test/base/ui_test_utils.h"
-#include "content/public/browser/notification_service.h"
-#include "ui/gfx/size.h"
-
-#if defined(OS_CHROMEOS)
-#include "base/chromeos/chromeos_version.h"
-#include "chrome/browser/chromeos/login/screen_locker.h"
-#include "chrome/browser/chromeos/login/screen_locker_tester.h"
-#include "chrome/browser/chromeos/login/user_manager.h"
-#endif
-
-typedef InProcessBrowserTest StatusAreaHostAuraTest;
-
-IN_PROC_BROWSER_TEST_F(StatusAreaHostAuraTest, TextStyle) {
- ChromeShellDelegate* delegate = static_cast<ChromeShellDelegate*>(
- ash::Shell::GetInstance()->delegate());
- StatusAreaHostAura* host = delegate->status_area_host();
-
-#if defined(OS_CHROMEOS)
- ASSERT_TRUE(!chromeos::UserManager::Get()->IsUserLoggedIn() ||
- chromeos::UserManager::Get()->IsLoggedInAsStub());
- if (base::chromeos::IsRunningOnChromeOS()) {
- EXPECT_EQ(StatusAreaButton::GRAY_PLAIN_LIGHT,
- host->GetStatusAreaTextStyle());
- } else {
- EXPECT_EQ(StatusAreaButton::WHITE_HALOED_BOLD,
- host->GetStatusAreaTextStyle());
- }
-
- // ProfileManager expects a profile dir to be set on Chrome OS.
- CommandLine::ForCurrentProcess()->AppendSwitchNative(
- switches::kLoginProfile, "StatusAreaHostAuraTest");
- chromeos::UserManager::Get()->UserLoggedIn("foo@example.com");
- ASSERT_TRUE(chromeos::UserManager::Get()->IsUserLoggedIn() &&
- !chromeos::UserManager::Get()->IsLoggedInAsStub());
-#endif
-
- Browser* browser = CreateBrowser(ProfileManager::GetDefaultProfile());
- EXPECT_EQ(StatusAreaButton::WHITE_HALOED_BOLD,
- host->GetStatusAreaTextStyle());
-
-#if defined(OS_CHROMEOS)
- // Lock the screen.
- chromeos::ScreenLocker::Show();
- scoped_ptr<chromeos::test::ScreenLockerTester> tester(
- chromeos::ScreenLocker::GetTester());
- tester->EmulateWindowManagerReady();
- ui_test_utils::WindowedNotificationObserver lock_state_observer(
- chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED,
- content::NotificationService::AllSources());
- if (!tester->IsLocked())
- lock_state_observer.Wait();
- ASSERT_TRUE(tester->IsLocked());
- EXPECT_EQ(StatusAreaButton::GRAY_PLAIN_LIGHT, host->GetStatusAreaTextStyle());
-
- chromeos::ScreenLocker::Hide();
- ui_test_utils::RunAllPendingInMessageLoop();
- ASSERT_FALSE(tester->IsLocked());
-
- EXPECT_EQ(StatusAreaButton::WHITE_HALOED_BOLD,
- host->GetStatusAreaTextStyle());
-#endif
-
- browser->CloseWindow();
-}
diff --git a/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc
index ca031cb..bf8afe5 100644
--- a/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc
@@ -14,7 +14,6 @@
#include "chrome/browser/chromeos/input_method/input_method_manager.h"
#include "chrome/browser/chromeos/input_method/input_method_util.h"
#include "chrome/browser/chromeos/login/language_switch_menu.h"
-#include "chrome/browser/chromeos/status/input_method_menu.h"
#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
#include "chrome/browser/ui/webui/options2/chromeos/cros_language_options_handler2.h"
#include "content/public/browser/web_ui.h"
@@ -216,16 +215,19 @@ ListValue* NetworkScreenHandler::GetInputMethods() {
ListValue* input_methods_list = new ListValue;
input_method::InputMethodManager* manager =
input_method::InputMethodManager::GetInstance();
+ input_method::InputMethodUtil* util = manager->GetInputMethodUtil();
scoped_ptr<input_method::InputMethodDescriptors> input_methods(
manager->GetActiveInputMethods());
std::string current_input_method_id = manager->GetCurrentInputMethod().id();
for (size_t i = 0; i < input_methods->size(); ++i) {
+ const std::string ime_id = input_methods->at(i).id();
DictionaryValue* input_method = new DictionaryValue;
- input_method->SetString("value", input_methods->at(i).id());
+ input_method->SetString("value", ime_id);
input_method->SetString(
- "title", InputMethodMenu::GetTextForMenu(input_methods->at(i)));
+ "title",
+ util->GetInputMethodLongName(input_methods->at(i)));
input_method->SetBoolean("selected",
- input_methods->at(i).id() == current_input_method_id);
+ ime_id == current_input_method_id);
input_methods_list->Append(input_method);
}
return input_methods_list;
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 39761c0..9d00dfda 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -796,40 +796,12 @@
'browser/chromeos/sim_dialog_delegate.h',
'browser/chromeos/sms_observer.cc',
'browser/chromeos/sms_observer.h',
- 'browser/chromeos/status/accessibility_menu_button.cc',
- 'browser/chromeos/status/accessibility_menu_button.h',
- 'browser/chromeos/status/caps_lock_menu_button.cc',
- 'browser/chromeos/status/caps_lock_menu_button.h',
- 'browser/chromeos/status/clock_menu_button.cc',
- 'browser/chromeos/status/clock_menu_button.h',
- 'browser/chromeos/status/clock_updater.cc',
- 'browser/chromeos/status/clock_updater.h',
'browser/chromeos/status/data_promo_notification.cc',
'browser/chromeos/status/data_promo_notification.h',
- 'browser/chromeos/status/input_method_menu.cc',
- 'browser/chromeos/status/input_method_menu.h',
- 'browser/chromeos/status/input_method_menu_button.cc',
- 'browser/chromeos/status/input_method_menu_button.h',
- 'browser/chromeos/status/memory_menu_button.cc',
- 'browser/chromeos/status/memory_menu_button.h',
'browser/chromeos/status/network_menu.cc',
'browser/chromeos/status/network_menu.h',
- 'browser/chromeos/status/network_menu_button.cc',
- 'browser/chromeos/status/network_menu_button.h',
'browser/chromeos/status/network_menu_icon.cc',
'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_view.cc',
- 'browser/chromeos/status/status_area_view.h',
- 'browser/chromeos/status/status_area_view_chromeos.cc',
- 'browser/chromeos/status/status_area_view_chromeos.h',
- 'browser/chromeos/status/volume_menu_button.cc',
- 'browser/chromeos/status/volume_menu_button.h',
'browser/chromeos/stub_cros_settings_provider.cc',
'browser/chromeos/stub_cros_settings_provider.h',
'browser/chromeos/system/ash_system_tray_delegate.cc',
@@ -3263,8 +3235,6 @@
'browser/ui/views/ash/screen_orientation_listener.h',
'browser/ui/views/ash/screenshot_taker.cc',
'browser/ui/views/ash/screenshot_taker.h',
- 'browser/ui/views/ash/status_area_host_aura.cc',
- 'browser/ui/views/ash/status_area_host_aura.h',
'browser/ui/views/ash/volume_controller_chromeos.cc',
'browser/ui/views/ash/volume_controller_chromeos.h',
'browser/ui/views/ash/window_positioner.cc',
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index ae7dfdd..8981cd6 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -1319,7 +1319,6 @@
'browser/chromeos/offline/offline_load_page_unittest.cc',
'browser/chromeos/process_proxy/process_output_watcher_unittest.cc',
'browser/chromeos/proxy_config_service_impl_unittest.cc',
- 'browser/chromeos/status/input_method_menu_unittest.cc',
'browser/chromeos/status/network_menu_icon.cc',
'browser/chromeos/status/network_menu_icon_unittest.cc',
'browser/chromeos/stub_cros_settings_provider_unittest.cc',
@@ -2927,7 +2926,6 @@
'browser/ui/tab_modal_confirm_dialog_browsertest.h',
'browser/ui/views/ash/caps_lock_handler_browsertest.cc',
'browser/ui/views/ash/launcher/launcher_favicon_loader_browsertest.cc',
- 'browser/ui/views/ash/status_area_host_aura_browsertest.cc',
'browser/ui/views/browser_actions_container_browsertest.cc',
'browser/ui/views/dom_view_browsertest.cc',
'browser/ui/views/html_dialog_view_browsertest.cc',