| 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/common/system/chromeos/network/tray_network.h" | 5 #include "ash/common/system/chromeos/network/tray_network.h" |
| 6 | 6 |
| 7 #include "ash/common/shelf/wm_shelf_util.h" | 7 #include "ash/common/shelf/wm_shelf_util.h" |
| 8 #include "ash/common/system/chromeos/network/network_icon.h" | 8 #include "ash/common/system/chromeos/network/network_icon.h" |
| 9 #include "ash/common/system/chromeos/network/network_icon_animation.h" | 9 #include "ash/common/system/chromeos/network/network_icon_animation.h" |
| 10 #include "ash/common/system/chromeos/network/network_icon_animation_observer.h" | 10 #include "ash/common/system/chromeos/network/network_icon_animation_observer.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 } | 122 } |
| 123 | 123 |
| 124 base::string16 connection_status_string_; | 124 base::string16 connection_status_string_; |
| 125 | 125 |
| 126 DISALLOW_COPY_AND_ASSIGN(NetworkTrayView); | 126 DISALLOW_COPY_AND_ASSIGN(NetworkTrayView); |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 class NetworkDefaultView : public TrayItemMore, | 129 class NetworkDefaultView : public TrayItemMore, |
| 130 public network_icon::AnimationObserver { | 130 public network_icon::AnimationObserver { |
| 131 public: | 131 public: |
| 132 NetworkDefaultView(TrayNetwork* network_tray, bool show_more) | 132 explicit NetworkDefaultView(TrayNetwork* network_tray) |
| 133 : TrayItemMore(network_tray, show_more) { | 133 : TrayItemMore(network_tray) { |
| 134 Update(); | 134 Update(); |
| 135 } | 135 } |
| 136 | 136 |
| 137 ~NetworkDefaultView() override { | 137 ~NetworkDefaultView() override { |
| 138 network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this); | 138 network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void Update() { | 141 void Update() { |
| 142 gfx::ImageSkia image; | 142 gfx::ImageSkia image; |
| 143 base::string16 label; | 143 base::string16 label; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 154 SetLabel(label); | 154 SetLabel(label); |
| 155 SetAccessibleName(label); | 155 SetAccessibleName(label); |
| 156 UpdateStyle(); | 156 UpdateStyle(); |
| 157 } | 157 } |
| 158 | 158 |
| 159 // network_icon::AnimationObserver | 159 // network_icon::AnimationObserver |
| 160 void NetworkIconChanged() override { Update(); } | 160 void NetworkIconChanged() override { Update(); } |
| 161 | 161 |
| 162 protected: | 162 protected: |
| 163 // TrayItemMore: | 163 // TrayItemMore: |
| 164 std::unique_ptr<TrayPopupItemStyle> CreateStyle() const override { | 164 std::unique_ptr<TrayPopupItemStyle> HandleCreateStyle() const override { |
| 165 std::unique_ptr<TrayPopupItemStyle> style = TrayItemMore::CreateStyle(); | 165 std::unique_ptr<TrayPopupItemStyle> style = |
| 166 TrayItemMore::HandleCreateStyle(); |
| 166 style->set_color_style(GetConnectedNetwork() != nullptr | 167 style->set_color_style(GetConnectedNetwork() != nullptr |
| 167 ? TrayPopupItemStyle::ColorStyle::ACTIVE | 168 ? TrayPopupItemStyle::ColorStyle::ACTIVE |
| 168 : TrayPopupItemStyle::ColorStyle::INACTIVE); | 169 : TrayPopupItemStyle::ColorStyle::INACTIVE); |
| 169 return style; | 170 return style; |
| 170 } | 171 } |
| 171 | 172 |
| 172 private: | 173 private: |
| 173 DISALLOW_COPY_AND_ASSIGN(NetworkDefaultView); | 174 DISALLOW_COPY_AND_ASSIGN(NetworkDefaultView); |
| 174 }; | 175 }; |
| 175 | 176 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 return NULL; | 262 return NULL; |
| 262 tray_ = new tray::NetworkTrayView(this); | 263 tray_ = new tray::NetworkTrayView(this); |
| 263 return tray_; | 264 return tray_; |
| 264 } | 265 } |
| 265 | 266 |
| 266 views::View* TrayNetwork::CreateDefaultView(LoginStatus status) { | 267 views::View* TrayNetwork::CreateDefaultView(LoginStatus status) { |
| 267 CHECK(default_ == NULL); | 268 CHECK(default_ == NULL); |
| 268 if (!chromeos::NetworkHandler::IsInitialized()) | 269 if (!chromeos::NetworkHandler::IsInitialized()) |
| 269 return NULL; | 270 return NULL; |
| 270 CHECK(tray_ != NULL); | 271 CHECK(tray_ != NULL); |
| 271 default_ = new tray::NetworkDefaultView(this, status != LoginStatus::LOCKED); | 272 default_ = new tray::NetworkDefaultView(this); |
| 273 default_->SetEnabled(status != LoginStatus::LOCKED); |
| 272 return default_; | 274 return default_; |
| 273 } | 275 } |
| 274 | 276 |
| 275 views::View* TrayNetwork::CreateDetailedView(LoginStatus status) { | 277 views::View* TrayNetwork::CreateDetailedView(LoginStatus status) { |
| 276 CHECK(detailed_ == NULL); | 278 CHECK(detailed_ == NULL); |
| 277 WmShell::Get()->RecordUserMetricsAction( | 279 WmShell::Get()->RecordUserMetricsAction( |
| 278 UMA_STATUS_AREA_DETAILED_NETWORK_VIEW); | 280 UMA_STATUS_AREA_DETAILED_NETWORK_VIEW); |
| 279 if (!chromeos::NetworkHandler::IsInitialized()) | 281 if (!chromeos::NetworkHandler::IsInitialized()) |
| 280 return NULL; | 282 return NULL; |
| 281 if (request_wifi_view_) { | 283 if (request_wifi_view_) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 void TrayNetwork::NetworkStateChanged() { | 332 void TrayNetwork::NetworkStateChanged() { |
| 331 if (tray_) | 333 if (tray_) |
| 332 tray_->UpdateNetworkStateHandlerIcon(); | 334 tray_->UpdateNetworkStateHandlerIcon(); |
| 333 if (default_) | 335 if (default_) |
| 334 default_->Update(); | 336 default_->Update(); |
| 335 if (detailed_) | 337 if (detailed_) |
| 336 detailed_->Update(); | 338 detailed_->Update(); |
| 337 } | 339 } |
| 338 | 340 |
| 339 } // namespace ash | 341 } // namespace ash |
| OLD | NEW |