summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorstevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-21 17:07:14 +0000
committerstevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-21 17:07:14 +0000
commitde8d00d0184523c1ffe4d6dc603931d43057dd25 (patch)
tree30861cbaeb0a9e51ee6eedfb4434f478d46cf93c /ash
parent1f5c3cbba9ba05d48dbf8bd61b7e26e2a060d26f (diff)
downloadchromium_src-de8d00d0184523c1ffe4d6dc603931d43057dd25.zip
chromium_src-de8d00d0184523c1ffe4d6dc603931d43057dd25.tar.gz
chromium_src-de8d00d0184523c1ffe4d6dc603931d43057dd25.tar.bz2
Deprecate kAshDisableNewNetworkStatusArea
Eliminates NetworkListDetailedView and dependencies. This mostly removes dead code, but also fixes the following issues related to the old code: * TrayNetwork::OnWillToggleWifi() -> TrayNetwork::RequestToggleWifi() to toggle wifi directly from Ash. * Implement TrayNetwork::NetworkManagerChanged() so that detailed views are notified when technology state changes. * Eliminates unnecessary ash::SystemTrayDelegate dependencies on network_menu_ when using new connection handler code. BUG=240859 For about_network.cc: TBR=jamescook@chromium.org, jennyz@chromium.org Review URL: https://codereview.chromium.org/15350002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201322 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/accelerators/accelerator_controller.cc3
-rw-r--r--ash/ash.gyp4
-rw-r--r--ash/ash_switches.cc4
-rw-r--r--ash/ash_switches.h1
-rw-r--r--ash/system/chromeos/network/network_detailed_view.h2
-rw-r--r--ash/system/chromeos/network/network_list_detailed_view.cc287
-rw-r--r--ash/system/chromeos/network/network_list_detailed_view.h74
-rw-r--r--ash/system/chromeos/network/network_list_detailed_view_base.cc425
-rw-r--r--ash/system/chromeos/network/network_list_detailed_view_base.h118
-rw-r--r--ash/system/chromeos/network/network_observer.h7
-rw-r--r--ash/system/chromeos/network/network_state_notifier.cc8
-rw-r--r--ash/system/chromeos/network/tray_network.cc157
-rw-r--r--ash/system/chromeos/network/tray_network.h4
-rw-r--r--ash/system/chromeos/network/tray_network_state_observer.cc6
-rw-r--r--ash/system/chromeos/network/tray_sms.cc2
-rw-r--r--ash/system/chromeos/network/tray_vpn.cc207
-rw-r--r--ash/system/chromeos/network/tray_vpn.h14
-rw-r--r--ash/system/tray/system_tray_delegate.h58
-rw-r--r--ash/system/tray/system_tray_notifier.cc24
-rw-r--r--ash/system/tray/system_tray_notifier.h8
-rw-r--r--ash/system/tray/test_system_tray_delegate.cc74
-rw-r--r--ash/system/tray/test_system_tray_delegate.h23
22 files changed, 105 insertions, 1405 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc
index 677e8a4..dfd4acb 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -37,6 +37,7 @@
#include "ash/system/status_area_widget.h"
#include "ash/system/tray/system_tray.h"
#include "ash/system/tray/system_tray_delegate.h"
+#include "ash/system/tray/system_tray_notifier.h"
#include "ash/system/web_notification/web_notification_tray.h"
#include "ash/touch/touch_observer_hud.h"
#include "ash/volume_control_delegate.h"
@@ -554,7 +555,7 @@ bool AcceleratorController::PerformAction(int action,
case TOGGLE_SPOKEN_FEEDBACK:
return HandleToggleSpokenFeedback();
case TOGGLE_WIFI:
- Shell::GetInstance()->system_tray_delegate()->ToggleWifi();
+ Shell::GetInstance()->system_tray_notifier()->NotifyRequestToggleWifi();
return true;
case TOUCH_HUD_CLEAR: {
internal::RootWindowController* controller =
diff --git a/ash/ash.gyp b/ash/ash.gyp
index 5f56f40..66645bef 100644
--- a/ash/ash.gyp
+++ b/ash/ash.gyp
@@ -207,10 +207,6 @@
'system/chromeos/network/network_icon_animation.cc',
'system/chromeos/network/network_icon_animation.h',
'system/chromeos/network/network_icon_animation_observer.h',
- 'system/chromeos/network/network_list_detailed_view.cc',
- 'system/chromeos/network/network_list_detailed_view.h',
- 'system/chromeos/network/network_list_detailed_view_base.cc',
- 'system/chromeos/network/network_list_detailed_view_base.h',
'system/chromeos/network/network_observer.h',
'system/chromeos/network/network_state_list_detailed_view.cc',
'system/chromeos/network/network_state_list_detailed_view.h',
diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc
index fe707f2..38d94e0 100644
--- a/ash/ash_switches.cc
+++ b/ash/ash_switches.cc
@@ -56,10 +56,6 @@ const char kAshDisableNewAudioHandler[] = "ash-disable-new-audio-handler";
// If present new lock animations are enabled.
const char kAshDisableNewLockAnimations[] = "ash-disable-new-lock-animations";
-// Disable new network handlers in the status area.
-const char kAshDisableNewNetworkStatusArea[] =
- "ash-disable-new-network-status-area";
-
// Disable the per application grouping version of the launcher.
const char kAshDisablePerAppLauncher[] = "ash-disable-per-app-launcher";
diff --git a/ash/ash_switches.h b/ash/ash_switches.h
index 139a27b..081fe0b 100644
--- a/ash/ash_switches.h
+++ b/ash/ash_switches.h
@@ -30,7 +30,6 @@ ASH_EXPORT extern const char kAshDisableDisplayChangeLimiter[];
ASH_EXPORT extern const char kAshDisableImmersiveFullscreen[];
ASH_EXPORT extern const char kAshDisableNewAudioHandler[];
ASH_EXPORT extern const char kAshDisableNewLockAnimations[];
-ASH_EXPORT extern const char kAshDisableNewNetworkStatusArea[];
ASH_EXPORT extern const char kAshDisablePerAppLauncher[];
ASH_EXPORT extern const char kAshDisableUIScaling[];
ASH_EXPORT extern const char kAshDisableDisplayRotation[];
diff --git a/ash/system/chromeos/network/network_detailed_view.h b/ash/system/chromeos/network/network_detailed_view.h
index ad17671..fd48348 100644
--- a/ash/system/chromeos/network/network_detailed_view.h
+++ b/ash/system/chromeos/network/network_detailed_view.h
@@ -14,7 +14,7 @@ namespace internal {
namespace tray {
// Abstract base class for all NetworkDetailedView derived subclasses,
-// which includes NetworkWifiDetailedView and NetworkListDetailedViewBase.
+// which includes NetworkWifiDetailedView and NetworkStateListDetailedView.
class NetworkDetailedView : public TrayDetailsView {
public:
typedef chromeos::NetworkStateHandler::NetworkStateList NetworkStateList;
diff --git a/ash/system/chromeos/network/network_list_detailed_view.cc b/ash/system/chromeos/network/network_list_detailed_view.cc
deleted file mode 100644
index 68bcc3e..0000000
--- a/ash/system/chromeos/network/network_list_detailed_view.cc
+++ /dev/null
@@ -1,287 +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/system/chromeos/network/network_list_detailed_view.h"
-
-#include "ash/shell.h"
-#include "ash/system/tray/hover_highlight_view.h"
-#include "ash/system/tray/system_tray_delegate.h"
-#include "ash/system/tray/tray_constants.h"
-#include "ash/system/tray/tray_popup_header_button.h"
-#include "ash/system/tray/tray_popup_label_button.h"
-#include "grit/ash_resources.h"
-#include "grit/ash_strings.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/resource/resource_bundle.h"
-
-namespace ash {
-namespace internal {
-namespace tray {
-
-NetworkListDetailedView::NetworkListDetailedView(SystemTrayItem* owner,
- user::LoginStatus login,
- int header_string_id)
- : NetworkListDetailedViewBase(owner, login, header_string_id),
- airplane_(NULL),
- button_wifi_(NULL),
- button_mobile_(NULL),
- view_mobile_account_(NULL),
- setup_mobile_account_(NULL),
- other_wifi_(NULL),
- turn_on_wifi_(NULL),
- other_mobile_(NULL),
- scanning_view_(NULL),
- no_wifi_networks_view_(NULL),
- no_cellular_networks_view_(NULL) {
-}
-
-NetworkListDetailedView::~NetworkListDetailedView() {
-}
-
-// NetworkListDetailedViewBase
-void NetworkListDetailedView::AppendHeaderButtons() {
- button_wifi_ = new TrayPopupHeaderButton(
- this,
- IDR_AURA_UBER_TRAY_WIFI_ENABLED,
- IDR_AURA_UBER_TRAY_WIFI_DISABLED,
- IDR_AURA_UBER_TRAY_WIFI_ENABLED_HOVER,
- IDR_AURA_UBER_TRAY_WIFI_DISABLED_HOVER,
- IDS_ASH_STATUS_TRAY_WIFI);
- button_wifi_->SetTooltipText(
- l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISABLE_WIFI));
- button_wifi_->SetToggledTooltipText(
- l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ENABLE_WIFI));
- footer()->AddButton(button_wifi_);
-
- button_mobile_ = new TrayPopupHeaderButton(
- this,
- IDR_AURA_UBER_TRAY_CELLULAR_ENABLED,
- IDR_AURA_UBER_TRAY_CELLULAR_DISABLED,
- IDR_AURA_UBER_TRAY_CELLULAR_ENABLED_HOVER,
- IDR_AURA_UBER_TRAY_CELLULAR_DISABLED_HOVER,
- IDS_ASH_STATUS_TRAY_CELLULAR);
- button_mobile_->SetTooltipText(
- l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISABLE_MOBILE));
- button_mobile_->SetToggledTooltipText(
- l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ENABLE_MOBILE));
- footer()->AddButton(button_mobile_);
-
- AppendInfoButtonToHeader();
-}
-
-void NetworkListDetailedView::UpdateHeaderButtons() {
- SystemTrayDelegate* delegate = Shell::GetInstance()->system_tray_delegate();
- button_wifi_->SetToggled(!delegate->GetWifiEnabled());
- button_mobile_->SetToggled(!delegate->GetMobileEnabled());
- button_mobile_->SetVisible(delegate->GetMobileAvailable());
- UpdateSettingButton();
- static_cast<views::View*>(footer())->Layout();
-}
-
-void NetworkListDetailedView::AppendNetworkEntries() {
- CreateScrollableList();
-
- HoverHighlightView* container = new HoverHighlightView(this);
- container->AddLabel(ui::ResourceBundle::GetSharedInstance().
- GetLocalizedString(
- IDS_ASH_STATUS_TRAY_MOBILE_VIEW_ACCOUNT),
- gfx::Font::NORMAL);
- AddChildView(container);
- view_mobile_account_ = container;
-
- container = new HoverHighlightView(this);
- container->AddLabel(ui::ResourceBundle::GetSharedInstance().
- GetLocalizedString(IDS_ASH_STATUS_TRAY_SETUP_MOBILE),
- gfx::Font::NORMAL);
- AddChildView(container);
- setup_mobile_account_ = container;
-}
-
-void NetworkListDetailedView::GetAvailableNetworkList(
- std::vector<NetworkIconInfo>* list) {
- Shell::GetInstance()->system_tray_delegate()->GetAvailableNetworks(list);
-}
-
-void NetworkListDetailedView::UpdateNetworkEntries() {
- RefreshNetworkScrollWithUpdatedNetworkData();
-
- view_mobile_account_->SetVisible(false);
- setup_mobile_account_->SetVisible(false);
-
- if (login() == user::LOGGED_IN_NONE)
- return;
-
- std::string carrier_id, topup_url, setup_url;
- if (Shell::GetInstance()->system_tray_delegate()->
- GetCellularCarrierInfo(&carrier_id, &topup_url, &setup_url)) {
- if (carrier_id != carrier_id_) {
- carrier_id_ = carrier_id;
- if (!topup_url.empty())
- topup_url_ = topup_url;
- }
-
- if (!setup_url.empty())
- setup_url_ = setup_url;
-
- if (!topup_url_.empty())
- view_mobile_account_->SetVisible(true);
- if (!setup_url_.empty())
- setup_mobile_account_->SetVisible(true);
- }
-}
-
-void NetworkListDetailedView::AppendCustomButtonsToBottomRow(
- views::View* bottom_row) {
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- other_wifi_ = new TrayPopupLabelButton(
- this, rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_OTHER_WIFI));
- bottom_row->AddChildView(other_wifi_);
-
- turn_on_wifi_ = new TrayPopupLabelButton(
- this, rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_TURN_ON_WIFI));
- bottom_row->AddChildView(turn_on_wifi_);
-
- other_mobile_ = new TrayPopupLabelButton(
- this, rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_OTHER_MOBILE));
- bottom_row->AddChildView(other_mobile_);
-}
-
-void NetworkListDetailedView::UpdateNetworkExtra() {
- if (login() == user::LOGGED_IN_LOCKED)
- return;
-
- SystemTrayDelegate* delegate = Shell::GetInstance()->system_tray_delegate();
- if (IsNetworkListEmpty() && !delegate->GetWifiEnabled()) {
- turn_on_wifi_->SetVisible(true);
- other_wifi_->SetVisible(false);
- } else {
- turn_on_wifi_->SetVisible(false);
- other_wifi_->SetVisible(true);
- other_wifi_->SetEnabled(delegate->GetWifiEnabled());
- }
- other_mobile_->SetVisible(delegate->GetMobileAvailable() &&
- delegate->GetMobileScanSupported());
- if (other_mobile_->visible())
- other_mobile_->SetEnabled(delegate->GetMobileEnabled());
-
- turn_on_wifi_->parent()->Layout();
-}
-
- void NetworkListDetailedView::CustomButtonPressed(views::Button* sender,
- const ui::Event& event) {
- ash::SystemTrayDelegate* delegate =
- ash::Shell::GetInstance()->system_tray_delegate();
- if (sender == button_wifi_)
- delegate->ToggleWifi();
- else if (sender == button_mobile_)
- delegate->ToggleMobile();
- else if (sender == other_mobile_)
- delegate->ShowOtherCellular();
- else if (sender == other_wifi_)
- delegate->ShowOtherWifi();
- else if (sender == turn_on_wifi_)
- delegate->ToggleWifi();
- else
- NOTREACHED();
- }
-
-bool NetworkListDetailedView::CustomLinkClickedOn(views::View* sender) {
- ash::SystemTrayDelegate* delegate =
- ash::Shell::GetInstance()->system_tray_delegate();
- if (sender == view_mobile_account_) {
- delegate->ShowCellularURL(topup_url_);
- return true;
- } else if (sender == setup_mobile_account_) {
- delegate->ShowCellularURL(setup_url_);
- return true;
- } else if (sender == airplane_) {
- delegate->ToggleAirplaneMode();
- return true;
- } else {
- return false;
- }
-}
-
-bool NetworkListDetailedView::UpdateNetworkListEntries(
- std::set<std::string>* new_service_paths) {
- bool needs_relayout = false;
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
-
- SystemTrayDelegate* delegate = Shell::GetInstance()->system_tray_delegate();
-
- // Insert child views
-
- int index = 0;
- bool have_cellular_network = false;
-
- // Highlighted networks
- for (size_t i = 0; i < network_list().size(); ++i) {
- const NetworkIconInfo* info = &network_list()[i];
- if (info->highlight()) {
- if (UpdateNetworkChild(index++, info))
- needs_relayout = true;
- new_service_paths->insert(info->service_path);
- }
- if (info->is_cellular)
- have_cellular_network = true;
- }
-
- // "Cellular Initializing" or "No celular networks" or "No network"
- int status_message_id = 0;
- if (delegate->GetCellularInitializing())
- status_message_id = IDS_ASH_STATUS_TRAY_INITIALIZING_CELLULAR;
- else if (!have_cellular_network && delegate->GetMobileEnabled())
- status_message_id = IDS_ASH_STATUS_TRAY_NO_CELLULAR_NETWORKS;
- if (status_message_id) {
- base::string16 text = rb.GetLocalizedString(status_message_id);
- if (CreateOrUpdateInfoLabel(index++, text, &no_cellular_networks_view_))
- needs_relayout = true;
- } else if (no_cellular_networks_view_) {
- scroll_content()->RemoveChildView(no_cellular_networks_view_);
- no_cellular_networks_view_ = NULL;
- needs_relayout = true;
- }
-
- // "Wifi Enabled / Disabled"
- if (network_list().empty()) {
- int message_id = delegate->GetWifiEnabled() ?
- IDS_ASH_STATUS_TRAY_NETWORK_WIFI_ENABLED :
- IDS_ASH_STATUS_TRAY_NETWORK_WIFI_DISABLED;
- base::string16 text = rb.GetLocalizedString(message_id);
- if (CreateOrUpdateInfoLabel(index++, text, &no_wifi_networks_view_))
- needs_relayout = true;
- } else if (no_wifi_networks_view_) {
- scroll_content()->RemoveChildView(no_wifi_networks_view_);
- no_wifi_networks_view_ = NULL;
- needs_relayout = true;
- }
-
- // "Wifi Scanning"
- if (delegate->GetWifiScanning()) {
- base::string16 text =
- rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_WIFI_SCANNING_MESSAGE);
- if (CreateOrUpdateInfoLabel(index++, text, &scanning_view_))
- needs_relayout = true;
- } else if (scanning_view_ != NULL) {
- scroll_content()->RemoveChildView(scanning_view_);
- scanning_view_ = NULL;
- needs_relayout = true;
- }
-
- // Un-highlighted networks
- for (size_t i = 0; i < network_list().size(); ++i) {
- const NetworkIconInfo* info = &network_list()[i];
- if (!info->highlight()) {
- if (UpdateNetworkChild(index++, info))
- needs_relayout = true;
- new_service_paths->insert(info->service_path);
- }
- }
-
- return needs_relayout;
-}
-
-} // namespace tray
-} // namespace internal
-} // namespace ash
diff --git a/ash/system/chromeos/network/network_list_detailed_view.h b/ash/system/chromeos/network/network_list_detailed_view.h
deleted file mode 100644
index c32c309..0000000
--- a/ash/system/chromeos/network/network_list_detailed_view.h
+++ /dev/null
@@ -1,74 +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 ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_LIST_DETAILED_VIEW_H
-#define ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_LIST_DETAILED_VIEW_H
-
-#include <string>
-
-#include "ash/system/chromeos/network/network_list_detailed_view_base.h"
-#include "ash/system/user/login_status.h"
-
-namespace views {
-class View;
-}
-
-namespace ash {
-
-class SystemTrayItem;
-
-namespace internal {
-
-class TrayPopupHeaderButton;
-class TrayPopupLabelButton;
-
-namespace tray {
-
-class NetworkListDetailedView : public NetworkListDetailedViewBase {
- public:
- NetworkListDetailedView(SystemTrayItem* owner,
- user::LoginStatus login,
- int header_string_id);
- virtual ~NetworkListDetailedView();
-
- // NetworkListDetailedViewBase
- virtual void AppendHeaderButtons() OVERRIDE;
- virtual void UpdateHeaderButtons() OVERRIDE;
- virtual void AppendNetworkEntries() OVERRIDE;
- virtual void GetAvailableNetworkList(
- std::vector<NetworkIconInfo>* list) OVERRIDE;
- virtual void UpdateNetworkEntries() OVERRIDE;
- virtual void AppendCustomButtonsToBottomRow(views::View* bottom_row) OVERRIDE;
- virtual void UpdateNetworkExtra() OVERRIDE;
- virtual void CustomButtonPressed(views::Button* sender,
- const ui::Event& event) OVERRIDE;
- virtual bool CustomLinkClickedOn(views::View* sender) OVERRIDE;
- virtual bool UpdateNetworkListEntries(
- std::set<std::string>* new_service_paths) OVERRIDE;
-
- private:
- std::string carrier_id_;
- std::string topup_url_;
- std::string setup_url_;
-
- views::View* airplane_;
- TrayPopupHeaderButton* button_wifi_;
- TrayPopupHeaderButton* button_mobile_;
- views::View* view_mobile_account_;
- views::View* setup_mobile_account_;
- TrayPopupLabelButton* other_wifi_;
- TrayPopupLabelButton* turn_on_wifi_;
- TrayPopupLabelButton* other_mobile_;
- views::Label* scanning_view_;
- views::Label* no_wifi_networks_view_;
- views::Label* no_cellular_networks_view_;
-
- DISALLOW_COPY_AND_ASSIGN(NetworkListDetailedView);
-};
-
-} // namespace tray
-} // namespace internal
-} // namespace ash
-
-#endif // ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_LIST_DETAILED_VIEW_H
diff --git a/ash/system/chromeos/network/network_list_detailed_view_base.cc b/ash/system/chromeos/network/network_list_detailed_view_base.cc
deleted file mode 100644
index 874dd84..0000000
--- a/ash/system/chromeos/network/network_list_detailed_view_base.cc
+++ /dev/null
@@ -1,425 +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/system/chromeos/network/network_list_detailed_view_base.h"
-
-#include "ash/shell.h"
-#include "ash/shell_window_ids.h"
-#include "ash/system/tray/fixed_sized_scroll_view.h"
-#include "ash/system/tray/hover_highlight_view.h"
-#include "ash/system/tray/system_tray.h"
-#include "ash/system/tray/system_tray_delegate.h"
-#include "ash/system/tray/system_tray_item.h"
-#include "ash/system/tray/tray_constants.h"
-#include "ash/system/tray/tray_popup_header_button.h"
-#include "ash/system/tray/tray_popup_label_button.h"
-#include "base/utf_string_conversions.h"
-#include "grit/ash_resources.h"
-#include "grit/ash_strings.h"
-#include "ui/aura/window.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/views/bubble/bubble_delegate.h"
-#include "ui/views/controls/label.h"
-#include "ui/views/layout/box_layout.h"
-#include "ui/views/layout/fill_layout.h"
-#include "ui/views/widget/widget.h"
-
-namespace {
-
-// Create a label with the font size and color used in the network info bubble.
-views::Label* CreateInfoBubbleLabel(const base::string16& text) {
- views::Label* label = new views::Label(text);
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- label->SetFont(rb.GetFont(ui::ResourceBundle::SmallFont));
- label->SetEnabledColor(SkColorSetARGB(127, 0, 0, 0));
- return label;
-}
-
-// Create a label formatted for info items in the menu
-views::Label* CreateMenuInfoLabel(const base::string16& text) {
- views::Label* label = new views::Label(text);
- label->set_border(views::Border::CreateEmptyBorder(
- ash::kTrayPopupPaddingBetweenItems,
- ash::kTrayPopupPaddingHorizontal,
- ash::kTrayPopupPaddingBetweenItems, 0));
- label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- label->SetEnabledColor(SkColorSetARGB(192, 0, 0, 0));
- return label;
-}
-
-// Create a row of labels for the network info bubble.
-views::View* CreateInfoBubbleLine(const base::string16& text_label,
- const std::string& text_string) {
- views::View* view = new views::View;
- view->SetLayoutManager(
- new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 1));
- view->AddChildView(CreateInfoBubbleLabel(text_label));
- view->AddChildView(CreateInfoBubbleLabel(UTF8ToUTF16(": ")));
- view->AddChildView(CreateInfoBubbleLabel(UTF8ToUTF16(text_string)));
- return view;
-}
-
-// A bubble that cannot be activated.
-class NonActivatableSettingsBubble : public views::BubbleDelegateView {
- public:
- NonActivatableSettingsBubble(views::View* anchor, views::View* content)
- : views::BubbleDelegateView(anchor, views::BubbleBorder::TOP_RIGHT) {
- set_use_focusless(true);
- set_parent_window(ash::Shell::GetContainer(
- anchor->GetWidget()->GetNativeWindow()->GetRootWindow(),
- ash::internal::kShellWindowId_SettingBubbleContainer));
- SetLayoutManager(new views::FillLayout());
- AddChildView(content);
- }
-
- virtual ~NonActivatableSettingsBubble() {}
-
- virtual bool CanActivate() const OVERRIDE {
- return false;
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(NonActivatableSettingsBubble);
-};
-
-} // namespace
-
-namespace ash {
-namespace internal {
-
-namespace tray {
-
-enum ColorTheme {
- LIGHT,
- DARK,
-};
-
-NetworkListDetailedViewBase::NetworkListDetailedViewBase(
- SystemTrayItem* owner,
- user::LoginStatus login,
- int header_string_id)
- : NetworkDetailedView(owner),
- login_(login),
- header_string_id_(header_string_id),
- info_icon_(NULL),
- settings_(NULL),
- proxy_settings_(NULL),
- info_bubble_(NULL) {
-}
-
-NetworkListDetailedViewBase::~NetworkListDetailedViewBase() {
- if (info_bubble_)
- info_bubble_->GetWidget()->CloseNow();
-}
-
-// Overridden from NetworkDetailedView:
-void NetworkListDetailedViewBase::Init() {
- CreateItems();
- SystemTrayDelegate* delegate = Shell::GetInstance()->system_tray_delegate();
- if (delegate->GetWifiEnabled())
- delegate->RequestNetworkScan();
- Update();
-}
-
-NetworkDetailedView::DetailedViewType
- NetworkListDetailedViewBase::GetViewType() const {
- return NetworkDetailedView::LIST_VIEW;
-}
-
-void NetworkListDetailedViewBase::ManagerChanged() {
- Update();
-}
-
-void NetworkListDetailedViewBase::NetworkListChanged() {
- Update();
-}
-
-void NetworkListDetailedViewBase::NetworkServiceChanged(
- const chromeos::NetworkState* network) {
- Update();
-}
-
-// Private methods
-
-void NetworkListDetailedViewBase::Update() {
- UpdateAvailableNetworkList();
- UpdateHeaderButtons();
- UpdateNetworkEntries();
- UpdateNetworkExtra();
-
- Layout();
-}
-
-void NetworkListDetailedViewBase::CreateItems() {
- RemoveAllChildViews(true);
-
- AppendNetworkEntries();
- AppendNetworkExtra();
- AppendHeaderEntry(header_string_id_);
- AppendHeaderButtons();
-}
-
-void NetworkListDetailedViewBase::AppendHeaderEntry(int header_string_id) {
- CreateSpecialRow(header_string_id, this);
-}
-
-void NetworkListDetailedViewBase::AppendNetworkExtra() {
- if (login_ == user::LOGGED_IN_LOCKED)
- return;
-
- views::BoxLayout* layout = new
- views::BoxLayout(views::BoxLayout::kHorizontal,
- kTrayMenuBottomRowPadding,
- kTrayMenuBottomRowPadding,
- kTrayMenuBottomRowPaddingBetweenItems);
- layout->set_spread_blank_space(true);
- views::View* bottom_row = new View();
- bottom_row->SetLayoutManager(layout);
-
- AppendCustomButtonsToBottomRow(bottom_row);
-
- CreateSettingsEntry();
- DCHECK(settings_ || proxy_settings_);
- bottom_row->AddChildView(settings_ ? settings_ : proxy_settings_);
-
- AddChildView(bottom_row);
-
-}
-
-void NetworkListDetailedViewBase::AppendInfoButtonToHeader() {
- info_icon_ = new TrayPopupHeaderButton(
- this,
- IDR_AURA_UBER_TRAY_NETWORK_INFO,
- IDR_AURA_UBER_TRAY_NETWORK_INFO,
- IDR_AURA_UBER_TRAY_NETWORK_INFO_HOVER,
- IDR_AURA_UBER_TRAY_NETWORK_INFO_HOVER,
- IDS_ASH_STATUS_TRAY_NETWORK_INFO);
- info_icon_->SetTooltipText(
- l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_NETWORK_INFO));
- footer()->AddButton(info_icon_);
-}
-
-void NetworkListDetailedViewBase::UpdateSettingButton() {
- if (proxy_settings_) {
- proxy_settings_->SetEnabled(
- Shell::GetInstance()->system_tray_delegate()->IsNetworkConnected());
- }
-}
-
-void NetworkListDetailedViewBase::UpdateAvailableNetworkList() {
- network_list_.clear();
- GetAvailableNetworkList(&network_list_);
-}
-
-bool NetworkListDetailedViewBase::CreateOrUpdateInfoLabel(
- int index, const base::string16& text, views::Label** label) {
- if (*label == NULL) {
- *label = CreateMenuInfoLabel(text);
- scroll_content()->AddChildViewAt(*label, index);
- return true;
- } else {
- (*label)->SetText(text);
- return OrderChild(*label, index);
- }
-}
-
-bool NetworkListDetailedViewBase::UpdateNetworkChild(
- int index, const NetworkIconInfo* info) {
- bool needs_relayout = false;
- HoverHighlightView* container = NULL;
- ServicePathMap::const_iterator found =
- service_path_map_.find(info->service_path);
- gfx::Font::FontStyle font =
- info->highlight() ? gfx::Font::BOLD : gfx::Font::NORMAL;
- base::string16 desc = info->description.empty() ? info->name
- : info->description;
- if (found == service_path_map_.end()) {
- container = new HoverHighlightView(this);
- container->AddIconAndLabel(info->image, desc, font);
- scroll_content()->AddChildViewAt(container, index);
- container->set_border(views::Border::CreateEmptyBorder(
- 0, kTrayPopupPaddingHorizontal, 0, 0));
- needs_relayout = true;
- } else {
- container = found->second;
- container->RemoveAllChildViews(true);
- container->AddIconAndLabel(info->image, desc, font);
- container->Layout();
- container->SchedulePaint();
- needs_relayout = OrderChild(container, index);
- }
-
- network_map_[container] = info->service_path;
- service_path_map_[info->service_path] = container;
- return needs_relayout;
-}
-
-bool NetworkListDetailedViewBase::OrderChild(views::View* view, int index) {
- if (scroll_content()->child_at(index) != view) {
- scroll_content()->ReorderChildView(view, index);
- return true;
- }
- return false;
-}
-
-void NetworkListDetailedViewBase::RefreshNetworkList() {
- network_map_.clear();
- std::set<std::string> new_service_paths;
- bool needs_relayout = UpdateNetworkListEntries(&new_service_paths);
-
- // Remove old children
- std::set<std::string> remove_service_paths;
- for (ServicePathMap::const_iterator it = service_path_map_.begin();
- it != service_path_map_.end(); ++it) {
- if (new_service_paths.find(it->first) == new_service_paths.end()) {
- remove_service_paths.insert(it->first);
- scroll_content()->RemoveChildView(it->second);
- needs_relayout = true;
- }
- }
-
- for (std::set<std::string>::const_iterator remove_it =
- remove_service_paths.begin();
- remove_it != remove_service_paths.end(); ++remove_it) {
- service_path_map_.erase(*remove_it);
- }
-
- if (needs_relayout) {
- views::View* selected_view = NULL;
- for (ServicePathMap::const_iterator iter = service_path_map_.begin();
- iter != service_path_map_.end(); ++iter) {
- if (iter->second->hover()) {
- selected_view = iter->second;
- break;
- }
- }
- scroll_content()->SizeToPreferredSize();
- static_cast<views::View*>(scroller())->Layout();
- if (selected_view)
- scroll_content()->ScrollRectToVisible(selected_view->bounds());
- }
-}
-
-void NetworkListDetailedViewBase::RefreshNetworkScrollWithUpdatedNetworkData() {
- RefreshNetworkList();
-}
-
-bool NetworkListDetailedViewBase::IsNetworkListEmpty() const {
- return network_list_.empty();
-}
-
-void NetworkListDetailedViewBase::ButtonPressed(views::Button* sender,
- const ui::Event& event) {
- if (sender == info_icon_) {
- ToggleInfoBubble();
- return;
- }
-
- // If the info bubble was visible, close it when some other item is clicked
- // on.
- ResetInfoBubble();
- SystemTrayDelegate* delegate = Shell::GetInstance()->system_tray_delegate();
- if (sender == settings_)
- delegate->ShowNetworkSettings("");
- else if (sender == proxy_settings_)
- delegate->ChangeProxySettings();
- else
- CustomButtonPressed(sender, event);
-}
-
-void NetworkListDetailedViewBase::OnViewClicked(views::View* sender) {
- SystemTrayDelegate* delegate = Shell::GetInstance()->system_tray_delegate();
- // If the info bubble was visible, close it when some other item is clicked
- // on.
- ResetInfoBubble();
-
- if (sender == footer()->content()) {
- owner()->system_tray()->ShowDefaultView(BUBBLE_USE_EXISTING);
- return;
- }
-
- if (login_ == user::LOGGED_IN_LOCKED)
- return;
-
- if (!CustomLinkClickedOn(sender)) {
- NetworkMap::iterator find = network_map_.find(sender);
- if (find != network_map_.end()) {
- std::string network_id = find->second;
- delegate->ConnectToNetwork(network_id);
- }
- }
-}
-
-// Adds a settings entry when logged in, and an entry for changing proxy
-// settings otherwise.
-void NetworkListDetailedViewBase::CreateSettingsEntry() {
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- if (login_ != user::LOGGED_IN_NONE) {
- // Settings, only if logged in.
- settings_ = new TrayPopupLabelButton(this,
- rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_NETWORK_SETTINGS));
- } else {
- proxy_settings_ = new TrayPopupLabelButton(this,
- rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_NETWORK_PROXY_SETTINGS));
- }
-}
-
-views::View* NetworkListDetailedViewBase::CreateNetworkInfoView() {
- ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
- std::string ip_address, ethernet_address, wifi_address;
- Shell::GetInstance()->system_tray_delegate()->GetNetworkAddresses(
- &ip_address, &ethernet_address, &wifi_address);
-
- views::View* container = new views::View;
- container->SetLayoutManager(
- new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1));
- container->set_border(views::Border::CreateEmptyBorder(0, 5, 0, 5));
-
- // GetNetworkAddresses returns empty strings if no information is available.
- if (!ip_address.empty()) {
- container->AddChildView(CreateInfoBubbleLine(bundle.GetLocalizedString(
- IDS_ASH_STATUS_TRAY_IP), ip_address));
- }
- if (!ethernet_address.empty()) {
- container->AddChildView(CreateInfoBubbleLine(bundle.GetLocalizedString(
- IDS_ASH_STATUS_TRAY_ETHERNET), ethernet_address));
- }
- if (!wifi_address.empty()) {
- container->AddChildView(CreateInfoBubbleLine(bundle.GetLocalizedString(
- IDS_ASH_STATUS_TRAY_WIFI), wifi_address));
- }
-
- // Avoid an empty bubble in the unlikely event that there is no network
- // information at all.
- if (!container->has_children()) {
- container->AddChildView(CreateInfoBubbleLabel(bundle.GetLocalizedString(
- IDS_ASH_STATUS_TRAY_NO_NETWORKS)));
- }
-
- return container;
-}
-
-void NetworkListDetailedViewBase::ToggleInfoBubble() {
- if (ResetInfoBubble())
- return;
-
- info_bubble_ = new NonActivatableSettingsBubble(
- info_icon_, CreateNetworkInfoView());
- views::BubbleDelegateView::CreateBubble(info_bubble_)->Show();
-}
-
- // Returns whether an existing info-bubble was closed.
-bool NetworkListDetailedViewBase::ResetInfoBubble() {
- if (!info_bubble_)
- return false;
- info_bubble_->GetWidget()->Close();
- info_bubble_ = NULL;
- return true;
-}
-
-} // namespace tray
-
-} // namespace internal
-} // namespace ash
diff --git a/ash/system/chromeos/network/network_list_detailed_view_base.h b/ash/system/chromeos/network/network_list_detailed_view_base.h
deleted file mode 100644
index cfea043..0000000
--- a/ash/system/chromeos/network/network_list_detailed_view_base.h
+++ /dev/null
@@ -1,118 +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 ASH_SYSTEM_NETWORK_NETWORK_LIST_DETAILED_VIEW_BASE_H
-#define ASH_SYSTEM_NETWORK_NETWORK_LIST_DETAILED_VIEW_BASE_H
-
-#include "ash/system/chromeos/network/network_detailed_view.h"
-#include "ash/system/tray/view_click_listener.h"
-#include "ash/system/user/login_status.h"
-#include "base/memory/scoped_ptr.h"
-#include "ui/views/controls/button/button.h"
-
-namespace views {
-class BubbleDelegateView;
-}
-
-namespace ash {
-
-struct NetworkIconInfo;
-
-namespace internal {
-
-class HoverHighlightView;
-class TrayPopupLabelButton;
-
-namespace tray {
-
-// Base class for the NetworkListDetailedView and VpnListDetailedView.
-class NetworkListDetailedViewBase : public NetworkDetailedView,
- public views::ButtonListener,
- public ViewClickListener {
- public:
- NetworkListDetailedViewBase(SystemTrayItem* owner,
- user::LoginStatus login,
- int header_string_id);
- virtual ~NetworkListDetailedViewBase();
-
- // Overridden from NetworkDetailedView.
- virtual void Init() OVERRIDE;
- virtual NetworkDetailedView::DetailedViewType GetViewType() const OVERRIDE;
- virtual void ManagerChanged() OVERRIDE;
- virtual void NetworkListChanged() OVERRIDE;
- virtual void NetworkServiceChanged(
- const chromeos::NetworkState* network) OVERRIDE;
-
- protected:
- void AppendInfoButtonToHeader();
- void UpdateSettingButton();
- void RefreshNetworkScrollWithUpdatedNetworkData();
- user::LoginStatus login() const { return login_; }
- bool IsNetworkListEmpty() const;
- bool CreateOrUpdateInfoLabel(
- int index, const base::string16& text, views::Label** label);
- bool UpdateNetworkChild(int index, const NetworkIconInfo* info);
-
- const std::vector<NetworkIconInfo>& network_list() const {
- return network_list_;
- }
-
- // Overridden from ButtonListener.
- virtual void ButtonPressed(views::Button* sender,
- const ui::Event& event) OVERRIDE;
-
- // Overridden from ViewClickListener.
- virtual void OnViewClicked(views::View* sender) OVERRIDE;
-
- private:
- typedef std::map<views::View*, std::string> NetworkMap;
- typedef std::map<std::string, HoverHighlightView*> ServicePathMap;
-
- virtual void AppendHeaderButtons() = 0;
- virtual void UpdateHeaderButtons() = 0;
- virtual void AppendNetworkEntries() = 0;
- virtual void GetAvailableNetworkList(std::vector<NetworkIconInfo>* list) = 0;
- virtual void UpdateNetworkEntries() = 0;
- virtual void AppendCustomButtonsToBottomRow(views::View* bottom_row) = 0;
- virtual void UpdateNetworkExtra() = 0;
- virtual void CustomButtonPressed(views::Button* sender,
- const ui::Event& event) = 0;
- // Returns true if custom link is clicked on.
- virtual bool CustomLinkClickedOn(views::View* sender) = 0;
- // Returns true if the scroll list needs to be relayed out.
- virtual bool UpdateNetworkListEntries(
- std::set<std::string>* new_service_paths) = 0;
-
- void Update();
- void CreateItems();
- void AppendHeaderEntry(int header_string_id);
- void AppendNetworkExtra();
- void UpdateAvailableNetworkList();
- bool OrderChild(views::View* view, int index);
- void RefreshNetworkList();
- // Adds a settings entry when logged in, and an entry for changing proxy
- // settings otherwise.
- void CreateSettingsEntry();
- views::View* CreateNetworkInfoView();
- void ToggleInfoBubble();
- // Returns whether an existing info-bubble was closed.
- bool ResetInfoBubble();
-
- user::LoginStatus login_;
- std::vector<NetworkIconInfo> network_list_;
- int header_string_id_;
- NetworkMap network_map_;
- ServicePathMap service_path_map_;
- TrayPopupHeaderButton* info_icon_;
- TrayPopupLabelButton* settings_;
- TrayPopupLabelButton* proxy_settings_;
- views::BubbleDelegateView* info_bubble_;
-
- DISALLOW_COPY_AND_ASSIGN(NetworkListDetailedViewBase);
-};
-
-} // namespace tray
-} // namespace internal
-} // namespace ash
-
-#endif // #ifndef ASH_SYSTEM_NETWORK_NETWORK_LIST_DETAILED_VIEW_BASE_H
diff --git a/ash/system/chromeos/network/network_observer.h b/ash/system/chromeos/network/network_observer.h
index 45011c2..91bad8c 100644
--- a/ash/system/chromeos/network/network_observer.h
+++ b/ash/system/chromeos/network/network_observer.h
@@ -35,8 +35,6 @@ class NetworkObserver {
virtual ~NetworkObserver() {}
- virtual void OnNetworkRefresh(const NetworkIconInfo& info) = 0;
-
// Sets a network message notification.
// |message_type| identifies the type of message.
// |network_type| identifies the type of network involved.
@@ -48,13 +46,14 @@ class NetworkObserver {
const base::string16& title,
const base::string16& message,
const std::vector<base::string16>& links) = 0;
+
// Clears the message notification for |message_type|.
virtual void ClearNetworkMessage(MessageType message_type) = 0;
- // Called when the user attempted to toggle Wi-Fi enable/disable.
+ // Called to request toggling Wi-Fi enable/disable, e.g. from an accelerator.
// NOTE: Toggling is asynchronous and subsequent calls to query the current
// state may return the old value.
- virtual void OnWillToggleWifi() = 0;
+ virtual void RequestToggleWifi() = 0;
};
} // namespace ash
diff --git a/ash/system/chromeos/network/network_state_notifier.cc b/ash/system/chromeos/network/network_state_notifier.cc
index 1805143b..e1cef84 100644
--- a/ash/system/chromeos/network/network_state_notifier.cc
+++ b/ash/system/chromeos/network/network_state_notifier.cc
@@ -4,11 +4,9 @@
#include "ash/system/chromeos/network/network_state_notifier.h"
-#include "ash/ash_switches.h"
#include "ash/shell.h"
#include "ash/system/chromeos/network/network_observer.h"
#include "ash/system/tray/system_tray_notifier.h"
-#include "base/command_line.h"
#include "base/string16.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
@@ -173,10 +171,6 @@ void NetworkStateNotifier::NetworkConnectionStateChanged(
void NetworkStateNotifier::NetworkPropertiesUpdated(
const NetworkState* network) {
DCHECK(network);
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- ash::switches::kAshDisableNewNetworkStatusArea)) {
- return;
- }
// Trigger "Out of credits" notification if the cellular network is the most
// recent default network (i.e. we have not switched to another network).
if (network->type() == flimflam::kTypeCellular &&
@@ -211,7 +205,7 @@ void NetworkStateNotifier::NotificationLinkClicked(
if (message_type == ash::NetworkObserver::ERROR_OUT_OF_CREDITS) {
if (!cellular_network_.empty()) {
// This will trigger the activation / portal code.
- Shell::GetInstance()->system_tray_delegate()->ConnectToNetwork(
+ Shell::GetInstance()->system_tray_delegate()->ConfigureNetwork(
cellular_network_);
}
ash::Shell::GetInstance()->system_tray_notifier()->
diff --git a/ash/system/chromeos/network/tray_network.cc b/ash/system/chromeos/network/tray_network.cc
index b5731ad..333a263 100644
--- a/ash/system/chromeos/network/tray_network.cc
+++ b/ash/system/chromeos/network/tray_network.cc
@@ -7,8 +7,6 @@
#include "ash/ash_switches.h"
#include "ash/shell.h"
#include "ash/system/chromeos/network/network_icon_animation.h"
-#include "ash/system/chromeos/network/network_list_detailed_view.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/network_state_notifier.h"
#include "ash/system/chromeos/network/network_tray_delegate.h"
@@ -62,12 +60,6 @@ int GetMessageIcon(NetworkObserver::MessageType message_type,
return 0;
}
-bool UseNewNetworkHandlers() {
- return !CommandLine::ForCurrentProcess()->HasSwitch(
- ash::switches::kAshDisableNewNetworkStatusArea) &&
- NetworkStateHandler::IsInitialized();
-}
-
} // namespace
namespace ash {
@@ -116,34 +108,18 @@ class NetworkTrayView : public TrayItemView,
image_view_ = new views::ImageView;
AddChildView(image_view_);
- NetworkIconInfo info;
- if (UseNewNetworkHandlers()) {
- UpdateNetworkStateHandlerIcon();
- } else {
- Shell::GetInstance()->system_tray_delegate()->
- GetMostRelevantNetworkIcon(&info, false);
- UpdateIcon(info.tray_icon_visible, info.image);
- }
+ UpdateNetworkStateHandlerIcon();
}
virtual ~NetworkTrayView() {
- if (UseNewNetworkHandlers())
- network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this);
+ network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this);
}
virtual const char* GetClassName() const OVERRIDE {
return "NetworkTrayView";
}
- void Update(const NetworkIconInfo& info) {
- if (UseNewNetworkHandlers())
- return;
- UpdateIcon(info.tray_icon_visible, info.image);
- UpdateConnectionStatus(info.name, info.connected);
- }
-
void UpdateNetworkStateHandlerIcon() {
- DCHECK(UseNewNetworkHandlers());
NetworkStateHandler* handler = NetworkStateHandler::Get();
gfx::ImageSkia image;
base::string16 name;
@@ -173,8 +149,7 @@ class NetworkTrayView : public TrayItemView,
// network_icon::AnimationObserver
virtual void NetworkIconChanged() OVERRIDE {
- if (UseNewNetworkHandlers())
- UpdateNetworkStateHandlerIcon();
+ UpdateNetworkStateHandlerIcon();
}
private:
@@ -216,32 +191,22 @@ class NetworkDefaultView : public TrayItemMore,
}
virtual ~NetworkDefaultView() {
- if (UseNewNetworkHandlers())
- network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this);
+ network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this);
}
void Update() {
- if (UseNewNetworkHandlers()) {
- gfx::ImageSkia image;
- base::string16 label;
- bool animating = false;
- network_tray_->GetNetworkStateHandlerImageAndLabel(
- network_icon::ICON_TYPE_DEFAULT_VIEW, &image, &label, &animating);
- if (animating)
- network_icon::NetworkIconAnimation::GetInstance()->AddObserver(this);
- else
- network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this);
- SetImage(&image);
- SetLabel(label);
- SetAccessibleName(label);
- } else {
- NetworkIconInfo info;
- Shell::GetInstance()->system_tray_delegate()->
- GetMostRelevantNetworkIcon(&info, true);
- SetImage(&info.image);
- SetLabel(info.description);
- SetAccessibleName(info.description);
- }
+ gfx::ImageSkia image;
+ base::string16 label;
+ bool animating = false;
+ network_tray_->GetNetworkStateHandlerImageAndLabel(
+ network_icon::ICON_TYPE_DEFAULT_VIEW, &image, &label, &animating);
+ if (animating)
+ network_icon::NetworkIconAnimation::GetInstance()->AddObserver(this);
+ else
+ network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this);
+ SetImage(&image);
+ SetLabel(label);
+ SetAccessibleName(label);
}
// network_icon::AnimationObserver
@@ -257,30 +222,25 @@ class NetworkDefaultView : public TrayItemMore,
class NetworkWifiDetailedView : public NetworkDetailedView {
public:
- NetworkWifiDetailedView(SystemTrayItem* owner, bool wifi_enabled)
+ explicit NetworkWifiDetailedView(SystemTrayItem* owner)
: NetworkDetailedView(owner) {
SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal,
kTrayPopupPaddingHorizontal,
10,
kTrayPopupPaddingBetweenItems));
- ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
- views::ImageView* image = new views::ImageView;
- const int image_id = wifi_enabled ?
- IDR_AURA_UBER_TRAY_WIFI_ENABLED : IDR_AURA_UBER_TRAY_WIFI_DISABLED;
- image->SetImage(bundle.GetImageNamed(image_id).ToImageSkia());
- AddChildView(image);
+ image_view_ = new views::ImageView;
+ AddChildView(image_view_);
- const int string_id = wifi_enabled ?
- IDS_ASH_STATUS_TRAY_NETWORK_WIFI_ENABLED:
- IDS_ASH_STATUS_TRAY_NETWORK_WIFI_DISABLED;
- views::Label* label =
- new views::Label(bundle.GetLocalizedString(string_id));
- label->SetMultiLine(true);
- label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- AddChildView(label);
+ label_view_ = new views::Label();
+ label_view_->SetMultiLine(true);
+ label_view_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
+ AddChildView(label_view_);
+
+ Update();
}
- virtual ~NetworkWifiDetailedView() {}
+ virtual ~NetworkWifiDetailedView() {
+ }
// Overridden from NetworkDetailedView:
@@ -292,9 +252,11 @@ class NetworkWifiDetailedView : public NetworkDetailedView {
}
virtual void ManagerChanged() OVERRIDE {
+ Update();
}
virtual void NetworkListChanged() OVERRIDE {
+ Update();
}
virtual void NetworkServiceChanged(
@@ -302,6 +264,23 @@ class NetworkWifiDetailedView : public NetworkDetailedView {
}
private:
+ void Update() {
+ bool wifi_enabled =
+ NetworkStateHandler::Get()->IsTechnologyEnabled(flimflam::kTypeWifi);
+ const int image_id = wifi_enabled ?
+ IDR_AURA_UBER_TRAY_WIFI_ENABLED : IDR_AURA_UBER_TRAY_WIFI_DISABLED;
+ ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
+ image_view_->SetImage(bundle.GetImageNamed(image_id).ToImageSkia());
+
+ const int string_id = wifi_enabled ?
+ IDS_ASH_STATUS_TRAY_NETWORK_WIFI_ENABLED :
+ IDS_ASH_STATUS_TRAY_NETWORK_WIFI_DISABLED;
+ label_view_->SetText(bundle.GetLocalizedString(string_id));
+ }
+
+ views::ImageView* image_view_;
+ views::Label* label_view_;
+
DISALLOW_COPY_AND_ASSIGN(NetworkWifiDetailedView);
};
@@ -421,8 +400,7 @@ TrayNetwork::TrayNetwork(SystemTray* system_tray)
notification_(NULL),
messages_(new tray::NetworkMessages()),
request_wifi_view_(false) {
- if (UseNewNetworkHandlers())
- network_state_observer_.reset(new TrayNetworkStateObserver(this));
+ network_state_observer_.reset(new TrayNetworkStateObserver(this));
if (NetworkStateHandler::IsInitialized())
network_state_notifier_.reset(new NetworkStateNotifier());
Shell::GetInstance()->system_tray_notifier()->AddNetworkObserver(this);
@@ -435,12 +413,16 @@ TrayNetwork::~TrayNetwork() {
views::View* TrayNetwork::CreateTrayView(user::LoginStatus status) {
CHECK(tray_ == NULL);
+ if (!chromeos::NetworkStateHandler::IsInitialized())
+ return NULL;
tray_ = new tray::NetworkTrayView(this);
return tray_;
}
views::View* TrayNetwork::CreateDefaultView(user::LoginStatus status) {
CHECK(default_ == NULL);
+ if (!chromeos::NetworkStateHandler::IsInitialized())
+ return NULL;
CHECK(tray_ != NULL);
default_ = new tray::NetworkDefaultView(
this, status != user::LOGGED_IN_LOCKED);
@@ -449,23 +431,17 @@ views::View* TrayNetwork::CreateDefaultView(user::LoginStatus status) {
views::View* TrayNetwork::CreateDetailedView(user::LoginStatus status) {
CHECK(detailed_ == NULL);
+ if (!chromeos::NetworkStateHandler::IsInitialized())
+ return NULL;
// Clear any notifications when showing the detailed view.
messages_->messages().clear();
HideNotificationView();
if (request_wifi_view_) {
- SystemTrayDelegate* delegate = Shell::GetInstance()->system_tray_delegate();
- // The Wi-Fi state is not toggled yet at this point.
- detailed_ = new tray::NetworkWifiDetailedView(this,
- !delegate->GetWifiEnabled());
+ detailed_ = new tray::NetworkWifiDetailedView(this);
request_wifi_view_ = false;
} else {
- if (UseNewNetworkHandlers()) {
- detailed_ = new tray::NetworkStateListDetailedView(
- this, tray::NetworkStateListDetailedView::LIST_TYPE_NETWORK, status);
- } else {
- detailed_ = new tray::NetworkListDetailedView(
- this, status, IDS_ASH_STATUS_TRAY_NETWORK);
- }
+ detailed_ = new tray::NetworkStateListDetailedView(
+ this, tray::NetworkStateListDetailedView::LIST_TYPE_NETWORK, status);
detailed_->Init();
}
return detailed_;
@@ -499,16 +475,8 @@ void TrayNetwork::UpdateAfterLoginStatusChange(user::LoginStatus status) {
}
void TrayNetwork::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) {
- SetTrayImageItemBorder(tray_, alignment);
-}
-
-void TrayNetwork::OnNetworkRefresh(const NetworkIconInfo& info) {
if (tray_)
- tray_->Update(info);
- if (default_)
- default_->Update();
- if (detailed_)
- detailed_->ManagerChanged();
+ SetTrayImageItemBorder(tray_, alignment);
}
void TrayNetwork::SetNetworkMessage(NetworkTrayDelegate* delegate,
@@ -539,17 +507,22 @@ void TrayNetwork::ClearNetworkMessage(MessageType message_type) {
ShowNotificationView();
}
-void TrayNetwork::OnWillToggleWifi() {
- // Triggered by a user action (e.g. keyboard shortcut)
+void TrayNetwork::RequestToggleWifi() {
+ // This will always be triggered by a user action (e.g. keyboard shortcut)
if (!detailed_ ||
detailed_->GetViewType() == tray::NetworkDetailedView::WIFI_VIEW) {
request_wifi_view_ = true;
PopupDetailedView(kTrayPopupAutoCloseDelayForTextInSeconds, false);
}
+ NetworkStateHandler* handler = NetworkStateHandler::Get();
+ bool enabled = handler->IsTechnologyEnabled(flimflam::kTypeWifi);
+ handler->SetTechnologyEnabled(
+ flimflam::kTypeWifi, !enabled,
+ chromeos::network_handler::ErrorCallback());
}
void TrayNetwork::NetworkStateChanged(bool list_changed) {
- if (tray_ && UseNewNetworkHandlers())
+ if (tray_)
tray_->UpdateNetworkStateHandlerIcon();
if (default_)
default_->Update();
diff --git a/ash/system/chromeos/network/tray_network.h b/ash/system/chromeos/network/tray_network.h
index 42aefc4..4ffe38e 100644
--- a/ash/system/chromeos/network/tray_network.h
+++ b/ash/system/chromeos/network/tray_network.h
@@ -41,7 +41,6 @@ class TrayNetwork : public SystemTrayItem,
virtual ~TrayNetwork();
tray::NetworkDetailedView* detailed() { return detailed_; }
- void set_request_wifi_view(bool b) { request_wifi_view_ = b; }
// SystemTrayItem
virtual views::View* CreateTrayView(user::LoginStatus status) OVERRIDE;
@@ -58,7 +57,6 @@ class TrayNetwork : public SystemTrayItem,
ShelfAlignment alignment) OVERRIDE;
// NetworkObserver
- virtual void OnNetworkRefresh(const NetworkIconInfo& info) OVERRIDE;
virtual void SetNetworkMessage(
NetworkTrayDelegate* delegate,
MessageType message_type,
@@ -67,7 +65,7 @@ class TrayNetwork : public SystemTrayItem,
const base::string16& message,
const std::vector<base::string16>& links) OVERRIDE;
virtual void ClearNetworkMessage(MessageType message_type) OVERRIDE;
- virtual void OnWillToggleWifi() OVERRIDE;
+ virtual void RequestToggleWifi() OVERRIDE;
// TrayNetworkStateObserver::Delegate
virtual void NetworkStateChanged(bool list_changed) OVERRIDE;
diff --git a/ash/system/chromeos/network/tray_network_state_observer.cc b/ash/system/chromeos/network/tray_network_state_observer.cc
index d829a23..f1c6ed6 100644
--- a/ash/system/chromeos/network/tray_network_state_observer.cc
+++ b/ash/system/chromeos/network/tray_network_state_observer.cc
@@ -16,11 +16,13 @@ namespace internal {
TrayNetworkStateObserver::TrayNetworkStateObserver(Delegate* delegate)
: delegate_(delegate) {
- chromeos::NetworkStateHandler::Get()->AddObserver(this);
+ if (chromeos::NetworkStateHandler::IsInitialized())
+ chromeos::NetworkStateHandler::Get()->AddObserver(this);
}
TrayNetworkStateObserver::~TrayNetworkStateObserver() {
- chromeos::NetworkStateHandler::Get()->RemoveObserver(this);
+ if (chromeos::NetworkStateHandler::IsInitialized())
+ chromeos::NetworkStateHandler::Get()->RemoveObserver(this);
}
void TrayNetworkStateObserver::NetworkManagerChanged() {
diff --git a/ash/system/chromeos/network/tray_sms.cc b/ash/system/chromeos/network/tray_sms.cc
index 2eabe71..5decbf1 100644
--- a/ash/system/chromeos/network/tray_sms.cc
+++ b/ash/system/chromeos/network/tray_sms.cc
@@ -4,7 +4,6 @@
#include "ash/system/chromeos/network/tray_sms.h"
-#include "ash/ash_switches.h"
#include "ash/shell.h"
#include "ash/system/tray/fixed_sized_scroll_view.h"
#include "ash/system/tray/system_tray.h"
@@ -15,7 +14,6 @@
#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 "base/strings/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "grit/ash_resources.h"
diff --git a/ash/system/chromeos/network/tray_vpn.cc b/ash/system/chromeos/network/tray_vpn.cc
index 05f0596..2d7ab0e 100644
--- a/ash/system/chromeos/network/tray_vpn.cc
+++ b/ash/system/chromeos/network/tray_vpn.cc
@@ -4,10 +4,8 @@
#include "ash/system/chromeos/network/tray_vpn.h"
-#include "ash/ash_switches.h"
#include "ash/shell.h"
#include "ash/system/chromeos/network/network_icon_animation.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/tray/system_tray.h"
#include "ash/system/tray/system_tray_delegate.h"
@@ -15,7 +13,6 @@
#include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/tray_item_more.h"
#include "ash/system/tray/tray_popup_label_button.h"
-#include "base/command_line.h"
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
#include "grit/ash_strings.h"
@@ -26,16 +23,6 @@
using chromeos::NetworkState;
using chromeos::NetworkStateHandler;
-namespace {
-
-bool UseNewNetworkHandlers() {
- return !CommandLine::ForCurrentProcess()->HasSwitch(
- ash::switches::kAshDisableNewNetworkStatusArea) &&
- NetworkStateHandler::IsInitialized();
-}
-
-}
-
namespace ash {
namespace internal {
@@ -50,45 +37,29 @@ class VpnDefaultView : public TrayItemMore,
}
virtual ~VpnDefaultView() {
- if (UseNewNetworkHandlers())
- network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this);
+ network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this);
}
static bool ShouldShow() {
// Do not show VPN line in uber tray bubble if VPN is not configured.
- if (UseNewNetworkHandlers()) {
- NetworkStateHandler* handler = NetworkStateHandler::Get();
- const NetworkState* vpn = handler->FirstNetworkByType(
- flimflam::kTypeVPN);
- return vpn != NULL;
- } else {
- std::vector<NetworkIconInfo> list;
- Shell::GetInstance()->system_tray_delegate()->GetVirtualNetworks(&list);
- return list.size() != 0;
- }
+ NetworkStateHandler* handler = NetworkStateHandler::Get();
+ const NetworkState* vpn = handler->FirstNetworkByType(
+ flimflam::kTypeVPN);
+ return vpn != NULL;
}
void Update() {
- if (UseNewNetworkHandlers()) {
- gfx::ImageSkia image;
- base::string16 label;
- bool animating = false;
- GetNetworkStateHandlerImageAndLabel(&image, &label, &animating);
- if (animating)
- network_icon::NetworkIconAnimation::GetInstance()->AddObserver(this);
- else
- network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this);
- SetImage(&image);
- SetLabel(label);
- SetAccessibleName(label);
- } else {
- NetworkIconInfo info;
- Shell::GetInstance()->system_tray_delegate()->
- GetVirtualNetworkIcon(&info);
- SetImage(&info.image);
- SetLabel(info.description);
- SetAccessibleName(info.description);
- }
+ gfx::ImageSkia image;
+ base::string16 label;
+ bool animating = false;
+ GetNetworkStateHandlerImageAndLabel(&image, &label, &animating);
+ if (animating)
+ network_icon::NetworkIconAnimation::GetInstance()->AddObserver(this);
+ else
+ network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this);
+ SetImage(&image);
+ SetLabel(label);
+ SetAccessibleName(label);
}
// network_icon::AnimationObserver
@@ -125,117 +96,16 @@ class VpnDefaultView : public TrayItemMore,
DISALLOW_COPY_AND_ASSIGN(VpnDefaultView);
};
-class VpnListDetailedView : public NetworkListDetailedViewBase {
- public:
- VpnListDetailedView(SystemTrayItem* owner,
- user::LoginStatus login,
- int header_string_id)
- : NetworkListDetailedViewBase(owner, login, header_string_id),
- other_vpn_(NULL),
- no_networks_view_(NULL) {
- }
-
- virtual ~VpnListDetailedView() {
- }
-
- // Overridden from NetworkListDetailedViewBase:
-
- virtual void AppendHeaderButtons() OVERRIDE {
- AppendInfoButtonToHeader();
- }
-
- virtual void UpdateHeaderButtons() OVERRIDE {
- UpdateSettingButton();
- }
-
- virtual void AppendNetworkEntries() OVERRIDE {
- CreateScrollableList();
- }
-
- virtual void GetAvailableNetworkList(
- std::vector<NetworkIconInfo>* list) OVERRIDE{
- Shell::GetInstance()->system_tray_delegate()->GetVirtualNetworks(list);
- }
-
- virtual void UpdateNetworkEntries() OVERRIDE {
- RefreshNetworkScrollWithUpdatedNetworkData();
- }
-
- virtual void AppendCustomButtonsToBottomRow(
- views::View* bottom_row) OVERRIDE {
- other_vpn_ = new TrayPopupLabelButton(
- this,
- ui::ResourceBundle::GetSharedInstance().GetLocalizedString(
- IDS_ASH_STATUS_TRAY_OTHER_VPN));
- bottom_row->AddChildView(other_vpn_);
- }
-
- virtual void UpdateNetworkExtra() OVERRIDE {
- if (login() == user::LOGGED_IN_LOCKED)
- return;
- }
-
- virtual void CustomButtonPressed(views::Button* sender,
- const ui::Event& event) OVERRIDE {
- if (sender == other_vpn_)
- ash::Shell::GetInstance()->system_tray_delegate()->ShowOtherVPN();
- else
- NOTREACHED();
- }
-
- virtual bool CustomLinkClickedOn(views::View* sender) OVERRIDE {
- return false;
- }
-
- virtual bool UpdateNetworkListEntries(
- std::set<std::string>* new_service_paths) OVERRIDE {
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- bool needs_relayout = false;
-
- int index = 0;
-
- for (size_t i = 0; i < network_list().size(); ++i) {
- const NetworkIconInfo* info = &network_list()[i];
- if (UpdateNetworkChild(index++, info))
- needs_relayout = true;
- new_service_paths->insert(info->service_path);
- }
-
- // We shouldn't be showing this list if there are no VPNs, but it could
- // be possible to get here if a VPN were removed (e.g. by a policy) while
- // the UI was open. Better to show something than nothing.
- if (network_list().empty()) {
- if (CreateOrUpdateInfoLabel(
- index++,
- rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_NETWORK_NO_VPN),
- &no_networks_view_)) {
- needs_relayout = true;
- }
- }
-
- return needs_relayout;
- }
-
- private:
- TrayPopupLabelButton* other_vpn_;
- views::Label* no_networks_view_;
-
- DISALLOW_COPY_AND_ASSIGN(VpnListDetailedView);
-};
-
} // namespace tray
TrayVPN::TrayVPN(SystemTray* system_tray)
: SystemTrayItem(system_tray),
default_(NULL),
detailed_(NULL) {
- if (UseNewNetworkHandlers())
- network_state_observer_.reset(new TrayNetworkStateObserver(this));
- Shell::GetInstance()->system_tray_notifier()->AddVpnObserver(this);
+ network_state_observer_.reset(new TrayNetworkStateObserver(this));
}
TrayVPN::~TrayVPN() {
- Shell::GetInstance()->system_tray_notifier()->RemoveVpnObserver(this);
}
views::View* TrayVPN::CreateTrayView(user::LoginStatus status) {
@@ -244,9 +114,10 @@ views::View* TrayVPN::CreateTrayView(user::LoginStatus status) {
views::View* TrayVPN::CreateDefaultView(user::LoginStatus status) {
CHECK(default_ == NULL);
+ if (!chromeos::NetworkStateHandler::IsInitialized())
+ return NULL;
if (status == user::LOGGED_IN_NONE)
return NULL;
-
if (!tray::VpnDefaultView::ShouldShow())
return NULL;
@@ -256,14 +127,11 @@ views::View* TrayVPN::CreateDefaultView(user::LoginStatus status) {
views::View* TrayVPN::CreateDetailedView(user::LoginStatus status) {
CHECK(detailed_ == NULL);
+ if (!chromeos::NetworkStateHandler::IsInitialized())
+ return NULL;
- if (UseNewNetworkHandlers()) {
- detailed_ = new tray::NetworkStateListDetailedView(
- this, tray::NetworkStateListDetailedView::LIST_TYPE_VPN, status);
- } else {
- detailed_ = new tray::VpnListDetailedView(
- this, status, IDS_ASH_STATUS_TRAY_VPN);
- }
+ detailed_ = new tray::NetworkStateListDetailedView(
+ this, tray::NetworkStateListDetailedView::LIST_TYPE_VPN, status);
detailed_->Init();
return detailed_;
}
@@ -292,35 +160,6 @@ void TrayVPN::UpdateAfterLoginStatusChange(user::LoginStatus status) {
void TrayVPN::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) {
}
-void TrayVPN::OnNetworkRefresh(const NetworkIconInfo& info) {
- if (default_) {
- default_->Update();
- } else if (tray::VpnDefaultView::ShouldShow()) {
- if (system_tray()->HasSystemBubbleType(
- SystemTrayBubble::BUBBLE_TYPE_DEFAULT)) {
- // We created the default view without a VPN view, so rebuild it.
- system_tray()->ShowDefaultView(BUBBLE_USE_EXISTING);
- }
- }
-
- if (detailed_)
- detailed_->ManagerChanged();
-}
-
-void TrayVPN::SetNetworkMessage(NetworkTrayDelegate* delegate,
- MessageType message_type,
- NetworkType network_type,
- const base::string16& title,
- const base::string16& message,
- const std::vector<base::string16>& links) {
-}
-
-void TrayVPN::ClearNetworkMessage(MessageType message_type) {
-}
-
-void TrayVPN::OnWillToggleWifi() {
-}
-
void TrayVPN::NetworkStateChanged(bool list_changed) {
if (default_)
default_->Update();
diff --git a/ash/system/chromeos/network/tray_vpn.h b/ash/system/chromeos/network/tray_vpn.h
index 052c52e..ece975b 100644
--- a/ash/system/chromeos/network/tray_vpn.h
+++ b/ash/system/chromeos/network/tray_vpn.h
@@ -5,7 +5,6 @@
#ifndef ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_VPN_H
#define ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_VPN_H
-#include "ash/system/chromeos/network/network_observer.h"
#include "ash/system/chromeos/network/tray_network_state_observer.h"
#include "ash/system/tray/system_tray_item.h"
#include "base/memory/scoped_ptr.h"
@@ -22,7 +21,6 @@ class VpnDetailedView;
}
class TrayVPN : public SystemTrayItem,
- public NetworkObserver,
public TrayNetworkStateObserver::Delegate {
public:
explicit TrayVPN(SystemTray* system_tray);
@@ -42,18 +40,6 @@ class TrayVPN : public SystemTrayItem,
virtual void UpdateAfterShelfAlignmentChange(
ShelfAlignment alignment) OVERRIDE;
- // NetworkObserver
- virtual void OnNetworkRefresh(const NetworkIconInfo& info) OVERRIDE;
- virtual void SetNetworkMessage(
- NetworkTrayDelegate* delegate,
- MessageType message_type,
- NetworkType network_type,
- const base::string16& title,
- const base::string16& message,
- const std::vector<base::string16>& links) OVERRIDE;
- virtual void ClearNetworkMessage(MessageType message_type) OVERRIDE;
- virtual void OnWillToggleWifi() OVERRIDE;
-
// TrayNetworkStateObserver::Delegate
virtual void NetworkStateChanged(bool list_changed) OVERRIDE;
virtual void NetworkServiceChanged(
diff --git a/ash/system/tray/system_tray_delegate.h b/ash/system/tray/system_tray_delegate.h
index 2e84617..763c59d 100644
--- a/ash/system/tray/system_tray_delegate.h
+++ b/ash/system/tray/system_tray_delegate.h
@@ -240,47 +240,15 @@ class SystemTrayDelegate {
virtual void GetDriveOperationStatusList(
DriveOperationStatusList* list) = 0;
- // Returns information about the most relevant network. Relevance is
- // determined by the implementor (e.g. a connecting network may be more
- // relevant over a connected network etc.)
- virtual void GetMostRelevantNetworkIcon(NetworkIconInfo* info,
- bool large) = 0;
-
- virtual void GetVirtualNetworkIcon(ash::NetworkIconInfo* info) = 0;
-
- // Returns information about the available networks.
- virtual void GetAvailableNetworks(std::vector<NetworkIconInfo>* list) = 0;
-
- // Returns the information about all virtual networks.
- virtual void GetVirtualNetworks(std::vector<NetworkIconInfo>* list) = 0;
-
// Shows UI to configure or activate the network specified by |network_id|.
virtual void ConfigureNetwork(const std::string& network_id) = 0;
// Sends a connect request for the network specified by |network_id|.
virtual void ConnectToNetwork(const std::string& network_id) = 0;
- // Gets the network IP address, and the mac addresses for the ethernet and
- // wifi devices. If any of this is unavailable, empty strings are returned.
- virtual void GetNetworkAddresses(std::string* ip_address,
- std::string* ethernet_mac_address,
- std::string* wifi_mac_address) = 0;
-
- // Requests network scan when list of networks is opened.
- virtual void RequestNetworkScan() = 0;
-
- // Shous UI to add a new bluetooth device.
+ // Shows UI to add a new bluetooth device.
virtual void AddBluetoothDevice() = 0;
- // Toggles airplane mode.
- virtual void ToggleAirplaneMode() = 0;
-
- // Toggles wifi network.
- virtual void ToggleWifi() = 0;
-
- // Toggles mobile network.
- virtual void ToggleMobile() = 0;
-
// Toggles bluetooth.
virtual void ToggleBluetooth() = 0;
@@ -296,30 +264,12 @@ class SystemTrayDelegate {
// Shows UI to search for cellular networks.
virtual void ShowOtherCellular() = 0;
- // Returns whether the system is connected to any network.
- virtual bool IsNetworkConnected() = 0;
-
- // Returns whether wifi is available.
- virtual bool GetWifiAvailable() = 0;
-
- // Returns whether mobile networking (cellular or wimax) is available.
- virtual bool GetMobileAvailable() = 0;
-
// Returns whether bluetooth capability is available.
virtual bool GetBluetoothAvailable() = 0;
- // Returns whether wifi is enabled.
- virtual bool GetWifiEnabled() = 0;
-
- // Returns whether mobile (cellular or wimax) networking is enabled.
- virtual bool GetMobileEnabled() = 0;
-
// Returns whether bluetooth is enabled.
virtual bool GetBluetoothEnabled() = 0;
- // Returns whether mobile scanning is supported.
- virtual bool GetMobileScanSupported() = 0;
-
// Retrieves information about the carrier and locale specific |setup_url|.
// If none of the carrier info/setup URL cannot be retrieved, returns false.
// Note: |setup_url| is returned when carrier is not defined (no SIM card).
@@ -327,12 +277,6 @@ class SystemTrayDelegate {
std::string* topup_url,
std::string* setup_url) = 0;
- // Returns whether the network manager is scanning for wifi networks.
- virtual bool GetWifiScanning() = 0;
-
- // Returns whether the network manager is initializing the cellular modem.
- virtual bool GetCellularInitializing() = 0;
-
// Opens the cellular network specific URL.
virtual void ShowCellularURL(const std::string& url) = 0;
diff --git a/ash/system/tray/system_tray_notifier.cc b/ash/system/tray/system_tray_notifier.cc
index 20f7eed..6680cee 100644
--- a/ash/system/tray/system_tray_notifier.cc
+++ b/ash/system/tray/system_tray_notifier.cc
@@ -133,14 +133,6 @@ void SystemTrayNotifier::RemoveNetworkObserver(NetworkObserver* observer) {
network_observers_.RemoveObserver(observer);
}
-void SystemTrayNotifier::AddVpnObserver(NetworkObserver* observer) {
- vpn_observers_.AddObserver(observer);
-}
-
-void SystemTrayNotifier::RemoveVpnObserver(NetworkObserver* observer) {
- vpn_observers_.RemoveObserver(observer);
-}
-
void SystemTrayNotifier::AddSmsObserver(SmsObserver* observer) {
sms_observers_.AddObserver(observer);
}
@@ -292,12 +284,6 @@ void SystemTrayNotifier::NotifyMuteToggled() {
OnMuteToggled());
}
-void SystemTrayNotifier::NotifyRefreshNetwork(const NetworkIconInfo &info) {
- FOR_EACH_OBSERVER(NetworkObserver,
- network_observers_,
- OnNetworkRefresh(info));
-}
-
void SystemTrayNotifier::NotifySetNetworkMessage(
NetworkTrayDelegate* delegate,
NetworkObserver::MessageType message_type,
@@ -323,16 +309,10 @@ void SystemTrayNotifier::NotifyClearNetworkMessage(
ClearNetworkMessage(message_type));
}
-void SystemTrayNotifier::NotifyVpnRefreshNetwork(const NetworkIconInfo &info) {
- FOR_EACH_OBSERVER(NetworkObserver,
- vpn_observers_,
- OnNetworkRefresh(info));
-}
-
-void SystemTrayNotifier::NotifyWillToggleWifi() {
+void SystemTrayNotifier::NotifyRequestToggleWifi() {
FOR_EACH_OBSERVER(NetworkObserver,
network_observers_,
- OnWillToggleWifi());
+ RequestToggleWifi());
}
void SystemTrayNotifier::NotifyAddSmsMessage(
diff --git a/ash/system/tray/system_tray_notifier.h b/ash/system/tray/system_tray_notifier.h
index fbd9874..66885b9 100644
--- a/ash/system/tray/system_tray_notifier.h
+++ b/ash/system/tray/system_tray_notifier.h
@@ -83,9 +83,6 @@ public:
void AddNetworkObserver(NetworkObserver* observer);
void RemoveNetworkObserver(NetworkObserver* observer);
- void AddVpnObserver(NetworkObserver* observer);
- void RemoveVpnObserver(NetworkObserver* observer);
-
void AddSmsObserver(SmsObserver* observer);
void RemoveSmsObserver(SmsObserver* observer);
@@ -119,7 +116,6 @@ public:
#if defined(OS_CHROMEOS)
void NotifyVolumeChanged(float level);
void NotifyMuteToggled();
- void NotifyRefreshNetwork(const NetworkIconInfo &info);
void NotifySetNetworkMessage(NetworkTrayDelegate* delegate,
NetworkObserver::MessageType message_type,
NetworkObserver::NetworkType network_type,
@@ -127,8 +123,7 @@ public:
const base::string16& message,
const std::vector<base::string16>& links);
void NotifyClearNetworkMessage(NetworkObserver::MessageType message_type);
- void NotifyVpnRefreshNetwork(const NetworkIconInfo &info);
- void NotifyWillToggleWifi();
+ void NotifyRequestToggleWifi();
void NotifyAddSmsMessage(const base::DictionaryValue& message);
void NotifyEnterpriseDomainChanged();
void NotifyScreenCaptureStart(const base::Closure& stop_callback,
@@ -152,7 +147,6 @@ public:
#if defined(OS_CHROMEOS)
ObserverList<AudioObserver> audio_observers_;
ObserverList<NetworkObserver> network_observers_;
- ObserverList<NetworkObserver> vpn_observers_;
ObserverList<SmsObserver> sms_observers_;
ObserverList<EnterpriseDomainObserver> enterprise_domain_observers_;
ObserverList<ScreenCaptureObserver> screen_capture_observers_;
diff --git a/ash/system/tray/test_system_tray_delegate.cc b/ash/system/tray/test_system_tray_delegate.cc
index a833f18..c2eb2df 100644
--- a/ash/system/tray/test_system_tray_delegate.cc
+++ b/ash/system/tray/test_system_tray_delegate.cc
@@ -51,9 +51,7 @@ class TestVolumeControlDelegate : public VolumeControlDelegate {
} // namespace
TestSystemTrayDelegate::TestSystemTrayDelegate()
- : wifi_enabled_(true),
- cellular_enabled_(true),
- bluetooth_enabled_(true),
+ : bluetooth_enabled_(true),
caps_lock_enabled_(false),
volume_control_delegate_(new TestVolumeControlDelegate) {
}
@@ -213,53 +211,15 @@ void TestSystemTrayDelegate::GetDriveOperationStatusList(
ash::DriveOperationStatusList*) {
}
-void TestSystemTrayDelegate::GetMostRelevantNetworkIcon(NetworkIconInfo* info,
- bool large) {
-}
-
-void TestSystemTrayDelegate::GetVirtualNetworkIcon(ash::NetworkIconInfo* info) {
-}
-
-void TestSystemTrayDelegate::GetAvailableNetworks(
- std::vector<NetworkIconInfo>* list) {
-}
-
-void TestSystemTrayDelegate::GetVirtualNetworks(
- std::vector<NetworkIconInfo>* list) {
-}
-
void TestSystemTrayDelegate::ConfigureNetwork(const std::string& network_id) {
}
void TestSystemTrayDelegate::ConnectToNetwork(const std::string& network_id) {
}
-void TestSystemTrayDelegate::GetNetworkAddresses(
- std::string* ip_address,
- std::string* ethernet_mac_address,
- std::string* wifi_mac_address) {
- *ip_address = "127.0.0.1";
- *ethernet_mac_address = "00:11:22:33:44:55";
- *wifi_mac_address = "66:77:88:99:00:11";
-}
-
-void TestSystemTrayDelegate::RequestNetworkScan() {
-}
-
void TestSystemTrayDelegate::AddBluetoothDevice() {
}
-void TestSystemTrayDelegate::ToggleAirplaneMode() {
-}
-
-void TestSystemTrayDelegate::ToggleWifi() {
- wifi_enabled_ = !wifi_enabled_;
-}
-
-void TestSystemTrayDelegate::ToggleMobile() {
- cellular_enabled_ = !cellular_enabled_;
-}
-
void TestSystemTrayDelegate::ToggleBluetooth() {
bluetooth_enabled_ = !bluetooth_enabled_;
}
@@ -280,52 +240,20 @@ void TestSystemTrayDelegate::ShowOtherVPN() {
void TestSystemTrayDelegate::ShowOtherCellular() {
}
-bool TestSystemTrayDelegate::IsNetworkConnected() {
- return true;
-}
-
-bool TestSystemTrayDelegate::GetWifiAvailable() {
- return true;
-}
-
-bool TestSystemTrayDelegate::GetMobileAvailable() {
- return true;
-}
-
bool TestSystemTrayDelegate::GetBluetoothAvailable() {
return true;
}
-bool TestSystemTrayDelegate::GetWifiEnabled() {
- return wifi_enabled_;
-}
-
-bool TestSystemTrayDelegate::GetMobileEnabled() {
- return cellular_enabled_;
-}
-
bool TestSystemTrayDelegate::GetBluetoothEnabled() {
return bluetooth_enabled_;
}
-bool TestSystemTrayDelegate::GetMobileScanSupported() {
- return true;
-}
-
bool TestSystemTrayDelegate::GetCellularCarrierInfo(std::string* carrier_id,
std::string* topup_url,
std::string* setup_url) {
return false;
}
-bool TestSystemTrayDelegate::GetWifiScanning() {
- return false;
-}
-
-bool TestSystemTrayDelegate::GetCellularInitializing() {
- return false;
-}
-
void TestSystemTrayDelegate::ShowCellularURL(const std::string& url) {
}
diff --git a/ash/system/tray/test_system_tray_delegate.h b/ash/system/tray/test_system_tray_delegate.h
index 4e44680..27ee734 100644
--- a/ash/system/tray/test_system_tray_delegate.h
+++ b/ash/system/tray/test_system_tray_delegate.h
@@ -65,41 +65,20 @@ class TestSystemTrayDelegate : public SystemTrayDelegate {
virtual void CancelDriveOperation(int32 operation_id) OVERRIDE;
virtual void GetDriveOperationStatusList(
ash::DriveOperationStatusList*) OVERRIDE;
- virtual void GetMostRelevantNetworkIcon(NetworkIconInfo* info,
- bool large) OVERRIDE;
- virtual void GetVirtualNetworkIcon(ash::NetworkIconInfo* info) OVERRIDE;
- virtual void GetAvailableNetworks(
- std::vector<NetworkIconInfo>* list) OVERRIDE;
- virtual void GetVirtualNetworks(std::vector<NetworkIconInfo>* list) OVERRIDE;
virtual void ConfigureNetwork(const std::string& network_id) OVERRIDE;
virtual void ConnectToNetwork(const std::string& network_id) OVERRIDE;
- virtual void GetNetworkAddresses(std::string* ip_address,
- std::string* ethernet_mac_address,
- std::string* wifi_mac_address) OVERRIDE;
- virtual void RequestNetworkScan() OVERRIDE;
virtual void AddBluetoothDevice() OVERRIDE;
- virtual void ToggleAirplaneMode() OVERRIDE;
- virtual void ToggleWifi() OVERRIDE;
- virtual void ToggleMobile() OVERRIDE;
virtual void ToggleBluetooth() OVERRIDE;
virtual bool IsBluetoothDiscovering() OVERRIDE;
virtual void ShowMobileSimDialog() OVERRIDE;
virtual void ShowOtherWifi() OVERRIDE;
virtual void ShowOtherVPN() OVERRIDE;
virtual void ShowOtherCellular() OVERRIDE;
- virtual bool IsNetworkConnected() OVERRIDE;
- virtual bool GetWifiAvailable() OVERRIDE;
- virtual bool GetMobileAvailable() OVERRIDE;
virtual bool GetBluetoothAvailable() OVERRIDE;
- virtual bool GetWifiEnabled() OVERRIDE;
- virtual bool GetMobileEnabled() OVERRIDE;
virtual bool GetBluetoothEnabled() OVERRIDE;
- virtual bool GetMobileScanSupported() OVERRIDE;
virtual bool GetCellularCarrierInfo(std::string* carrier_id,
std::string* topup_url,
std::string* setup_url) OVERRIDE;
- virtual bool GetWifiScanning() OVERRIDE;
- virtual bool GetCellularInitializing() OVERRIDE;
virtual void ShowCellularURL(const std::string& url) OVERRIDE;
virtual void ChangeProxySettings() OVERRIDE;
virtual VolumeControlDelegate* GetVolumeControlDelegate() const OVERRIDE;
@@ -115,8 +94,6 @@ class TestSystemTrayDelegate : public SystemTrayDelegate {
virtual void MaybeSpeak(const std::string& utterance) const OVERRIDE;
private:
- bool wifi_enabled_;
- bool cellular_enabled_;
bool bluetooth_enabled_;
bool caps_lock_enabled_;
scoped_ptr<VolumeControlDelegate> volume_control_delegate_;