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

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

Issue 1107343002: Unescape ampersands in network names on network selection screen (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment resolved Created 5 years, 7 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 | « no previous file | no next file » | 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"
10 #include "base/strings/utf_string_conversions.h"
9 #include "base/time/time.h" 11 #include "base/time/time.h"
10 #include "base/values.h" 12 #include "base/values.h"
11 #include "chrome/browser/chromeos/login/ui/login_display_host.h" 13 #include "chrome/browser/chromeos/login/ui/login_display_host.h"
12 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" 14 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h"
13 #include "chromeos/network/network_state_handler.h" 15 #include "chromeos/network/network_state_handler.h"
14 #include "content/public/browser/web_ui.h" 16 #include "content/public/browser/web_ui.h"
15 #include "ui/base/models/menu_model.h" 17 #include "ui/base/models/menu_model.h"
16 #include "ui/base/webui/web_ui_util.h" 18 #include "ui/base/webui/web_ui_util.h"
17 #include "ui/chromeos/network/network_icon.h" 19 #include "ui/chromeos/network/network_icon.h"
18 #include "ui/chromeos/network/network_icon_animation.h" 20 #include "ui/chromeos/network/network_icon_animation.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 base::ListValue* list = new base::ListValue(); 81 base::ListValue* list = new base::ListValue();
80 for (int i = 0; i < model->GetItemCount(); ++i) { 82 for (int i = 0; i < model->GetItemCount(); ++i) {
81 ui::MenuModel::ItemType type = model->GetTypeAt(i); 83 ui::MenuModel::ItemType type = model->GetTypeAt(i);
82 int id; 84 int id;
83 if (type == ui::MenuModel::TYPE_SEPARATOR) 85 if (type == ui::MenuModel::TYPE_SEPARATOR)
84 id = -2; 86 id = -2;
85 else 87 else
86 id = model->GetCommandIdAt(i); 88 id = model->GetCommandIdAt(i);
87 base::DictionaryValue* item = new base::DictionaryValue(); 89 base::DictionaryValue* item = new base::DictionaryValue();
88 item->SetInteger("id", id); 90 item->SetInteger("id", id);
89 item->SetString("label", model->GetLabelAt(i)); 91 base::string16 label = model->GetLabelAt(i);
92 ReplaceSubstringsAfterOffset(&label, 0, base::ASCIIToUTF16("&&"),
93 base::ASCIIToUTF16("&"));
94 item->SetString("label", label);
90 gfx::Image icon; 95 gfx::Image icon;
91 if (model->GetIconAt(i, &icon)) { 96 if (model->GetIconAt(i, &icon)) {
92 SkBitmap icon_bitmap = icon.ToImageSkia()->GetRepresentation( 97 SkBitmap icon_bitmap = icon.ToImageSkia()->GetRepresentation(
93 web_ui_->GetDeviceScaleFactor()).sk_bitmap(); 98 web_ui_->GetDeviceScaleFactor()).sk_bitmap();
94 item->SetString("icon", webui::GetBitmapDataUrl(icon_bitmap)); 99 item->SetString("icon", webui::GetBitmapDataUrl(icon_bitmap));
95 } 100 }
96 if (id >= 0) { 101 if (id >= 0) {
97 item->SetBoolean("enabled", model->IsEnabledAt(i)); 102 item->SetBoolean("enabled", model->IsEnabledAt(i));
98 const gfx::FontList* font_list = model->GetLabelFontListAt(i); 103 const gfx::FontList* font_list = model->GetLabelFontListAt(i);
99 if (font_list) 104 if (font_list)
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 web_ui_->CallJavascriptFunction("cr.ui.DropDown.updateNetworkTitle", 203 web_ui_->CallJavascriptFunction("cr.ui.DropDown.updateNetworkTitle",
199 title, icon); 204 title, icon);
200 } 205 }
201 206
202 void NetworkDropdown::RequestNetworkScan() { 207 void NetworkDropdown::RequestNetworkScan() {
203 NetworkHandler::Get()->network_state_handler()->RequestScan(); 208 NetworkHandler::Get()->network_state_handler()->RequestScan();
204 Refresh(); 209 Refresh();
205 } 210 }
206 211
207 } // namespace chromeos 212 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698