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

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

Issue 2808723004: Renames WmShell to ShellPort (Closed)
Patch Set: feedback Created 3 years, 8 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/network/tray_network.h" 5 #include "ash/system/network/tray_network.h"
6 6
7 #include "ash/shelf/wm_shelf_util.h" 7 #include "ash/shelf/wm_shelf_util.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell_port.h"
9 #include "ash/strings/grit/ash_strings.h" 10 #include "ash/strings/grit/ash_strings.h"
10 #include "ash/system/network/network_icon.h" 11 #include "ash/system/network/network_icon.h"
11 #include "ash/system/network/network_icon_animation.h" 12 #include "ash/system/network/network_icon_animation.h"
12 #include "ash/system/network/network_icon_animation_observer.h" 13 #include "ash/system/network/network_icon_animation_observer.h"
13 #include "ash/system/network/network_state_list_detailed_view.h" 14 #include "ash/system/network/network_state_list_detailed_view.h"
14 #include "ash/system/network/tray_network_state_observer.h" 15 #include "ash/system/network/tray_network_state_observer.h"
15 #include "ash/system/tray/system_tray.h" 16 #include "ash/system/tray/system_tray.h"
16 #include "ash/system/tray/system_tray_delegate.h" 17 #include "ash/system/tray/system_tray_delegate.h"
17 #include "ash/system/tray/system_tray_notifier.h" 18 #include "ash/system/tray/system_tray_notifier.h"
18 #include "ash/system/tray/tray_constants.h" 19 #include "ash/system/tray/tray_constants.h"
19 #include "ash/system/tray/tray_item_more.h" 20 #include "ash/system/tray/tray_item_more.h"
20 #include "ash/system/tray/tray_item_view.h" 21 #include "ash/system/tray/tray_item_view.h"
21 #include "ash/system/tray/tray_popup_item_style.h" 22 #include "ash/system/tray/tray_popup_item_style.h"
22 #include "ash/system/tray/tray_utils.h" 23 #include "ash/system/tray/tray_utils.h"
23 #include "ash/wm_shell.h"
24 #include "base/command_line.h" 24 #include "base/command_line.h"
25 #include "base/strings/utf_string_conversions.h" 25 #include "base/strings/utf_string_conversions.h"
26 #include "chromeos/network/network_state.h" 26 #include "chromeos/network/network_state.h"
27 #include "chromeos/network/network_state_handler.h" 27 #include "chromeos/network/network_state_handler.h"
28 #include "third_party/cros_system_api/dbus/service_constants.h" 28 #include "third_party/cros_system_api/dbus/service_constants.h"
29 #include "ui/accessibility/ax_node_data.h" 29 #include "ui/accessibility/ax_node_data.h"
30 #include "ui/base/l10n/l10n_util.h" 30 #include "ui/base/l10n/l10n_util.h"
31 #include "ui/views/controls/image_view.h" 31 #include "ui/views/controls/image_view.h"
32 #include "ui/views/controls/link.h" 32 #include "ui/views/controls/link.h"
33 #include "ui/views/controls/link_listener.h" 33 #include "ui/views/controls/link_listener.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 if (!chromeos::NetworkHandler::IsInitialized()) 256 if (!chromeos::NetworkHandler::IsInitialized())
257 return NULL; 257 return NULL;
258 CHECK(tray_ != NULL); 258 CHECK(tray_ != NULL);
259 default_ = new tray::NetworkDefaultView(this); 259 default_ = new tray::NetworkDefaultView(this);
260 default_->SetEnabled(status != LoginStatus::LOCKED); 260 default_->SetEnabled(status != LoginStatus::LOCKED);
261 return default_; 261 return default_;
262 } 262 }
263 263
264 views::View* TrayNetwork::CreateDetailedView(LoginStatus status) { 264 views::View* TrayNetwork::CreateDetailedView(LoginStatus status) {
265 CHECK(detailed_ == NULL); 265 CHECK(detailed_ == NULL);
266 WmShell::Get()->RecordUserMetricsAction( 266 ShellPort::Get()->RecordUserMetricsAction(
267 UMA_STATUS_AREA_DETAILED_NETWORK_VIEW); 267 UMA_STATUS_AREA_DETAILED_NETWORK_VIEW);
268 if (!chromeos::NetworkHandler::IsInitialized()) 268 if (!chromeos::NetworkHandler::IsInitialized())
269 return NULL; 269 return NULL;
270 if (request_wifi_view_) { 270 if (request_wifi_view_) {
271 detailed_ = new tray::NetworkWifiDetailedView(this); 271 detailed_ = new tray::NetworkWifiDetailedView(this);
272 request_wifi_view_ = false; 272 request_wifi_view_ = false;
273 } else { 273 } else {
274 detailed_ = new tray::NetworkStateListDetailedView( 274 detailed_ = new tray::NetworkStateListDetailedView(
275 this, tray::NetworkStateListDetailedView::LIST_TYPE_NETWORK, status); 275 this, tray::NetworkStateListDetailedView::LIST_TYPE_NETWORK, status);
276 } 276 }
(...skipping 15 matching lines...) Expand all
292 292
293 void TrayNetwork::RequestToggleWifi() { 293 void TrayNetwork::RequestToggleWifi() {
294 // This will always be triggered by a user action (e.g. keyboard shortcut) 294 // This will always be triggered by a user action (e.g. keyboard shortcut)
295 if (!detailed_ || 295 if (!detailed_ ||
296 detailed_->GetViewType() == tray::NetworkDetailedView::WIFI_VIEW) { 296 detailed_->GetViewType() == tray::NetworkDetailedView::WIFI_VIEW) {
297 request_wifi_view_ = true; 297 request_wifi_view_ = true;
298 ShowDetailedView(kTrayPopupAutoCloseDelayForTextInSeconds, false); 298 ShowDetailedView(kTrayPopupAutoCloseDelayForTextInSeconds, false);
299 } 299 }
300 NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler(); 300 NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler();
301 bool enabled = handler->IsTechnologyEnabled(NetworkTypePattern::WiFi()); 301 bool enabled = handler->IsTechnologyEnabled(NetworkTypePattern::WiFi());
302 WmShell::Get()->RecordUserMetricsAction( 302 ShellPort::Get()->RecordUserMetricsAction(
303 enabled ? UMA_STATUS_AREA_DISABLE_WIFI : UMA_STATUS_AREA_ENABLE_WIFI); 303 enabled ? UMA_STATUS_AREA_DISABLE_WIFI : UMA_STATUS_AREA_ENABLE_WIFI);
304 handler->SetTechnologyEnabled(NetworkTypePattern::WiFi(), !enabled, 304 handler->SetTechnologyEnabled(NetworkTypePattern::WiFi(), !enabled,
305 chromeos::network_handler::ErrorCallback()); 305 chromeos::network_handler::ErrorCallback());
306 } 306 }
307 307
308 void TrayNetwork::OnCaptivePortalDetected(const std::string& /* guid */) { 308 void TrayNetwork::OnCaptivePortalDetected(const std::string& /* guid */) {
309 NetworkStateChanged(); 309 NetworkStateChanged();
310 } 310 }
311 311
312 void TrayNetwork::NetworkStateChanged() { 312 void TrayNetwork::NetworkStateChanged() {
313 if (tray_) 313 if (tray_)
314 tray_->UpdateNetworkStateHandlerIcon(); 314 tray_->UpdateNetworkStateHandlerIcon();
315 if (default_) 315 if (default_)
316 default_->Update(); 316 default_->Update();
317 if (detailed_) 317 if (detailed_)
318 detailed_->Update(); 318 detailed_->Update();
319 } 319 }
320 320
321 } // namespace ash 321 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698