Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Side by Side Diff: ash/system/chromeos/network/tray_network.cc

Issue 2098023002: mash: Migrate remaining tray observers and notify functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync and rebase. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/system/chromeos/network/tray_network.h" 5 #include "ash/system/chromeos/network/tray_network.h"
6 6
7 #include "ash/common/ash_switches.h" 7 #include "ash/common/ash_switches.h"
8 #include "ash/common/shelf/wm_shelf_util.h" 8 #include "ash/common/shelf/wm_shelf_util.h"
9 #include "ash/common/system/tray/system_tray_delegate.h" 9 #include "ash/common/system/tray/system_tray_delegate.h"
10 #include "ash/common/system/tray/system_tray_notifier.h"
10 #include "ash/common/system/tray/tray_constants.h" 11 #include "ash/common/system/tray/tray_constants.h"
11 #include "ash/common/system/tray/tray_item_more.h" 12 #include "ash/common/system/tray/tray_item_more.h"
12 #include "ash/common/system/tray/tray_item_view.h" 13 #include "ash/common/system/tray/tray_item_view.h"
13 #include "ash/common/system/tray/tray_utils.h" 14 #include "ash/common/system/tray/tray_utils.h"
14 #include "ash/common/wm_shell.h" 15 #include "ash/common/wm_shell.h"
15 #include "ash/shelf/shelf_util.h" 16 #include "ash/shelf/shelf_util.h"
16 #include "ash/shell.h"
17 #include "ash/system/chromeos/network/network_state_list_detailed_view.h" 17 #include "ash/system/chromeos/network/network_state_list_detailed_view.h"
18 #include "ash/system/chromeos/network/tray_network_state_observer.h" 18 #include "ash/system/chromeos/network/tray_network_state_observer.h"
19 #include "ash/system/tray/system_tray.h" 19 #include "ash/system/tray/system_tray.h"
20 #include "ash/system/tray/system_tray_notifier.h"
21 #include "base/command_line.h" 20 #include "base/command_line.h"
22 #include "base/strings/utf_string_conversions.h" 21 #include "base/strings/utf_string_conversions.h"
23 #include "chromeos/network/network_state.h" 22 #include "chromeos/network/network_state.h"
24 #include "chromeos/network/network_state_handler.h" 23 #include "chromeos/network/network_state_handler.h"
25 #include "grit/ash_resources.h" 24 #include "grit/ash_resources.h"
26 #include "grit/ash_strings.h" 25 #include "grit/ash_strings.h"
27 #include "grit/ui_chromeos_strings.h" 26 #include "grit/ui_chromeos_strings.h"
28 #include "third_party/cros_system_api/dbus/service_constants.h" 27 #include "third_party/cros_system_api/dbus/service_constants.h"
29 #include "ui/accessibility/ax_view_state.h" 28 #include "ui/accessibility/ax_view_state.h"
30 #include "ui/base/l10n/l10n_util.h" 29 #include "ui/base/l10n/l10n_util.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 235
237 } // namespace tray 236 } // namespace tray
238 237
239 TrayNetwork::TrayNetwork(SystemTray* system_tray) 238 TrayNetwork::TrayNetwork(SystemTray* system_tray)
240 : SystemTrayItem(system_tray), 239 : SystemTrayItem(system_tray),
241 tray_(NULL), 240 tray_(NULL),
242 default_(NULL), 241 default_(NULL),
243 detailed_(NULL), 242 detailed_(NULL),
244 request_wifi_view_(false) { 243 request_wifi_view_(false) {
245 network_state_observer_.reset(new TrayNetworkStateObserver(this)); 244 network_state_observer_.reset(new TrayNetworkStateObserver(this));
246 SystemTrayNotifier* notifier = Shell::GetInstance()->system_tray_notifier(); 245 SystemTrayNotifier* notifier = WmShell::Get()->system_tray_notifier();
247 notifier->AddNetworkObserver(this); 246 notifier->AddNetworkObserver(this);
248 notifier->AddNetworkPortalDetectorObserver(this); 247 notifier->AddNetworkPortalDetectorObserver(this);
249 } 248 }
250 249
251 TrayNetwork::~TrayNetwork() { 250 TrayNetwork::~TrayNetwork() {
252 SystemTrayNotifier* notifier = Shell::GetInstance()->system_tray_notifier(); 251 SystemTrayNotifier* notifier = WmShell::Get()->system_tray_notifier();
253 notifier->RemoveNetworkObserver(this); 252 notifier->RemoveNetworkObserver(this);
254 notifier->RemoveNetworkPortalDetectorObserver(this); 253 notifier->RemoveNetworkPortalDetectorObserver(this);
255 } 254 }
256 255
257 views::View* TrayNetwork::CreateTrayView(LoginStatus status) { 256 views::View* TrayNetwork::CreateTrayView(LoginStatus status) {
258 CHECK(tray_ == NULL); 257 CHECK(tray_ == NULL);
259 if (!chromeos::NetworkHandler::IsInitialized()) 258 if (!chromeos::NetworkHandler::IsInitialized())
260 return NULL; 259 return NULL;
261 tray_ = new tray::NetworkTrayView(this); 260 tray_ = new tray::NetworkTrayView(this);
262 return tray_; 261 return tray_;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 void TrayNetwork::NetworkStateChanged() { 331 void TrayNetwork::NetworkStateChanged() {
333 if (tray_) 332 if (tray_)
334 tray_->UpdateNetworkStateHandlerIcon(); 333 tray_->UpdateNetworkStateHandlerIcon();
335 if (default_) 334 if (default_)
336 default_->Update(); 335 default_->Update();
337 if (detailed_) 336 if (detailed_)
338 detailed_->Update(); 337 detailed_->Update();
339 } 338 }
340 339
341 } // namespace ash 340 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698