Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc

Issue 24175004: Remove dependency on ui::ScaleFactor from ui/gfx (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename methods and vars to make image_scale more clear Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 NetworkInfoDictionary(const FavoriteState* network, 426 NetworkInfoDictionary(const FavoriteState* network,
427 ui::ScaleFactor icon_scale_factor); 427 ui::ScaleFactor icon_scale_factor);
428 428
429 // Builds the DictionaryValue representation from the previously set 429 // Builds the DictionaryValue representation from the previously set
430 // parameters. Ownership of the returned pointer is transferred to the caller. 430 // parameters. Ownership of the returned pointer is transferred to the caller.
431 base::DictionaryValue* BuildDictionary(); 431 base::DictionaryValue* BuildDictionary();
432 432
433 private: 433 private:
434 void SetIcon(const gfx::ImageSkia& icon, 434 void SetIcon(const gfx::ImageSkia& icon,
435 ui::ScaleFactor icon_scale_factor) { 435 ui::ScaleFactor icon_scale_factor) {
436 gfx::ImageSkiaRep image_rep = icon.GetRepresentation(icon_scale_factor); 436 gfx::ImageSkiaRep image_rep
437 = icon.GetRepresentation(ui::GetImageScale(icon_scale_factor));
437 icon_url_ = icon.isNull() ? "" : webui::GetBitmapDataUrl( 438 icon_url_ = icon.isNull() ? "" : webui::GetBitmapDataUrl(
438 image_rep.sk_bitmap()); 439 image_rep.sk_bitmap());
439 } 440 }
440 441
441 std::string service_path_; 442 std::string service_path_;
442 std::string icon_url_; 443 std::string icon_url_;
443 std::string name_; 444 std::string name_;
444 bool connecting_; 445 bool connecting_;
445 bool connected_; 446 bool connected_;
446 bool connectable_; 447 bool connectable_;
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 1275
1275 void InternetOptionsHandler::RefreshNetworksCallback( 1276 void InternetOptionsHandler::RefreshNetworksCallback(
1276 const base::ListValue* args) { 1277 const base::ListValue* args) {
1277 NetworkHandler::Get()->network_state_handler()->RequestScan(); 1278 NetworkHandler::Get()->network_state_handler()->RequestScan();
1278 } 1279 }
1279 1280
1280 std::string InternetOptionsHandler::GetIconDataUrl(int resource_id) const { 1281 std::string InternetOptionsHandler::GetIconDataUrl(int resource_id) const {
1281 gfx::ImageSkia* icon = 1282 gfx::ImageSkia* icon =
1282 ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id); 1283 ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id);
1283 gfx::ImageSkiaRep image_rep = icon->GetRepresentation( 1284 gfx::ImageSkiaRep image_rep = icon->GetRepresentation(
1284 web_ui()->GetDeviceScaleFactor()); 1285 ui::GetImageScale(web_ui()->GetDeviceScaleFactor()));
1285 return webui::GetBitmapDataUrl(image_rep.sk_bitmap()); 1286 return webui::GetBitmapDataUrl(image_rep.sk_bitmap());
1286 } 1287 }
1287 1288
1288 void InternetOptionsHandler::RefreshNetworkData() { 1289 void InternetOptionsHandler::RefreshNetworkData() {
1289 base::DictionaryValue dictionary; 1290 base::DictionaryValue dictionary;
1290 FillNetworkInfo(&dictionary); 1291 FillNetworkInfo(&dictionary);
1291 web_ui()->CallJavascriptFunction( 1292 web_ui()->CallJavascriptFunction(
1292 kRefreshNetworkDataFunction, dictionary); 1293 kRefreshNetworkDataFunction, dictionary);
1293 } 1294 }
1294 1295
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
2075 dictionary->SetBoolean( 2076 dictionary->SetBoolean(
2076 kTagWimaxAvailable, 2077 kTagWimaxAvailable,
2077 handler->IsTechnologyAvailable(NetworkTypePattern::Wimax())); 2078 handler->IsTechnologyAvailable(NetworkTypePattern::Wimax()));
2078 dictionary->SetBoolean( 2079 dictionary->SetBoolean(
2079 kTagWimaxEnabled, 2080 kTagWimaxEnabled,
2080 handler->IsTechnologyEnabled(NetworkTypePattern::Wimax())); 2081 handler->IsTechnologyEnabled(NetworkTypePattern::Wimax()));
2081 } 2082 }
2082 2083
2083 } // namespace options 2084 } // namespace options
2084 } // namespace chromeos 2085 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698