OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/chromeos/dom_ui/network_menu_ui.h" | 5 #include "chrome/browser/chromeos/dom_ui/network_menu_ui.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 12 matching lines...) Expand all Loading... | |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 class NetworkMenuSourceDelegate : public chromeos::MenuSourceDelegate { | 26 class NetworkMenuSourceDelegate : public chromeos::MenuSourceDelegate { |
27 public: | 27 public: |
28 virtual void AddLocalizedStrings(DictionaryValue* localized_strings) const { | 28 virtual void AddLocalizedStrings(DictionaryValue* localized_strings) const { |
29 DCHECK(localized_strings); | 29 DCHECK(localized_strings); |
30 | 30 |
31 localized_strings->SetString("reconnect", l10n_util::GetStringUTF16( | 31 localized_strings->SetString("reconnect", l10n_util::GetStringUTF16( |
32 IDS_NETWORK_RECONNECT_TITLE)); | 32 IDS_NETWORK_RECONNECT_TITLE)); |
33 localized_strings->SetString("remeber_this_network", | 33 localized_strings->SetString("auto_connect_this_network", |
34 l10n_util::GetStringUTF16(IDS_NETWORK_REMEMBER_THIS_NETWORK_TITLE)); | 34 l10n_util::GetStringUTF16( |
Charlie Lee
2010/11/15 19:42:52
If this string is no longer needed, please remove
kochi
2010/11/16 05:47:24
No one else is using.
Removed.
| |
35 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_AUTO_CONNECT)); | |
35 localized_strings->SetString("ssid_prompt", | 36 localized_strings->SetString("ssid_prompt", |
36 l10n_util::GetStringUTF16(IDS_NETWORK_SSID_HINT)); | 37 l10n_util::GetStringUTF16(IDS_NETWORK_SSID_HINT)); |
37 localized_strings->SetString("pass_prompt", | 38 localized_strings->SetString("pass_prompt", |
38 l10n_util::GetStringUTF16(IDS_NETWORK_PASSWORD_HINT)); | 39 l10n_util::GetStringUTF16(IDS_NETWORK_PASSWORD_HINT)); |
39 } | 40 } |
40 }; | 41 }; |
41 | 42 |
42 //////////////////////////////////////////////////////////////////////////////// | 43 //////////////////////////////////////////////////////////////////////////////// |
43 // | 44 // |
44 // MenuHandler | 45 // MenuHandler |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
142 success = success && base::StringToInt(index_str, &index); | 143 success = success && base::StringToInt(index_str, &index); |
143 if (!success) { | 144 if (!success) { |
144 LOG(WARNING) << "ModelAction called with no index from: " | 145 LOG(WARNING) << "ModelAction called with no index from: " |
145 << chrome::kChromeUINetworkMenu; | 146 << chrome::kChromeUINetworkMenu; |
146 return close_menu; | 147 return close_menu; |
147 } | 148 } |
148 std::string passphrase; | 149 std::string passphrase; |
149 values->GetString(2, &passphrase); // Optional | 150 values->GetString(2, &passphrase); // Optional |
150 std::string ssid; | 151 std::string ssid; |
151 values->GetString(3, &ssid); // Optional | 152 values->GetString(3, &ssid); // Optional |
152 int remember = -1; // -1 indicates not set | 153 int auto_connect = -1; // -1 indicates default action (auto connect) |
153 std::string remember_str; | 154 std::string auto_connect_str; |
154 if (values->GetString(4, &remember_str)) // Optional | 155 if (values->GetString(4, &auto_connect_str)) // Optional |
155 base::StringToInt(remember_str, &remember); | 156 base::StringToInt(auto_connect_str, &auto_connect); |
156 | 157 |
157 if (action == "connect" || action == "reconnect") { | 158 if (action == "connect" || action == "reconnect") { |
158 close_menu = network_menu->ConnectToNetworkAt(index, passphrase, ssid, | 159 close_menu = network_menu->ConnectToNetworkAt(index, passphrase, ssid, |
159 remember); | 160 auto_connect); |
160 } else { | 161 } else { |
161 LOG(WARNING) << "Unrecognized action: " << action | 162 LOG(WARNING) << "Unrecognized action: " << action |
162 << " from: " << chrome::kChromeUINetworkMenu; | 163 << " from: " << chrome::kChromeUINetworkMenu; |
163 } | 164 } |
164 return close_menu; | 165 return close_menu; |
165 } | 166 } |
166 | 167 |
167 DictionaryValue* NetworkMenuUI::CreateMenuItem(const menus::MenuModel* model, | 168 DictionaryValue* NetworkMenuUI::CreateMenuItem(const menus::MenuModel* model, |
168 int index, | 169 int index, |
169 const char* type, | 170 const char* type, |
(...skipping 22 matching lines...) Expand all Loading... | |
192 } | 193 } |
193 | 194 |
194 views::Menu2* NetworkMenuUI::CreateMenu2(menus::MenuModel* model) { | 195 views::Menu2* NetworkMenuUI::CreateMenu2(menus::MenuModel* model) { |
195 views::Menu2* menu = new views::Menu2(model); | 196 views::Menu2* menu = new views::Menu2(model); |
196 NativeMenuDOMUI::SetMenuURL( | 197 NativeMenuDOMUI::SetMenuURL( |
197 menu, GURL(StringPrintf("chrome://%s", chrome::kChromeUINetworkMenu))); | 198 menu, GURL(StringPrintf("chrome://%s", chrome::kChromeUINetworkMenu))); |
198 return menu; | 199 return menu; |
199 } | 200 } |
200 | 201 |
201 } // namespace chromeos | 202 } // namespace chromeos |
OLD | NEW |