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

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

Issue 1995113002: Rename WebUI::CallJavascriptFunction to WebUI::CallJavascriptFunctionUnsafe (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
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/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 NetworkMenuWebUI::NetworkMenuWebUI(NetworkMenu::Delegate* delegate, 58 NetworkMenuWebUI::NetworkMenuWebUI(NetworkMenu::Delegate* delegate,
59 content::WebUI* web_ui) 59 content::WebUI* web_ui)
60 : NetworkMenu(delegate), 60 : NetworkMenu(delegate),
61 web_ui_(web_ui) { 61 web_ui_(web_ui) {
62 } 62 }
63 63
64 void NetworkMenuWebUI::UpdateMenu() { 64 void NetworkMenuWebUI::UpdateMenu() {
65 NetworkMenu::UpdateMenu(); 65 NetworkMenu::UpdateMenu();
66 if (web_ui_) { 66 if (web_ui_) {
67 std::unique_ptr<base::ListValue> list(ConvertMenuModel(GetMenuModel())); 67 std::unique_ptr<base::ListValue> list(ConvertMenuModel(GetMenuModel()));
68 web_ui_->CallJavascriptFunction("cr.ui.DropDown.updateNetworks", *list); 68 web_ui_->CallJavascriptFunctionUnsafe("cr.ui.DropDown.updateNetworks",
69 *list);
69 } 70 }
70 } 71 }
71 72
72 void NetworkMenuWebUI::OnItemChosen(int id) { 73 void NetworkMenuWebUI::OnItemChosen(int id) {
73 int index; 74 int index;
74 ui::MenuModel* model = GetMenuModel(); 75 ui::MenuModel* model = GetMenuModel();
75 if (!ui::MenuModel::GetModelAndIndexForCommandId(id, &model, &index)) 76 if (!ui::MenuModel::GetModelAndIndexForCommandId(id, &model, &index))
76 return; 77 return;
77 model->ActivatedAt(index); 78 model->ActivatedAt(index);
78 } 79 }
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 } else { 195 } else {
195 ui::network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this); 196 ui::network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this);
196 } 197 }
197 SkBitmap icon_bitmap = icon_image.GetRepresentation( 198 SkBitmap icon_bitmap = icon_image.GetRepresentation(
198 web_ui_->GetDeviceScaleFactor()).sk_bitmap(); 199 web_ui_->GetDeviceScaleFactor()).sk_bitmap();
199 std::string icon_str; 200 std::string icon_str;
200 if (!icon_image.isNull()) 201 if (!icon_image.isNull())
201 icon_str = webui::GetBitmapDataUrl(icon_bitmap); 202 icon_str = webui::GetBitmapDataUrl(icon_bitmap);
202 base::StringValue title(text); 203 base::StringValue title(text);
203 base::StringValue icon(icon_str); 204 base::StringValue icon(icon_str);
204 web_ui_->CallJavascriptFunction("cr.ui.DropDown.updateNetworkTitle", 205 web_ui_->CallJavascriptFunctionUnsafe("cr.ui.DropDown.updateNetworkTitle",
205 title, icon); 206 title, icon);
206 } 207 }
207 208
208 void NetworkDropdown::RequestNetworkScan() { 209 void NetworkDropdown::RequestNetworkScan() {
209 NetworkHandler::Get()->network_state_handler()->RequestScan(); 210 NetworkHandler::Get()->network_state_handler()->RequestScan();
210 Refresh(); 211 Refresh();
211 } 212 }
212 213
213 } // namespace chromeos 214 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.cc ('k') | chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698