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

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/network_dropdown.cc

Issue 10696130: Get rid of implicit conversion to and from ImageSkiaRep (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 0 Created 8 years, 5 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
« no previous file with comments | « chrome/browser/ui/views/toolbar_view.cc ('k') | ui/gfx/image/image_skia.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 int id; 79 int id;
80 if (type == ui::MenuModel::TYPE_SEPARATOR) 80 if (type == ui::MenuModel::TYPE_SEPARATOR)
81 id = -2; 81 id = -2;
82 else 82 else
83 id = model->GetCommandIdAt(i); 83 id = model->GetCommandIdAt(i);
84 base::DictionaryValue* item = new base::DictionaryValue(); 84 base::DictionaryValue* item = new base::DictionaryValue();
85 item->SetInteger("id", id); 85 item->SetInteger("id", id);
86 item->SetString("label", model->GetLabelAt(i)); 86 item->SetString("label", model->GetLabelAt(i));
87 gfx::ImageSkia icon; 87 gfx::ImageSkia icon;
88 if (model->GetIconAt(i, &icon)) { 88 if (model->GetIconAt(i, &icon)) {
89 gfx::ImageSkiaRep icon_bitmap = icon.GetRepresentation( 89 SkBitmap icon_bitmap = icon.GetRepresentation(
oshima 2012/07/09 18:22:22 shouldn't this be ImageSkiaRep?
pkotwicz 2012/07/09 19:36:36 Nope, we get the bitmap. Take a look at the end of
oshima 2012/07/09 19:40:58 in image_skia.h // Returns the image rep whose
90 ui::GetScaleFactorFromScale(web_ui_->GetDeviceScale())).sk_bitmap(); 90 ui::GetScaleFactorFromScale(web_ui_->GetDeviceScale())).sk_bitmap();
91 item->SetString("icon", web_ui_util::GetImageDataUrl(icon_bitmap)); 91 item->SetString("icon", web_ui_util::GetImageDataUrl(icon_bitmap));
92 } 92 }
93 if (id >= 0) { 93 if (id >= 0) {
94 item->SetBoolean("enabled", model->IsEnabledAt(i)); 94 item->SetBoolean("enabled", model->IsEnabledAt(i));
95 const gfx::Font* font = model->GetLabelFontAt(i); 95 const gfx::Font* font = model->GetLabelFontAt(i);
96 if (font) { 96 if (font) {
97 item->SetBoolean("bold", font->GetStyle() == gfx::Font::BOLD); 97 item->SetBoolean("bold", font->GetStyle() == gfx::Font::BOLD);
98 } 98 }
99 } 99 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 network_menu_->UpdateMenu(); 154 network_menu_->UpdateMenu();
155 } 155 }
156 156
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 gfx::ImageSkiaRep icon_bitmap = icon_image.GetRepresentation( 164 SkBitmap icon_bitmap = icon_image.GetRepresentation(
oshima 2012/07/09 18:22:22 same here.
pkotwicz 2012/07/09 19:36:36 Same thing
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.empty() ?
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
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar_view.cc ('k') | ui/gfx/image/image_skia.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698