summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
Diffstat (limited to 'ash')
-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
9 files changed, 62 insertions, 91 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;