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/network_state_list_detailed_view.h" | 5 #include "ash/system/chromeos/network/network_state_list_detailed_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/common/ash_constants.h" | 10 #include "ash/common/ash_constants.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 154 |
155 const int kFadeIconMs = 500; | 155 const int kFadeIconMs = 500; |
156 | 156 |
157 // A throbber view that fades in/out when shown/hidden. | 157 // A throbber view that fades in/out when shown/hidden. |
158 class ScanningThrobber : public ThrobberView { | 158 class ScanningThrobber : public ThrobberView { |
159 public: | 159 public: |
160 ScanningThrobber() { | 160 ScanningThrobber() { |
161 SetPaintToLayer(true); | 161 SetPaintToLayer(true); |
162 layer()->SetFillsBoundsOpaquely(false); | 162 layer()->SetFillsBoundsOpaquely(false); |
163 layer()->SetOpacity(1.0); | 163 layer()->SetOpacity(1.0); |
164 accessible_name_ = l10n_util::GetStringUTF16( | 164 accessible_name_ = |
165 IDS_ASH_STATUS_TRAY_WIFI_SCANNING_MESSAGE); | 165 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_WIFI_SCANNING_MESSAGE); |
166 } | 166 } |
167 ~ScanningThrobber() override {} | 167 ~ScanningThrobber() override {} |
168 | 168 |
169 // views::View | 169 // views::View |
170 void SetVisible(bool visible) override { | 170 void SetVisible(bool visible) override { |
171 layer()->GetAnimator()->StopAnimating(); // Stop any previous animation. | 171 layer()->GetAnimator()->StopAnimating(); // Stop any previous animation. |
172 ui::ScopedLayerAnimationSettings animation(layer()->GetAnimator()); | 172 ui::ScopedLayerAnimationSettings animation(layer()->GetAnimator()); |
173 animation.SetTransitionDuration( | 173 animation.SetTransitionDuration( |
174 base::TimeDelta::FromMilliseconds(kFadeIconMs)); | 174 base::TimeDelta::FromMilliseconds(kFadeIconMs)); |
175 layer()->SetOpacity(visible ? 1.0 : 0.0); | 175 layer()->SetOpacity(visible ? 1.0 : 0.0); |
(...skipping 12 matching lines...) Expand all Loading... |
188 | 188 |
189 //------------------------------------------------------------------------------ | 189 //------------------------------------------------------------------------------ |
190 | 190 |
191 // An image button showing the info icon similar to TrayPopupHeaderButton, | 191 // An image button showing the info icon similar to TrayPopupHeaderButton, |
192 // but without the toggle properties, that fades in/out when shown/hidden. | 192 // but without the toggle properties, that fades in/out when shown/hidden. |
193 class InfoIcon : public views::ImageButton { | 193 class InfoIcon : public views::ImageButton { |
194 public: | 194 public: |
195 explicit InfoIcon(views::ButtonListener* listener) | 195 explicit InfoIcon(views::ButtonListener* listener) |
196 : views::ImageButton(listener) { | 196 : views::ImageButton(listener) { |
197 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 197 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
198 SetImage(STATE_NORMAL, bundle.GetImageNamed(IDR_AURA_UBER_TRAY_NETWORK_INFO) | 198 SetImage( |
199 .ToImageSkia()); | 199 STATE_NORMAL, |
| 200 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_NETWORK_INFO).ToImageSkia()); |
200 SetImage(STATE_HOVERED, | 201 SetImage(STATE_HOVERED, |
201 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_NETWORK_INFO_HOVER) | 202 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_NETWORK_INFO_HOVER) |
202 .ToImageSkia()); | 203 .ToImageSkia()); |
203 SetImageAlignment(ALIGN_CENTER, ALIGN_MIDDLE); | 204 SetImageAlignment(ALIGN_CENTER, ALIGN_MIDDLE); |
204 SetAccessibleName( | 205 SetAccessibleName( |
205 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_NETWORK_INFO)); | 206 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_NETWORK_INFO)); |
206 SetPaintToLayer(true); | 207 SetPaintToLayer(true); |
207 layer()->SetFillsBoundsOpaquely(false); | 208 layer()->SetFillsBoundsOpaquely(false); |
208 layer()->SetOpacity(1.0); | 209 layer()->SetOpacity(1.0); |
209 } | 210 } |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 bool enabled = handler->IsTechnologyEnabled(NetworkTypePattern::WiFi()); | 379 bool enabled = handler->IsTechnologyEnabled(NetworkTypePattern::WiFi()); |
379 handler->SetTechnologyEnabled(NetworkTypePattern::WiFi(), !enabled, | 380 handler->SetTechnologyEnabled(NetworkTypePattern::WiFi(), !enabled, |
380 chromeos::network_handler::ErrorCallback()); | 381 chromeos::network_handler::ErrorCallback()); |
381 } else if (sender == turn_on_wifi_) { | 382 } else if (sender == turn_on_wifi_) { |
382 handler->SetTechnologyEnabled(NetworkTypePattern::WiFi(), true, | 383 handler->SetTechnologyEnabled(NetworkTypePattern::WiFi(), true, |
383 chromeos::network_handler::ErrorCallback()); | 384 chromeos::network_handler::ErrorCallback()); |
384 } else if (sender == button_mobile_) { | 385 } else if (sender == button_mobile_) { |
385 ToggleMobile(); | 386 ToggleMobile(); |
386 } else if (sender == settings_) { | 387 } else if (sender == settings_) { |
387 WmShell::Get()->RecordUserMetricsAction( | 388 WmShell::Get()->RecordUserMetricsAction( |
388 list_type_ == LIST_TYPE_VPN | 389 list_type_ == LIST_TYPE_VPN ? UMA_STATUS_AREA_VPN_SETTINGS_CLICKED |
389 ? UMA_STATUS_AREA_VPN_SETTINGS_CLICKED | 390 : UMA_STATUS_AREA_NETWORK_SETTINGS_CLICKED); |
390 : UMA_STATUS_AREA_NETWORK_SETTINGS_CLICKED); | |
391 delegate->ShowNetworkSettingsForGuid(""); | 391 delegate->ShowNetworkSettingsForGuid(""); |
392 } else if (sender == proxy_settings_) { | 392 } else if (sender == proxy_settings_) { |
393 delegate->ChangeProxySettings(); | 393 delegate->ChangeProxySettings(); |
394 } else if (sender == other_mobile_) { | 394 } else if (sender == other_mobile_) { |
395 delegate->ShowOtherNetworkDialog(shill::kTypeCellular); | 395 delegate->ShowOtherNetworkDialog(shill::kTypeCellular); |
396 } else if (sender == other_wifi_) { | 396 } else if (sender == other_wifi_) { |
397 WmShell::Get()->RecordUserMetricsAction( | 397 WmShell::Get()->RecordUserMetricsAction( |
398 UMA_STATUS_AREA_NETWORK_JOIN_OTHER_CLICKED); | 398 UMA_STATUS_AREA_NETWORK_JOIN_OTHER_CLICKED); |
399 delegate->ShowOtherNetworkDialog(shill::kTypeWifi); | 399 delegate->ShowOtherNetworkDialog(shill::kTypeWifi); |
400 } else { | 400 } else { |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 wifi_scanning_ = scanning; | 573 wifi_scanning_ = scanning; |
574 if (list_type_ != LIST_TYPE_VPN) { | 574 if (list_type_ != LIST_TYPE_VPN) { |
575 SetScanningStateForThrobberView(true); | 575 SetScanningStateForThrobberView(true); |
576 | 576 |
577 // Start animation on the |scanning_throbber_| indicator. | 577 // Start animation on the |scanning_throbber_| indicator. |
578 scanning_throbber_->Start(); | 578 scanning_throbber_->Start(); |
579 | 579 |
580 // Since the |scanning_throbber_| view is behind the |info_icon_| | 580 // Since the |scanning_throbber_| view is behind the |info_icon_| |
581 // view, the tooltip text for |info_icon_| will be used for both. | 581 // view, the tooltip text for |info_icon_| will be used for both. |
582 info_icon_->SetTooltipText(l10n_util::GetStringUTF16( | 582 info_icon_->SetTooltipText(l10n_util::GetStringUTF16( |
583 IDS_ASH_STATUS_TRAY_WIFI_SCANNING_MESSAGE)); | 583 IDS_ASH_STATUS_TRAY_WIFI_SCANNING_MESSAGE)); |
584 } else { | 584 } else { |
585 SetScanningStateForThrobberView(false); | 585 SetScanningStateForThrobberView(false); |
586 | 586 |
587 // Stop animation on the |scanning_throbber_| indicator. | 587 // Stop animation on the |scanning_throbber_| indicator. |
588 scanning_throbber_->Stop(); | 588 scanning_throbber_->Stop(); |
589 info_icon_->SetTooltipText( | 589 info_icon_->SetTooltipText( |
590 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_NETWORK_INFO)); | 590 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_NETWORK_INFO)); |
591 } | 591 } |
592 } | 592 } |
593 } | 593 } |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 label->SetEnabledColor(SkColorSetARGB(192, 0, 0, 0)); | 915 label->SetEnabledColor(SkColorSetARGB(192, 0, 0, 0)); |
916 return label; | 916 return label; |
917 } | 917 } |
918 | 918 |
919 void NetworkStateListDetailedView::RelayoutScrollList() { | 919 void NetworkStateListDetailedView::RelayoutScrollList() { |
920 scroller()->Layout(); | 920 scroller()->Layout(); |
921 } | 921 } |
922 | 922 |
923 } // namespace tray | 923 } // namespace tray |
924 } // namespace ash | 924 } // namespace ash |
OLD | NEW |