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

Unified 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: Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/chromeos/login/network_dropdown.cc
diff --git a/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc b/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc
index 274e7d0afbea9cd2ad71cc91cfa814f98f4575ff..d48647f69f5ef4b921d77efd6d74e39426f99143 100644
--- a/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc
+++ b/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc
@@ -6,6 +6,7 @@
#include <string>
+#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "base/values.h"
#include "chrome/browser/chromeos/login/ui/login_display_host.h"
@@ -26,6 +27,16 @@ namespace {
// scan.
const int kNetworkScanIntervalSecs = 60;
+base::string16 UnescapeAmpersands(const base::string16& input) {
+ base::string16 str = input;
+ size_t found = str.find(base::ASCIIToUTF16("&&"));
+ while (found != base::string16::npos) {
+ str.replace(found, 2, base::ASCIIToUTF16("&"));
+ found = str.find(base::ASCIIToUTF16("&&"), found + 1);
+ }
+ return str;
+}
+
} // namespace
namespace chromeos {
@@ -86,7 +97,7 @@ base::ListValue* NetworkMenuWebUI::ConvertMenuModel(ui::MenuModel* model) {
id = model->GetCommandIdAt(i);
base::DictionaryValue* item = new base::DictionaryValue();
item->SetInteger("id", id);
- item->SetString("label", model->GetLabelAt(i));
+ item->SetString("label", UnescapeAmpersands(model->GetLabelAt(i)));
Nikita (slow) 2015/04/28 11:58:51 Are these escaped while being part of MenuModel?
Nikita (slow) 2015/04/28 11:58:51 ReplaceSubstringsAfterOffset(&string, 0, "&&", "&"
Dmitry Polukhin 2015/04/28 13:23:09 Done. Yes this escaping is required for real MenuM
gfx::Image icon;
if (model->GetIconAt(i, &icon)) {
SkBitmap icon_bitmap = icon.ToImageSkia()->GetRepresentation(
« 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