| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "athena/system/status_icon_container_view.h" | 5 #include "athena/system/status_icon_container_view.h" |
| 6 | 6 |
| 7 #include "athena/resources/athena_resources.h" | 7 #include "athena/resources/athena_resources.h" |
| 8 #include "athena/system/network_selector.h" | 8 #include "athena/system/network_selector.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 views::ImageView* icon) | 52 views::ImageView* icon) |
| 53 : color_scheme_(color_scheme), | 53 : color_scheme_(color_scheme), |
| 54 icon_(icon) { | 54 icon_(icon) { |
| 55 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver( | 55 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver( |
| 56 this); | 56 this); |
| 57 chromeos::DBusThreadManager::Get() | 57 chromeos::DBusThreadManager::Get() |
| 58 ->GetPowerManagerClient() | 58 ->GetPowerManagerClient() |
| 59 ->RequestStatusUpdate(); | 59 ->RequestStatusUpdate(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 virtual ~PowerStatus() { | 62 ~PowerStatus() override { |
| 63 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver( | 63 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver( |
| 64 this); | 64 this); |
| 65 } | 65 } |
| 66 | 66 |
| 67 private: | 67 private: |
| 68 const gfx::ImageSkia GetPowerIcon( | 68 const gfx::ImageSkia GetPowerIcon( |
| 69 const power_manager::PowerSupplyProperties& proto) const { | 69 const power_manager::PowerSupplyProperties& proto) const { |
| 70 // Width and height of battery images. | 70 // Width and height of battery images. |
| 71 const int kBatteryImageHeight = 25; | 71 const int kBatteryImageHeight = 25; |
| 72 const int kBatteryImageWidth = 25; | 72 const int kBatteryImageWidth = 25; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 113 |
| 114 class StatusIconContainerView::NetworkStatus | 114 class StatusIconContainerView::NetworkStatus |
| 115 : public chromeos::NetworkStateHandlerObserver { | 115 : public chromeos::NetworkStateHandlerObserver { |
| 116 public: | 116 public: |
| 117 explicit NetworkStatus(views::Label* label) : label_(label) { | 117 explicit NetworkStatus(views::Label* label) : label_(label) { |
| 118 chromeos::NetworkStateHandler* handler = | 118 chromeos::NetworkStateHandler* handler = |
| 119 chromeos::NetworkHandler::Get()->network_state_handler(); | 119 chromeos::NetworkHandler::Get()->network_state_handler(); |
| 120 handler->AddObserver(this, FROM_HERE); | 120 handler->AddObserver(this, FROM_HERE); |
| 121 } | 121 } |
| 122 | 122 |
| 123 virtual ~NetworkStatus() { | 123 ~NetworkStatus() override { |
| 124 chromeos::NetworkStateHandler* handler = | 124 chromeos::NetworkStateHandler* handler = |
| 125 chromeos::NetworkHandler::Get()->network_state_handler(); | 125 chromeos::NetworkHandler::Get()->network_state_handler(); |
| 126 handler->RemoveObserver(this, FROM_HERE); | 126 handler->RemoveObserver(this, FROM_HERE); |
| 127 } | 127 } |
| 128 | 128 |
| 129 private: | 129 private: |
| 130 void Update() { | 130 void Update() { |
| 131 std::string status = "<unknown>"; | 131 std::string status = "<unknown>"; |
| 132 chromeos::NetworkStateHandler* handler = | 132 chromeos::NetworkStateHandler* handler = |
| 133 chromeos::NetworkHandler::Get()->network_state_handler(); | 133 chromeos::NetworkHandler::Get()->network_state_handler(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 public: | 174 public: |
| 175 UpdateStatus(SystemUI::ColorScheme color_scheme, views::ImageView* icon) | 175 UpdateStatus(SystemUI::ColorScheme color_scheme, views::ImageView* icon) |
| 176 : color_scheme_(color_scheme), | 176 : color_scheme_(color_scheme), |
| 177 icon_(icon) { | 177 icon_(icon) { |
| 178 chromeos::DBusThreadManager::Get()->GetUpdateEngineClient()->AddObserver( | 178 chromeos::DBusThreadManager::Get()->GetUpdateEngineClient()->AddObserver( |
| 179 this); | 179 this); |
| 180 chromeos::DBusThreadManager::Get()->GetUpdateEngineClient()-> | 180 chromeos::DBusThreadManager::Get()->GetUpdateEngineClient()-> |
| 181 RequestUpdateCheck(base::Bind(StartUpdateCallback)); | 181 RequestUpdateCheck(base::Bind(StartUpdateCallback)); |
| 182 } | 182 } |
| 183 | 183 |
| 184 virtual ~UpdateStatus() { | 184 ~UpdateStatus() override { |
| 185 chromeos::DBusThreadManager::Get()->GetUpdateEngineClient()->RemoveObserver( | 185 chromeos::DBusThreadManager::Get()->GetUpdateEngineClient()->RemoveObserver( |
| 186 this); | 186 this); |
| 187 } | 187 } |
| 188 | 188 |
| 189 // chromeos::UpdateEngineClient::Observer: | 189 // chromeos::UpdateEngineClient::Observer: |
| 190 virtual void UpdateStatusChanged( | 190 virtual void UpdateStatusChanged( |
| 191 const chromeos::UpdateEngineClient::Status& status) override { | 191 const chromeos::UpdateEngineClient::Status& status) override { |
| 192 if (status.status != | 192 if (status.status != |
| 193 chromeos::UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT) { | 193 chromeos::UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT) { |
| 194 return; | 194 return; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 CreateNetworkSelector(); | 249 CreateNetworkSelector(); |
| 250 event->SetHandled(); | 250 event->SetHandled(); |
| 251 } | 251 } |
| 252 } | 252 } |
| 253 | 253 |
| 254 void StatusIconContainerView::ChildPreferredSizeChanged(views::View* child) { | 254 void StatusIconContainerView::ChildPreferredSizeChanged(views::View* child) { |
| 255 PreferredSizeChanged(); | 255 PreferredSizeChanged(); |
| 256 } | 256 } |
| 257 | 257 |
| 258 } // namespace athena | 258 } // namespace athena |
| OLD | NEW |