| Index: ash/system/chromeos/network/tray_network.cc
|
| diff --git a/ash/system/chromeos/network/tray_network.cc b/ash/system/chromeos/network/tray_network.cc
|
| index 9f6ad418deaadf9ce2edacb566ef69e593e9de95..f9985110a58c14dbf7f9e03cc7810f64b339f04c 100644
|
| --- a/ash/system/chromeos/network/tray_network.cc
|
| +++ b/ash/system/chromeos/network/tray_network.cc
|
| @@ -4,16 +4,22 @@
|
|
|
| #include "ash/system/chromeos/network/tray_network.h"
|
|
|
| +#include "ash/ash_switches.h"
|
| #include "ash/shell.h"
|
| #include "ash/system/chromeos/network/network_list_detailed_view_base.h"
|
| +#include "ash/system/chromeos/network/network_state_list_detailed_view.h"
|
| +#include "ash/system/chromeos/network/tray_network_state_observer.h"
|
| #include "ash/system/tray/system_tray.h"
|
| #include "ash/system/tray/system_tray_delegate.h"
|
| #include "ash/system/tray/tray_constants.h"
|
| #include "ash/system/tray/tray_item_more.h"
|
| #include "ash/system/tray/tray_item_view.h"
|
| #include "ash/system/tray/tray_notification_view.h"
|
| +#include "base/command_line.h"
|
| +#include "chromeos/network/network_state_handler.h"
|
| #include "grit/ash_resources.h"
|
| #include "grit/ash_strings.h"
|
| +#include "third_party/cros_system_api/dbus/service_constants.h"
|
| #include "ui/base/l10n/l10n_util.h"
|
| #include "ui/base/resource/resource_bundle.h"
|
| #include "ui/views/controls/link.h"
|
| @@ -79,8 +85,8 @@ class NetworkMessages {
|
|
|
| class NetworkTrayView : public TrayItemView {
|
| public:
|
| - NetworkTrayView(ColorTheme size, bool tray_icon)
|
| - : color_theme_(size), tray_icon_(tray_icon) {
|
| + NetworkTrayView(ColorTheme size)
|
| + : color_theme_(size) {
|
| SetLayoutManager(
|
| new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0));
|
|
|
| @@ -99,15 +105,13 @@ class NetworkTrayView : public TrayItemView {
|
|
|
| void Update(const NetworkIconInfo& info) {
|
| image_view_->SetImage(info.image);
|
| - if (tray_icon_)
|
| - SetVisible(info.tray_icon_visible);
|
| + SetVisible(info.tray_icon_visible);
|
| SchedulePaint();
|
| }
|
|
|
| private:
|
| views::ImageView* image_view_;
|
| ColorTheme color_theme_;
|
| - bool tray_icon_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(NetworkTrayView);
|
| };
|
| @@ -394,7 +398,14 @@ class NetworkWifiDetailedView : public NetworkDetailedView {
|
| return NetworkDetailedView::WIFI_VIEW;
|
| }
|
|
|
| - virtual void Update() OVERRIDE {}
|
| + virtual void ManagerChanged() OVERRIDE {
|
| + }
|
| +
|
| + virtual void NetworkListChanged(const NetworkStateList& networks) OVERRIDE {
|
| + }
|
| +
|
| + virtual void NetworkServiceChanged(const std::string& service_path) OVERRIDE {
|
| + }
|
|
|
| private:
|
| DISALLOW_COPY_AND_ASSIGN(NetworkWifiDetailedView);
|
| @@ -512,6 +523,10 @@ TrayNetwork::TrayNetwork()
|
| notification_(NULL),
|
| messages_(new tray::NetworkMessages()),
|
| request_wifi_view_(false) {
|
| + if (CommandLine::ForCurrentProcess()->HasSwitch(
|
| + switches::kAshEnableNetworkStateHandler)) {
|
| + network_state_observer_.reset(new TrayNetworkStateObserver(this));
|
| + }
|
| }
|
|
|
| TrayNetwork::~TrayNetwork() {
|
| @@ -519,7 +534,7 @@ TrayNetwork::~TrayNetwork() {
|
|
|
| views::View* TrayNetwork::CreateTrayView(user::LoginStatus status) {
|
| CHECK(tray_ == NULL);
|
| - tray_ = new tray::NetworkTrayView(tray::LIGHT, true /*tray_icon*/);
|
| + tray_ = new tray::NetworkTrayView(tray::LIGHT);
|
| return tray_;
|
| }
|
|
|
| @@ -541,8 +556,13 @@ views::View* TrayNetwork::CreateDetailedView(user::LoginStatus status) {
|
| detailed_ = new tray::NetworkWifiDetailedView(!delegate->GetWifiEnabled());
|
| request_wifi_view_ = false;
|
| } else {
|
| - detailed_ = new tray::NetworkListDetailedView(
|
| - status, IDS_ASH_STATUS_TRAY_NETWORK);
|
| + if (CommandLine::ForCurrentProcess()->HasSwitch(
|
| + switches::kAshEnableNetworkStateHandler)) {
|
| + detailed_ = new tray::NetworkStateListDetailedView(status);
|
| + } else {
|
| + detailed_ = new tray::NetworkListDetailedView(
|
| + status, IDS_ASH_STATUS_TRAY_NETWORK);
|
| + }
|
| detailed_->Init();
|
| }
|
| return detailed_;
|
| @@ -585,7 +605,7 @@ void TrayNetwork::OnNetworkRefresh(const NetworkIconInfo& info) {
|
| if (default_)
|
| default_->Update();
|
| if (detailed_)
|
| - detailed_->Update();
|
| + detailed_->ManagerChanged();
|
| }
|
|
|
| void TrayNetwork::SetNetworkMessage(NetworkTrayDelegate* delegate,
|
|
|