| 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 df426923bbaf1b18c7c74d1051b1558967aec110..03f1896449e376c53bc3d2e74fd20d73b195df60 100644
|
| --- a/ash/system/chromeos/network/tray_network.cc
|
| +++ b/ash/system/chromeos/network/tray_network.cc
|
| @@ -6,14 +6,20 @@
|
|
|
| #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/chromeos_switches.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"
|
| @@ -88,8 +94,8 @@ class NetworkMessages {
|
|
|
| class NetworkTrayView : public TrayItemView {
|
| public:
|
| - NetworkTrayView(SystemTrayItem* owner, ColorTheme size, bool tray_icon)
|
| - : TrayItemView(owner), color_theme_(size), tray_icon_(tray_icon) {
|
| + NetworkTrayView(SystemTrayItem* owner, ColorTheme size)
|
| + : TrayItemView(owner), color_theme_(size) {
|
| SetLayoutManager(
|
| new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0));
|
|
|
| @@ -108,15 +114,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);
|
| };
|
| @@ -406,7 +410,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);
|
| @@ -530,6 +541,10 @@ TrayNetwork::TrayNetwork(SystemTray* system_tray)
|
| notification_(NULL),
|
| messages_(new tray::NetworkMessages()),
|
| request_wifi_view_(false) {
|
| + if (CommandLine::ForCurrentProcess()->HasSwitch(
|
| + chromeos::switches::kEnableNewNetworkHandlers)) {
|
| + network_state_observer_.reset(new TrayNetworkStateObserver(this));
|
| + }
|
| }
|
|
|
| TrayNetwork::~TrayNetwork() {
|
| @@ -537,7 +552,7 @@ TrayNetwork::~TrayNetwork() {
|
|
|
| views::View* TrayNetwork::CreateTrayView(user::LoginStatus status) {
|
| CHECK(tray_ == NULL);
|
| - tray_ = new tray::NetworkTrayView(this, tray::LIGHT, true /*tray_icon*/);
|
| + tray_ = new tray::NetworkTrayView(this, tray::LIGHT);
|
| return tray_;
|
| }
|
|
|
| @@ -560,8 +575,13 @@ views::View* TrayNetwork::CreateDetailedView(user::LoginStatus status) {
|
| !delegate->GetWifiEnabled());
|
| request_wifi_view_ = false;
|
| } else {
|
| - detailed_ = new tray::NetworkListDetailedView(
|
| - this, status, IDS_ASH_STATUS_TRAY_NETWORK);
|
| + if (CommandLine::ForCurrentProcess()->HasSwitch(
|
| + chromeos::switches::kEnableNewNetworkHandlers)) {
|
| + detailed_ = new tray::NetworkStateListDetailedView(this, status);
|
| + } else {
|
| + detailed_ = new tray::NetworkListDetailedView(
|
| + this, status, IDS_ASH_STATUS_TRAY_NETWORK);
|
| + }
|
| detailed_->Init();
|
| }
|
| return detailed_;
|
| @@ -604,7 +624,7 @@ void TrayNetwork::OnNetworkRefresh(const NetworkIconInfo& info) {
|
| if (default_)
|
| default_->Update();
|
| if (detailed_)
|
| - detailed_->Update();
|
| + detailed_->ManagerChanged();
|
| }
|
|
|
| void TrayNetwork::SetNetworkMessage(NetworkTrayDelegate* delegate,
|
|
|