summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/views/ash
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/ui/views/ash')
-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
5 files changed, 0 insertions, 419 deletions
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();
-}