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/options/chromeos/internet_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/chromeos/internet_options_handler.h" |
6 | 6 |
7 #include <ctype.h> | 7 #include <ctype.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 } else { | 409 } else { |
410 id = IDS_CHROMEOS_NETWORK_ERROR_UNKNOWN; | 410 id = IDS_CHROMEOS_NETWORK_ERROR_UNKNOWN; |
411 } | 411 } |
412 return l10n_util::GetStringUTF8(id); | 412 return l10n_util::GetStringUTF8(id); |
413 } | 413 } |
414 | 414 |
415 void SetCommonNetworkInfo(const ManagedState* state, | 415 void SetCommonNetworkInfo(const ManagedState* state, |
416 const gfx::ImageSkia& icon, | 416 const gfx::ImageSkia& icon, |
417 ui::ScaleFactor icon_scale_factor, | 417 ui::ScaleFactor icon_scale_factor, |
418 base::DictionaryValue* network_info) { | 418 base::DictionaryValue* network_info) { |
419 gfx::ImageSkiaRep image_rep = icon.GetRepresentation(icon_scale_factor); | 419 gfx::ImageSkiaRep image_rep = |
| 420 icon.GetRepresentation(ui::GetImageScale(icon_scale_factor)); |
420 std::string icon_url = | 421 std::string icon_url = |
421 icon.isNull() ? "" : webui::GetBitmapDataUrl(image_rep.sk_bitmap()); | 422 icon.isNull() ? "" : webui::GetBitmapDataUrl(image_rep.sk_bitmap()); |
422 network_info->SetString(kNetworkInfoKeyIconURL, icon_url); | 423 network_info->SetString(kNetworkInfoKeyIconURL, icon_url); |
423 | 424 |
424 std::string name = state->name(); | 425 std::string name = state->name(); |
425 if (state->Matches(NetworkTypePattern::Ethernet())) | 426 if (state->Matches(NetworkTypePattern::Ethernet())) |
426 name = l10n_util::GetStringUTF8(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET); | 427 name = l10n_util::GetStringUTF8(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET); |
427 network_info->SetString(kNetworkInfoKeyNetworkName, name); | 428 network_info->SetString(kNetworkInfoKeyNetworkName, name); |
428 network_info->SetString(kNetworkInfoKeyNetworkType, state->type()); | 429 network_info->SetString(kNetworkInfoKeyNetworkType, state->type()); |
429 network_info->SetString(kNetworkInfoKeyServicePath, state->path()); | 430 network_info->SetString(kNetworkInfoKeyServicePath, state->path()); |
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1210 | 1211 |
1211 void InternetOptionsHandler::RefreshNetworksCallback( | 1212 void InternetOptionsHandler::RefreshNetworksCallback( |
1212 const base::ListValue* args) { | 1213 const base::ListValue* args) { |
1213 NetworkHandler::Get()->network_state_handler()->RequestScan(); | 1214 NetworkHandler::Get()->network_state_handler()->RequestScan(); |
1214 } | 1215 } |
1215 | 1216 |
1216 std::string InternetOptionsHandler::GetIconDataUrl(int resource_id) const { | 1217 std::string InternetOptionsHandler::GetIconDataUrl(int resource_id) const { |
1217 gfx::ImageSkia* icon = | 1218 gfx::ImageSkia* icon = |
1218 ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id); | 1219 ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id); |
1219 gfx::ImageSkiaRep image_rep = icon->GetRepresentation( | 1220 gfx::ImageSkiaRep image_rep = icon->GetRepresentation( |
1220 web_ui()->GetDeviceScaleFactor()); | 1221 ui::GetImageScale(web_ui()->GetDeviceScaleFactor())); |
1221 return webui::GetBitmapDataUrl(image_rep.sk_bitmap()); | 1222 return webui::GetBitmapDataUrl(image_rep.sk_bitmap()); |
1222 } | 1223 } |
1223 | 1224 |
1224 void InternetOptionsHandler::RefreshNetworkData() { | 1225 void InternetOptionsHandler::RefreshNetworkData() { |
1225 base::DictionaryValue dictionary; | 1226 base::DictionaryValue dictionary; |
1226 FillNetworkInfo(&dictionary); | 1227 FillNetworkInfo(&dictionary); |
1227 web_ui()->CallJavascriptFunction( | 1228 web_ui()->CallJavascriptFunction( |
1228 kRefreshNetworkDataFunction, dictionary); | 1229 kRefreshNetworkDataFunction, dictionary); |
1229 } | 1230 } |
1230 | 1231 |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2010 dictionary->SetBoolean( | 2011 dictionary->SetBoolean( |
2011 kTagWimaxAvailable, | 2012 kTagWimaxAvailable, |
2012 handler->IsTechnologyAvailable(NetworkTypePattern::Wimax())); | 2013 handler->IsTechnologyAvailable(NetworkTypePattern::Wimax())); |
2013 dictionary->SetBoolean( | 2014 dictionary->SetBoolean( |
2014 kTagWimaxEnabled, | 2015 kTagWimaxEnabled, |
2015 handler->IsTechnologyEnabled(NetworkTypePattern::Wimax())); | 2016 handler->IsTechnologyEnabled(NetworkTypePattern::Wimax())); |
2016 } | 2017 } |
2017 | 2018 |
2018 } // namespace options | 2019 } // namespace options |
2019 } // namespace chromeos | 2020 } // namespace chromeos |
OLD | NEW |