| 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 "chrome/browser/ui/webui/chromeos/login/network_dropdown.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/network_dropdown.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 void NetworkDropdown::NetworkMenuIconChanged() { | 157 void NetworkDropdown::NetworkMenuIconChanged() { |
| 158 SetNetworkIconAndText(); | 158 SetNetworkIconAndText(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void NetworkDropdown::SetNetworkIconAndText() { | 161 void NetworkDropdown::SetNetworkIconAndText() { |
| 162 string16 text; | 162 string16 text; |
| 163 const gfx::ImageSkia icon_image = network_icon_->GetIconAndText(&text); | 163 const gfx::ImageSkia icon_image = network_icon_->GetIconAndText(&text); |
| 164 SkBitmap icon_bitmap = icon_image.GetRepresentation( | 164 SkBitmap icon_bitmap = icon_image.GetRepresentation( |
| 165 ui::GetScaleFactorFromScale(web_ui_->GetDeviceScale())).sk_bitmap(); | 165 ui::GetScaleFactorFromScale(web_ui_->GetDeviceScale())).sk_bitmap(); |
| 166 std::string icon_str = | 166 std::string icon_str = |
| 167 icon_image.empty() ? | 167 icon_image.isNull() ? |
| 168 std::string() : web_ui_util::GetImageDataUrl(icon_bitmap); | 168 std::string() : web_ui_util::GetImageDataUrl(icon_bitmap); |
| 169 base::StringValue title(text); | 169 base::StringValue title(text); |
| 170 base::StringValue icon(icon_str); | 170 base::StringValue icon(icon_str); |
| 171 web_ui_->CallJavascriptFunction("cr.ui.DropDown.updateNetworkTitle", | 171 web_ui_->CallJavascriptFunction("cr.ui.DropDown.updateNetworkTitle", |
| 172 title, icon); | 172 title, icon); |
| 173 } | 173 } |
| 174 | 174 |
| 175 void NetworkDropdown::ForceNetworkScan() { | 175 void NetworkDropdown::ForceNetworkScan() { |
| 176 CrosLibrary::Get()->GetNetworkLibrary()->RequestNetworkScan(); | 176 CrosLibrary::Get()->GetNetworkLibrary()->RequestNetworkScan(); |
| 177 Refresh(); | 177 Refresh(); |
| 178 } | 178 } |
| 179 | 179 |
| 180 } // namespace chromeos | 180 } // namespace chromeos |
| OLD | NEW |