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

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

Issue 8633012: [cros] Return proxy-settings back to the network menu list for OOBE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged Created 9 years, 1 month 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/chromeos/cros/cros_library.h" 10 #include "chrome/browser/chromeos/cros/cros_library.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 85 }
86 if (type == ui::MenuModel::TYPE_SUBMENU) 86 if (type == ui::MenuModel::TYPE_SUBMENU)
87 item->Set("sub", ConvertMenuModel(model->GetSubmenuModelAt(i))); 87 item->Set("sub", ConvertMenuModel(model->GetSubmenuModelAt(i)));
88 list->Append(item); 88 list->Append(item);
89 } 89 }
90 return list; 90 return list;
91 } 91 }
92 92
93 // NetworkDropdown ------------------------------------------------------------- 93 // NetworkDropdown -------------------------------------------------------------
94 94
95 NetworkDropdown::NetworkDropdown(WebUI* web_ui, gfx::NativeWindow parent_window) 95 NetworkDropdown::NetworkDropdown(WebUI* web_ui,
96 gfx::NativeWindow parent_window, bool oobe)
96 : parent_window_(parent_window), 97 : parent_window_(parent_window),
97 web_ui_(web_ui) { 98 web_ui_(web_ui),
99 oobe_(oobe) {
98 network_menu_.reset(new NetworkMenuWebUI(this, web_ui)); 100 network_menu_.reset(new NetworkMenuWebUI(this, web_ui));
99 network_icon_.reset( 101 network_icon_.reset(
100 new NetworkMenuIcon(this, NetworkMenuIcon::DROPDOWN_MODE)); 102 new NetworkMenuIcon(this, NetworkMenuIcon::DROPDOWN_MODE));
101 CrosLibrary::Get()->GetNetworkLibrary()->AddNetworkManagerObserver(this); 103 CrosLibrary::Get()->GetNetworkLibrary()->AddNetworkManagerObserver(this);
102 Refresh(); 104 Refresh();
103 } 105 }
104 106
105 NetworkDropdown::~NetworkDropdown() { 107 NetworkDropdown::~NetworkDropdown() {
106 CrosLibrary::Get()->GetNetworkLibrary()->RemoveNetworkManagerObserver(this); 108 CrosLibrary::Get()->GetNetworkLibrary()->RemoveNetworkManagerObserver(this);
107 } 109 }
(...skipping 13 matching lines...) Expand all
121 123
122 void NetworkDropdown::OpenButtonOptions() { 124 void NetworkDropdown::OpenButtonOptions() {
123 if (proxy_settings_dialog_.get() == NULL) { 125 if (proxy_settings_dialog_.get() == NULL) {
124 proxy_settings_dialog_.reset( 126 proxy_settings_dialog_.reset(
125 new ProxySettingsDialog(this, GetNativeWindow())); 127 new ProxySettingsDialog(this, GetNativeWindow()));
126 } 128 }
127 proxy_settings_dialog_->Show(); 129 proxy_settings_dialog_->Show();
128 } 130 }
129 131
130 bool NetworkDropdown::ShouldOpenButtonOptions() const { 132 bool NetworkDropdown::ShouldOpenButtonOptions() const {
131 return false; 133 return !oobe_;
132 } 134 }
133 135
134 void NetworkDropdown::OnNetworkManagerChanged(NetworkLibrary* cros) { 136 void NetworkDropdown::OnNetworkManagerChanged(NetworkLibrary* cros) {
135 Refresh(); 137 Refresh();
136 } 138 }
137 139
138 void NetworkDropdown::Refresh() { 140 void NetworkDropdown::Refresh() {
139 SetNetworkIconAndText(); 141 SetNetworkIconAndText();
140 network_menu_->UpdateMenu(); 142 network_menu_->UpdateMenu();
141 } 143 }
(...skipping 11 matching lines...) Expand all
153 std::string icon_str = 155 std::string icon_str =
154 icon_bitmap.empty() ? 156 icon_bitmap.empty() ?
155 std::string() : web_ui_util::GetImageDataUrl(icon_bitmap); 157 std::string() : web_ui_util::GetImageDataUrl(icon_bitmap);
156 base::StringValue title(text); 158 base::StringValue title(text);
157 base::StringValue icon(icon_str); 159 base::StringValue icon(icon_str);
158 web_ui_->CallJavascriptFunction("cr.ui.DropDown.updateNetworkTitle", 160 web_ui_->CallJavascriptFunction("cr.ui.DropDown.updateNetworkTitle",
159 title, icon); 161 title, icon);
160 } 162 }
161 163
162 } // namespace chromeos 164 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698