Commit 33f488ab authored by stevenjb@chromium.org's avatar stevenjb@chromium.org

Move Ash system network trays to ash/system/chromeos

Also adds DEPS to keep chromeos dependencies out of ash/system

This is part of an effort to move chromeos network management code from src/chrome/ to src/chromeos.

BUG=154856

Review URL: https://chromiumcodereview.appspot.com/11039034

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162377 0039d316-1c4b-4281-b951-d872f2087c98
parent 503a32aa
......@@ -160,6 +160,13 @@
'system/brightness/brightness_control_delegate.h',
'system/brightness/tray_brightness.cc',
'system/brightness/tray_brightness.h',
'system/chromeos/network/network_observer.h',
'system/chromeos/network/tray_network.cc',
'system/chromeos/network/tray_network.h',
'system/chromeos/network/tray_sms.cc',
'system/chromeos/network/tray_sms.h',
'system/chromeos/tray_display.cc',
'system/chromeos/tray_display.h',
'system/date/clock_observer.h',
'system/date/date_view.cc',
'system/date/date_view.h',
......@@ -174,11 +181,6 @@
'system/keyboard_brightness/keyboard_brightness_control_delegate.h',
'system/locale/tray_locale.cc',
'system/locale/tray_locale.h',
'system/network/network_observer.h',
'system/network/tray_network.cc',
'system/network/tray_network.h',
'system/network/tray_sms.cc',
'system/network/tray_sms.h',
'system/power/power_status_observer.h',
'system/power/power_status_view.cc',
'system/power/power_status_view.h',
......@@ -228,8 +230,6 @@
'system/tray_accessibility.h',
'system/tray_caps_lock.cc',
'system/tray_caps_lock.h',
'system/tray_display.cc',
'system/tray_display.h',
'system/tray_update.cc',
'system/tray_update.h',
'system/user/login_status.h',
......
include_rules = [
"-chromeos",
]
include_rules = [
"+chromeos",
]
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_SYSTEM_NETWORK_NETWORK_OBSERVER_H
#define ASH_SYSTEM_NETWORK_NETWORK_OBSERVER_H
#ifndef ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_OBSERVER_H
#define ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_OBSERVER_H
#include <vector>
......@@ -40,10 +40,10 @@ class NetworkObserver {
// message. |delegate|->NotificationLinkClicked() will be called if any of the
// |links| are clicked (if supplied, |links| may be empty).
virtual void SetNetworkMessage(NetworkTrayDelegate* delegate,
MessageType message_type,
const string16& title,
const string16& message,
const std::vector<string16>& links) = 0;
MessageType message_type,
const string16& title,
const string16& message,
const std::vector<string16>& links) = 0;
// Clears the message notification for |message_type|.
virtual void ClearNetworkMessage(MessageType message_type) = 0;
......@@ -55,4 +55,4 @@ class NetworkObserver {
} // namespace ash
#endif // ASH_SYSTEM_NETWORK_NETWORK_OBSERVER_H
#endif // ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_OBSERVER_H
......@@ -2,10 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_SYSTEM_NETWORK_SMS_OBSERVER_H
#define ASH_SYSTEM_NETWORK_SMS_OBSERVER_H
#include "base/string16.h"
#ifndef ASH_SYSTEM_CHROMEOS_NETWORK_SMS_OBSERVER_H
#define ASH_SYSTEM_CHROMEOS_NETWORK_SMS_OBSERVER_H
namespace base {
class DictionaryValue;
......@@ -25,4 +23,4 @@ class SmsObserver {
} // namespace ash
#endif // ASH_SYSTEM_NETWORK_SMS_OBSERVER_H
#endif // ASH_SYSTEM_CHROMEOS_NETWORK_SMS_OBSERVER_H
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/system/network/tray_network.h"
#include "ash/system/chromeos/network/tray_network.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
......
......@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_SYSTEM_NETWORK_TRAY_NETWORK_H
#define ASH_SYSTEM_NETWORK_TRAY_NETWORK_H
#ifndef ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_NETWORK_H
#define ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_NETWORK_H
#include "ash/system/network/network_observer.h"
#include "ash/system/chromeos/network/network_observer.h"
#include "ash/system/tray/system_tray_item.h"
#include "base/memory/scoped_ptr.h"
......@@ -77,4 +77,4 @@ class TrayNetwork : public SystemTrayItem,
} // namespace internal
} // namespace ash
#endif // ASH_SYSTEM_NETWORK_TRAY_NETWORK_H
#endif // ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_NETWORK_H
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/system/network/tray_sms.h"
#include "ash/system/chromeos/network/tray_sms.h"
#include "ash/ash_switches.h"
#include "ash/shell.h"
......
......@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_SYSTEM_NETWORK_TRAY_SMS_H
#define ASH_SYSTEM_NETWORK_TRAY_SMS_H
#ifndef ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_SMS_H
#define ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_SMS_H
#include <string>
#include "ash/system/network/sms_observer.h"
#include "ash/system/chromeos/network/sms_observer.h"
#include "ash/system/tray/system_tray_item.h"
#include "base/values.h"
......@@ -62,4 +62,4 @@ class TraySms : public SystemTrayItem,
} // namespace internal
} // namespace ash
#endif // ASH_SYSTEM_NETWORK_TRAY_SMS_H
#endif // ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_SMS_H
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/system/tray_display.h"
#include "ash/system/chromeos/tray_display.h"
#include "ash/display/display_controller.h"
#include "ash/screen_ash.h"
......@@ -53,7 +53,6 @@ class DisplayView : public ash::internal::ActionableView {
virtual ~DisplayView() {}
void Update() {
#if defined(OS_CHROMEOS)
switch (Shell::GetInstance()->output_configurator()->output_state()) {
case chromeos::STATE_INVALID:
case chromeos::STATE_HEADLESS:
......@@ -97,7 +96,6 @@ class DisplayView : public ash::internal::ActionableView {
default:
NOTREACHED();
}
#endif // OS_CHROMEOS
}
private:
......@@ -121,22 +119,16 @@ class DisplayView : public ash::internal::ActionableView {
TrayDisplay::TrayDisplay()
: default_(NULL) {
aura::Env::GetInstance()->display_manager()->AddObserver(this);
#if defined(OS_CHROMEOS)
ash::Shell::GetInstance()->output_configurator()->AddObserver(this);
#endif
}
TrayDisplay::~TrayDisplay() {
aura::Env::GetInstance()->display_manager()->RemoveObserver(this);
#if defined(OS_CHROMEOS)
ash::Shell::GetInstance()->output_configurator()->RemoveObserver(this);
#endif
}
views::View* TrayDisplay::CreateDefaultView(user::LoginStatus status) {
#if defined(OS_CHROMEOS)
default_ = new DisplayView(status);
#endif
return default_;
}
......@@ -159,13 +151,10 @@ void TrayDisplay::OnDisplayRemoved(const gfx::Display& old_display) {
default_->Update();
}
#if defined(OS_CHROMEOS)
void TrayDisplay::OnDisplayModeChanged() {
if (default_)
default_->Update();
}
#endif
} // namespace internal
} // namespace ash
......@@ -2,16 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_SYSTEM_TRAY_DISPLAY_H_
#define ASH_SYSTEM_TRAY_DISPLAY_H_
#ifndef ASH_SYSTEM_CHROMEOS_TRAY_DISPLAY_H_
#define ASH_SYSTEM_CHROMEOS_TRAY_DISPLAY_H_
#include "ash/system/tray/system_tray_item.h"
#include "base/memory/scoped_ptr.h"
#include "ui/aura/display_observer.h"
#if defined(OS_CHROMEOS)
#include "chromeos/display/output_configurator.h"
#endif
namespace views {
class View;
......@@ -23,9 +21,7 @@ namespace internal {
class DisplayView;
class TrayDisplay : public SystemTrayItem,
#if defined(OS_CHROMEOS)
public chromeos::OutputConfigurator::Observer,
#endif
public aura::DisplayObserver {
public:
TrayDisplay();
......@@ -41,10 +37,8 @@ class TrayDisplay : public SystemTrayItem,
virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE;
virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE;
#if defined(OS_CHROMEOS)
// Overridden from chromeos::OutputConfigurator::Observer
virtual void OnDisplayModeChanged() OVERRIDE;
#endif
DisplayView* default_;
......@@ -54,4 +48,4 @@ class TrayDisplay : public SystemTrayItem,
} // namespace internal
} // namespace ash
#endif // ASH_SYSTEM_TRAY_DISPLAY_H_
#endif // ASH_SYSTEM_CHROMEOS_TRAY_DISPLAY_H_
include_rules = [
# TODO(stevenjb): Move this code to src/ash/system/chromeos, crbug.com/154842
"+chromeos/dbus/power_supply_status.h",
]
......@@ -9,7 +9,6 @@
#include "ash/shell_delegate.h"
#include "ash/shell_window_ids.h"
#include "ash/system/bluetooth/bluetooth_observer.h"
#include "ash/system/network/network_observer.h"
#include "ash/system/status_area_widget_delegate.h"
#include "ash/system/tray/system_tray.h"
#include "ash/system/tray/system_tray_delegate.h"
......@@ -201,30 +200,14 @@ class DummySystemTrayDelegate : public SystemTrayDelegate {
virtual void ToggleWifi() OVERRIDE {
wifi_enabled_ = !wifi_enabled_;
ash::NetworkObserver* observer =
ash::Shell::GetInstance()->system_tray()->network_observer();
if (observer) {
ash::NetworkIconInfo info;
observer->OnNetworkRefresh(info);
}
}
virtual void ToggleMobile() OVERRIDE {
cellular_enabled_ = !cellular_enabled_;
ash::NetworkObserver* observer =
ash::Shell::GetInstance()->system_tray()->network_observer();
if (observer) {
ash::NetworkIconInfo info;
observer->OnNetworkRefresh(info);
}
}
virtual void ToggleBluetooth() OVERRIDE {
bluetooth_enabled_ = !bluetooth_enabled_;
ash::BluetoothObserver* observer =
ash::Shell::GetInstance()->system_tray()->bluetooth_observer();
if (observer)
observer->OnBluetoothRefresh();
}
virtual void ShowOtherWifi() OVERRIDE {
......
......@@ -10,12 +10,11 @@
#include "ash/system/audio/tray_volume.h"
#include "ash/system/bluetooth/tray_bluetooth.h"
#include "ash/system/brightness/tray_brightness.h"
#include "ash/system/chromeos/tray_display.h"
#include "ash/system/date/tray_date.h"
#include "ash/system/drive/tray_drive.h"
#include "ash/system/ime/tray_ime.h"
#include "ash/system/locale/tray_locale.h"
#include "ash/system/network/tray_network.h"
#include "ash/system/network/tray_sms.h"
#include "ash/system/power/power_status_observer.h"
#include "ash/system/power/power_supply_status.h"
#include "ash/system/power/tray_power.h"
......@@ -27,7 +26,6 @@
#include "ash/system/tray/tray_constants.h"
#include "ash/system/tray_accessibility.h"
#include "ash/system/tray_caps_lock.h"
#include "ash/system/tray_display.h"
#include "ash/system/tray_update.h"
#include "ash/system/user/login_status.h"
#include "ash/system/user/tray_user.h"
......@@ -49,6 +47,11 @@
#include "ui/views/layout/fill_layout.h"
#include "ui/views/view.h"
#if defined(OS_CHROMEOS)
#include "ash/system/chromeos/network/tray_network.h"
#include "ash/system/chromeos/network/tray_sms.h"
#endif
namespace ash {
// SystemTray
......@@ -67,7 +70,10 @@ SystemTray::SystemTray(internal::StatusAreaWidget* status_area_widget)
drive_observer_(NULL),
ime_observer_(NULL),
locale_observer_(NULL),
#if defined(OS_CHROMEOS)
network_observer_(NULL),
sms_observer_(NULL),
#endif
update_observer_(NULL),
user_observer_(NULL),
default_bubble_height_(0),
......@@ -90,8 +96,6 @@ void SystemTray::CreateItems() {
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::TraySms* tray_sms = new internal::TraySms();
internal::TrayUser* tray_user = new internal::TrayUser;
internal::TrayAccessibility* tray_accessibility =
new internal::TrayAccessibility;
......@@ -101,7 +105,6 @@ void SystemTray::CreateItems() {
internal::TrayLocale* tray_locale = new internal::TrayLocale;
internal::TrayUpdate* tray_update = new internal::TrayUpdate;
internal::TraySettings* tray_settings = new internal::TraySettings();
internal::TrayDisplay* tray_display = new internal::TrayDisplay;
accessibility_observer_ = tray_accessibility;
audio_observer_ = tray_volume;
......@@ -112,22 +115,32 @@ void SystemTray::CreateItems() {
drive_observer_ = tray_drive;
ime_observer_ = tray_ime;
locale_observer_ = tray_locale;
network_observer_ = tray_network;
power_status_observers_.AddObserver(tray_power);
power_status_observers_.AddObserver(tray_settings);
sms_observer_ = tray_sms;
update_observer_ = tray_update;
user_observer_ = tray_user;
#if defined(OS_CHROMEOS)
internal::TrayDisplay* tray_display = new internal::TrayDisplay;
internal::TrayNetwork* tray_network = new internal::TrayNetwork;
internal::TraySms* tray_sms = new internal::TraySms();
network_observer_ = tray_network;
sms_observer_ = tray_sms;
#endif
AddTrayItem(tray_user);
AddTrayItem(tray_power);
#if defined(OS_CHROMEOS)
AddTrayItem(tray_network);
AddTrayItem(tray_bluetooth);
AddTrayItem(tray_sms);
#endif
AddTrayItem(tray_bluetooth);
AddTrayItem(tray_drive);
AddTrayItem(tray_ime);
AddTrayItem(tray_locale);
#if defined(OS_CHROMEOS)
AddTrayItem(tray_display);
#endif
AddTrayItem(tray_volume);
AddTrayItem(tray_brightness);
AddTrayItem(tray_update);
......
......@@ -30,11 +30,13 @@ class ClockObserver;
class DriveObserver;
class IMEObserver;
class LocaleObserver;
class NetworkObserver;
class SmsObserver;
class PowerStatusObserver;
class UpdateObserver;
class UserObserver;
#if defined(OS_CHROMEOS)
class NetworkObserver;
class SmsObserver;
#endif
class SystemTrayItem;
......@@ -133,15 +135,17 @@ class ASH_EXPORT SystemTray : public internal::TrayBackgroundView {
LocaleObserver* locale_observer() const {
return locale_observer_;
}
#if defined(OS_CHROMEOS)
NetworkObserver* network_observer() const {
return network_observer_;
}
ObserverList<PowerStatusObserver>& power_status_observers() {
return power_status_observers_;
}
SmsObserver* sms_observer() const {
return sms_observer_;
}
#endif
ObserverList<PowerStatusObserver>& power_status_observers() {
return power_status_observers_;
}
UpdateObserver* update_observer() const {
return update_observer_;
}
......@@ -216,9 +220,11 @@ class ASH_EXPORT SystemTray : public internal::TrayBackgroundView {
DriveObserver* drive_observer_;
IMEObserver* ime_observer_;
LocaleObserver* locale_observer_;
#if defined(OS_CHROMEOS)
NetworkObserver* network_observer_;
ObserverList<PowerStatusObserver> power_status_observers_;
SmsObserver* sms_observer_;
#endif
ObserverList<PowerStatusObserver> power_status_observers_;
UpdateObserver* update_observer_;
UserObserver* user_observer_;
......
......@@ -6,7 +6,7 @@
#include "ash/shell.h"
#include "ash/shell_delegate.h"
#include "ash/system/network/network_observer.h"
#include "ash/system/chromeos/network/network_observer.h"
#include "ash/system/tray/system_tray.h"
#include "base/bind.h"
#include "base/callback.h"
......
......@@ -5,7 +5,7 @@
#include "chrome/browser/chromeos/sms_observer.h"
#include "ash/shell.h"
#include "ash/system/network/sms_observer.h"
#include "ash/system/chromeos/network/sms_observer.h"
#include "ash/system/tray/system_tray.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
......
......@@ -6,7 +6,7 @@
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/system/network/network_observer.h"
#include "ash/system/chromeos/network/network_observer.h"
#include "ash/system/tray/system_tray.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
......
......@@ -9,10 +9,10 @@
#include "ash/system/audio/audio_observer.h"
#include "ash/system/bluetooth/bluetooth_observer.h"
#include "ash/system/brightness/brightness_observer.h"
#include "ash/system/chromeos/network/network_observer.h"
#include "ash/system/date/clock_observer.h"
#include "ash/system/drive/drive_observer.h"
#include "ash/system/ime/ime_observer.h"
#include "ash/system/network/network_observer.h"
#include "ash/system/power/power_status_observer.h"
#include "ash/system/status_area_widget.h"
#include "ash/system/tray/system_tray.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment