| OLD | NEW |
| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, | 95 NetworkDropdown::NetworkDropdown(WebUI* web_ui, |
| 96 gfx::NativeWindow parent_window, bool oobe) | 96 gfx::NativeWindow parent_window, |
| 97 bool oobe, |
| 98 ConnectionType last_network_type) |
| 97 : parent_window_(parent_window), | 99 : parent_window_(parent_window), |
| 98 web_ui_(web_ui), | 100 web_ui_(web_ui), |
| 99 oobe_(oobe) { | 101 oobe_(oobe) { |
| 100 network_menu_.reset(new NetworkMenuWebUI(this, web_ui)); | 102 network_menu_.reset(new NetworkMenuWebUI(this, web_ui)); |
| 101 network_icon_.reset( | 103 network_icon_.reset( |
| 102 new NetworkMenuIcon(this, NetworkMenuIcon::DROPDOWN_MODE)); | 104 new NetworkMenuIcon(this, NetworkMenuIcon::DROPDOWN_MODE, |
| 105 last_network_type)); |
| 103 CrosLibrary::Get()->GetNetworkLibrary()->AddNetworkManagerObserver(this); | 106 CrosLibrary::Get()->GetNetworkLibrary()->AddNetworkManagerObserver(this); |
| 104 Refresh(); | 107 Refresh(); |
| 105 } | 108 } |
| 106 | 109 |
| 107 NetworkDropdown::~NetworkDropdown() { | 110 NetworkDropdown::~NetworkDropdown() { |
| 108 CrosLibrary::Get()->GetNetworkLibrary()->RemoveNetworkManagerObserver(this); | 111 CrosLibrary::Get()->GetNetworkLibrary()->RemoveNetworkManagerObserver(this); |
| 109 } | 112 } |
| 110 | 113 |
| 111 void NetworkDropdown::OnItemChosen(int id) { | 114 void NetworkDropdown::OnItemChosen(int id) { |
| 112 network_menu_->OnItemChosen(id); | 115 network_menu_->OnItemChosen(id); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 std::string icon_str = | 158 std::string icon_str = |
| 156 icon_bitmap.empty() ? | 159 icon_bitmap.empty() ? |
| 157 std::string() : web_ui_util::GetImageDataUrl(icon_bitmap); | 160 std::string() : web_ui_util::GetImageDataUrl(icon_bitmap); |
| 158 base::StringValue title(text); | 161 base::StringValue title(text); |
| 159 base::StringValue icon(icon_str); | 162 base::StringValue icon(icon_str); |
| 160 web_ui_->CallJavascriptFunction("cr.ui.DropDown.updateNetworkTitle", | 163 web_ui_->CallJavascriptFunction("cr.ui.DropDown.updateNetworkTitle", |
| 161 title, icon); | 164 title, icon); |
| 162 } | 165 } |
| 163 | 166 |
| 164 } // namespace chromeos | 167 } // namespace chromeos |
| OLD | NEW |