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

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

Issue 1200393002: Add more string_util functions to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string
Patch Set: Android Created 5 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
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator_impl.cc ('k') | chrome/common/crash_keys.cc » ('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/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 for (int i = 0; i < model->GetItemCount(); ++i) { 82 for (int i = 0; i < model->GetItemCount(); ++i) {
83 ui::MenuModel::ItemType type = model->GetTypeAt(i); 83 ui::MenuModel::ItemType type = model->GetTypeAt(i);
84 int id; 84 int id;
85 if (type == ui::MenuModel::TYPE_SEPARATOR) 85 if (type == ui::MenuModel::TYPE_SEPARATOR)
86 id = -2; 86 id = -2;
87 else 87 else
88 id = model->GetCommandIdAt(i); 88 id = model->GetCommandIdAt(i);
89 base::DictionaryValue* item = new base::DictionaryValue(); 89 base::DictionaryValue* item = new base::DictionaryValue();
90 item->SetInteger("id", id); 90 item->SetInteger("id", id);
91 base::string16 label = model->GetLabelAt(i); 91 base::string16 label = model->GetLabelAt(i);
92 ReplaceSubstringsAfterOffset(&label, 0, base::ASCIIToUTF16("&&"), 92 base::ReplaceSubstringsAfterOffset(&label, 0, base::ASCIIToUTF16("&&"),
93 base::ASCIIToUTF16("&")); 93 base::ASCIIToUTF16("&"));
94 item->SetString("label", label); 94 item->SetString("label", label);
95 gfx::Image icon; 95 gfx::Image icon;
96 if (model->GetIconAt(i, &icon)) { 96 if (model->GetIconAt(i, &icon)) {
97 SkBitmap icon_bitmap = icon.ToImageSkia()->GetRepresentation( 97 SkBitmap icon_bitmap = icon.ToImageSkia()->GetRepresentation(
98 web_ui_->GetDeviceScaleFactor()).sk_bitmap(); 98 web_ui_->GetDeviceScaleFactor()).sk_bitmap();
99 item->SetString("icon", webui::GetBitmapDataUrl(icon_bitmap)); 99 item->SetString("icon", webui::GetBitmapDataUrl(icon_bitmap));
100 } 100 }
101 if (id >= 0) { 101 if (id >= 0) {
102 item->SetBoolean("enabled", model->IsEnabledAt(i)); 102 item->SetBoolean("enabled", model->IsEnabledAt(i));
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 web_ui_->CallJavascriptFunction("cr.ui.DropDown.updateNetworkTitle", 203 web_ui_->CallJavascriptFunction("cr.ui.DropDown.updateNetworkTitle",
204 title, icon); 204 title, icon);
205 } 205 }
206 206
207 void NetworkDropdown::RequestNetworkScan() { 207 void NetworkDropdown::RequestNetworkScan() {
208 NetworkHandler::Get()->network_state_handler()->RequestScan(); 208 NetworkHandler::Get()->network_state_handler()->RequestScan();
209 Refresh(); 209 Refresh();
210 } 210 }
211 211
212 } // namespace chromeos 212 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator_impl.cc ('k') | chrome/common/crash_keys.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698