OLD | NEW |
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/options/chromeos/internet_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/chromeos/internet_options_handler.h" |
6 | 6 |
7 #include <ctype.h> | 7 #include <ctype.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "ash/system/chromeos/network/network_connect.h" | 13 #include "ash/system/chromeos/network/network_connect.h" |
14 #include "ash/system/chromeos/network/network_icon.h" | |
15 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
16 #include "base/bind.h" | 15 #include "base/bind.h" |
17 #include "base/bind_helpers.h" | 16 #include "base/bind_helpers.h" |
18 #include "base/command_line.h" | 17 #include "base/command_line.h" |
19 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
20 #include "base/values.h" | 19 #include "base/values.h" |
21 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
22 #include "chrome/browser/chrome_notification_types.h" | 21 #include "chrome/browser/chrome_notification_types.h" |
23 #include "chrome/browser/chromeos/mobile_config.h" | 22 #include "chrome/browser/chromeos/mobile_config.h" |
24 #include "chrome/browser/chromeos/net/onc_utils.h" | 23 #include "chrome/browser/chromeos/net/onc_utils.h" |
(...skipping 20 matching lines...) Expand all Loading... |
45 #include "chromeos/network/network_state_handler.h" | 44 #include "chromeos/network/network_state_handler.h" |
46 #include "chromeos/network/network_util.h" | 45 #include "chromeos/network/network_util.h" |
47 #include "chromeos/network/onc/onc_signature.h" | 46 #include "chromeos/network/onc/onc_signature.h" |
48 #include "chromeos/network/onc/onc_translator.h" | 47 #include "chromeos/network/onc/onc_translator.h" |
49 #include "components/onc/onc_constants.h" | 48 #include "components/onc/onc_constants.h" |
50 #include "content/public/browser/notification_service.h" | 49 #include "content/public/browser/notification_service.h" |
51 #include "content/public/browser/user_metrics.h" | 50 #include "content/public/browser/user_metrics.h" |
52 #include "content/public/browser/web_contents.h" | 51 #include "content/public/browser/web_contents.h" |
53 #include "content/public/browser/web_ui.h" | 52 #include "content/public/browser/web_ui.h" |
54 #include "grit/ash_resources.h" | 53 #include "grit/ash_resources.h" |
| 54 #include "grit/ui_chromeos_resources.h" |
55 #include "third_party/cros_system_api/dbus/service_constants.h" | 55 #include "third_party/cros_system_api/dbus/service_constants.h" |
56 #include "ui/base/resource/resource_bundle.h" | 56 #include "ui/base/resource/resource_bundle.h" |
57 #include "ui/base/webui/web_ui_util.h" | 57 #include "ui/base/webui/web_ui_util.h" |
| 58 #include "ui/chromeos/network/network_icon.h" |
58 #include "ui/gfx/image/image_skia.h" | 59 #include "ui/gfx/image/image_skia.h" |
59 | 60 |
60 namespace chromeos { | 61 namespace chromeos { |
61 namespace options { | 62 namespace options { |
62 | 63 |
63 namespace { | 64 namespace { |
64 | 65 |
65 // Keys for the network description dictionary passed to the web ui. Make sure | 66 // Keys for the network description dictionary passed to the web ui. Make sure |
66 // to keep the strings in sync with what the JavaScript side uses. | 67 // to keep the strings in sync with what the JavaScript side uses. |
67 const char kNetworkInfoKeyIconURL[] = "iconURL"; | 68 const char kNetworkInfoKeyIconURL[] = "iconURL"; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 const NetworkState* network, | 221 const NetworkState* network, |
221 float icon_scale_factor, | 222 float icon_scale_factor, |
222 const PrefService* profile_prefs) { | 223 const PrefService* profile_prefs) { |
223 scoped_ptr<base::DictionaryValue> network_info = | 224 scoped_ptr<base::DictionaryValue> network_info = |
224 network_util::TranslateNetworkStateToONC(network); | 225 network_util::TranslateNetworkStateToONC(network); |
225 | 226 |
226 bool has_policy = onc::HasPolicyForNetwork( | 227 bool has_policy = onc::HasPolicyForNetwork( |
227 profile_prefs, g_browser_process->local_state(), *network); | 228 profile_prefs, g_browser_process->local_state(), *network); |
228 network_info->SetBoolean(kNetworkInfoKeyPolicyManaged, has_policy); | 229 network_info->SetBoolean(kNetworkInfoKeyPolicyManaged, has_policy); |
229 | 230 |
230 std::string icon_url = ash::network_icon::GetImageUrlForNetwork( | 231 std::string icon_url = ui::network_icon::GetImageUrlForNetwork( |
231 network, ash::network_icon::ICON_TYPE_LIST, icon_scale_factor); | 232 network, ui::network_icon::ICON_TYPE_LIST, icon_scale_factor); |
232 | 233 |
233 network_info->SetString(kNetworkInfoKeyIconURL, icon_url); | 234 network_info->SetString(kNetworkInfoKeyIconURL, icon_url); |
234 network_info->SetString(kNetworkInfoKeyServicePath, network->path()); | 235 network_info->SetString(kNetworkInfoKeyServicePath, network->path()); |
235 | 236 |
236 return network_info.release(); | 237 return network_info.release(); |
237 } | 238 } |
238 | 239 |
239 // Pulls IP information out of a shill service properties dictionary. If | 240 // Pulls IP information out of a shill service properties dictionary. If |
240 // |static_ip| is true, then it fetches "StaticIP.*" properties. If not, then it | 241 // |static_ip| is true, then it fetches "StaticIP.*" properties. If not, then it |
241 // fetches "SavedIP.*" properties. Caller must take ownership of returned | 242 // fetches "SavedIP.*" properties. Caller must take ownership of returned |
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1565 dictionary->SetBoolean( | 1566 dictionary->SetBoolean( |
1566 kTagWimaxAvailable, | 1567 kTagWimaxAvailable, |
1567 handler->IsTechnologyAvailable(NetworkTypePattern::Wimax())); | 1568 handler->IsTechnologyAvailable(NetworkTypePattern::Wimax())); |
1568 dictionary->SetBoolean( | 1569 dictionary->SetBoolean( |
1569 kTagWimaxEnabled, | 1570 kTagWimaxEnabled, |
1570 handler->IsTechnologyEnabled(NetworkTypePattern::Wimax())); | 1571 handler->IsTechnologyEnabled(NetworkTypePattern::Wimax())); |
1571 } | 1572 } |
1572 | 1573 |
1573 } // namespace options | 1574 } // namespace options |
1574 } // namespace chromeos | 1575 } // namespace chromeos |
OLD | NEW |