OLD | NEW |
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/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/system/chromeos/network/network_icon_animation.h" | 9 #include "ash/system/chromeos/network/network_icon_animation.h" |
10 #include "ash/system/chromeos/network/network_list_detailed_view.h" | 10 #include "ash/system/chromeos/network/network_list_detailed_view.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "grit/ash_strings.h" | 25 #include "grit/ash_strings.h" |
26 #include "third_party/cros_system_api/dbus/service_constants.h" | 26 #include "third_party/cros_system_api/dbus/service_constants.h" |
27 #include "ui/base/accessibility/accessible_view_state.h" | 27 #include "ui/base/accessibility/accessible_view_state.h" |
28 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
29 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
30 #include "ui/views/controls/link.h" | 30 #include "ui/views/controls/link.h" |
31 #include "ui/views/controls/link_listener.h" | 31 #include "ui/views/controls/link_listener.h" |
32 #include "ui/views/layout/box_layout.h" | 32 #include "ui/views/layout/box_layout.h" |
33 #include "ui/views/widget/widget.h" | 33 #include "ui/views/widget/widget.h" |
34 | 34 |
| 35 using chromeos::NetworkState; |
| 36 using chromeos::NetworkStateHandler; |
| 37 |
35 namespace { | 38 namespace { |
36 | 39 |
37 using ash::internal::TrayNetwork; | 40 using ash::internal::TrayNetwork; |
38 | 41 |
39 int GetMessageIcon( | 42 int GetMessageIcon( |
40 TrayNetwork::MessageType message_type, | 43 TrayNetwork::MessageType message_type, |
41 TrayNetwork::NetworkType network_type) { | 44 TrayNetwork::NetworkType network_type) { |
42 switch(message_type) { | 45 switch(message_type) { |
43 case TrayNetwork::ERROR_CONNECT_FAILED: | 46 case TrayNetwork::ERROR_CONNECT_FAILED: |
44 if (TrayNetwork::NETWORK_CELLULAR == network_type) | 47 if (TrayNetwork::NETWORK_CELLULAR == network_type) |
45 return IDR_AURA_UBER_TRAY_CELLULAR_NETWORK_FAILED; | 48 return IDR_AURA_UBER_TRAY_CELLULAR_NETWORK_FAILED; |
46 else | 49 else |
47 return IDR_AURA_UBER_TRAY_NETWORK_FAILED; | 50 return IDR_AURA_UBER_TRAY_NETWORK_FAILED; |
48 case TrayNetwork::MESSAGE_DATA_PROMO: | 51 case TrayNetwork::MESSAGE_DATA_PROMO: |
49 if (network_type == TrayNetwork::NETWORK_CELLULAR_LTE) | 52 if (network_type == TrayNetwork::NETWORK_CELLULAR_LTE) |
50 return IDR_AURA_UBER_TRAY_NOTIFICATION_LTE; | 53 return IDR_AURA_UBER_TRAY_NOTIFICATION_LTE; |
51 else | 54 else |
52 return IDR_AURA_UBER_TRAY_NOTIFICATION_3G; | 55 return IDR_AURA_UBER_TRAY_NOTIFICATION_3G; |
53 } | 56 } |
54 NOTREACHED(); | 57 NOTREACHED(); |
55 return 0; | 58 return 0; |
56 } | 59 } |
57 | 60 |
58 bool UseNewNetworkHandlers() { | 61 bool UseNewNetworkHandlers() { |
59 return CommandLine::ForCurrentProcess()->HasSwitch( | 62 return !CommandLine::ForCurrentProcess()->HasSwitch( |
60 ash::switches::kAshEnableNewNetworkStatusArea); | 63 ash::switches::kAshDisableNewNetworkStatusArea) && |
| 64 NetworkStateHandler::IsInitialized(); |
61 } | 65 } |
62 | 66 |
63 } // namespace | 67 } // namespace |
64 | 68 |
65 using chromeos::NetworkState; | |
66 using chromeos::NetworkStateHandler; | |
67 | |
68 namespace ash { | 69 namespace ash { |
69 namespace internal { | 70 namespace internal { |
70 | 71 |
71 namespace tray { | 72 namespace tray { |
72 | 73 |
73 class NetworkMessages { | 74 class NetworkMessages { |
74 public: | 75 public: |
75 struct Message { | 76 struct Message { |
76 Message() : delegate(NULL) {} | 77 Message() : delegate(NULL) {} |
77 Message(NetworkTrayDelegate* in_delegate, | 78 Message(NetworkTrayDelegate* in_delegate, |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 | 613 |
613 void TrayNetwork::LinkClicked(MessageType message_type, int link_id) { | 614 void TrayNetwork::LinkClicked(MessageType message_type, int link_id) { |
614 tray::NetworkMessages::MessageMap::const_iterator iter = | 615 tray::NetworkMessages::MessageMap::const_iterator iter = |
615 messages()->messages().find(message_type); | 616 messages()->messages().find(message_type); |
616 if (iter != messages()->messages().end() && iter->second.delegate) | 617 if (iter != messages()->messages().end() && iter->second.delegate) |
617 iter->second.delegate->NotificationLinkClicked(link_id); | 618 iter->second.delegate->NotificationLinkClicked(link_id); |
618 } | 619 } |
619 | 620 |
620 } // namespace internal | 621 } // namespace internal |
621 } // namespace ash | 622 } // namespace ash |
OLD | NEW |