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/chromeos/choose_mobile_network_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/string_piece.h" | 15 #include "base/strings/string_piece.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
19 #include "chromeos/network/device_state.h" | 19 #include "chromeos/network/device_state.h" |
20 #include "chromeos/network/network_device_handler.h" | 20 #include "chromeos/network/network_device_handler.h" |
21 #include "chromeos/network/network_event_log.h" | 21 #include "chromeos/network/network_event_log.h" |
22 #include "chromeos/network/network_state_handler.h" | 22 #include "chromeos/network/network_state_handler.h" |
23 #include "chromeos/network/network_state_handler_observer.h" | 23 #include "chromeos/network/network_state_handler_observer.h" |
| 24 #include "chromeos/network/shill_property_util.h" |
24 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
25 #include "content/public/browser/web_ui.h" | 26 #include "content/public/browser/web_ui.h" |
26 #include "content/public/browser/web_ui_data_source.h" | 27 #include "content/public/browser/web_ui_data_source.h" |
27 #include "content/public/browser/web_ui_message_handler.h" | 28 #include "content/public/browser/web_ui_message_handler.h" |
28 #include "grit/browser_resources.h" | 29 #include "grit/browser_resources.h" |
29 #include "grit/generated_resources.h" | 30 #include "grit/generated_resources.h" |
30 #include "third_party/cros_system_api/dbus/service_constants.h" | 31 #include "third_party/cros_system_api/dbus/service_constants.h" |
31 #include "ui/base/l10n/l10n_util.h" | 32 #include "ui/base/l10n/l10n_util.h" |
32 #include "ui/base/resource/resource_bundle.h" | 33 #include "ui/base/resource/resource_bundle.h" |
33 | 34 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 116 |
116 DISALLOW_COPY_AND_ASSIGN(ChooseMobileNetworkHandler); | 117 DISALLOW_COPY_AND_ASSIGN(ChooseMobileNetworkHandler); |
117 }; | 118 }; |
118 | 119 |
119 // ChooseMobileNetworkHandler implementation. | 120 // ChooseMobileNetworkHandler implementation. |
120 | 121 |
121 ChooseMobileNetworkHandler::ChooseMobileNetworkHandler() | 122 ChooseMobileNetworkHandler::ChooseMobileNetworkHandler() |
122 : is_page_ready_(false), | 123 : is_page_ready_(false), |
123 has_pending_results_(false) { | 124 has_pending_results_(false) { |
124 NetworkStateHandler* handler = GetNetworkStateHandler(); | 125 NetworkStateHandler* handler = GetNetworkStateHandler(); |
125 const DeviceState* cellular = handler->GetDeviceStateByType( | 126 const DeviceState* cellular = |
126 flimflam::kTypeCellular); | 127 handler->GetDeviceStateByType(NetworkTypePattern::Cellular()); |
127 if (!cellular) { | 128 if (!cellular) { |
128 NET_LOG_ERROR( | 129 NET_LOG_ERROR( |
129 "A cellular device is not available.", | 130 "A cellular device is not available.", |
130 "Cannot initiate a cellular network scan without a cellular device."); | 131 "Cannot initiate a cellular network scan without a cellular device."); |
131 return; | 132 return; |
132 } | 133 } |
133 handler->AddObserver(this, FROM_HERE); | 134 handler->AddObserver(this, FROM_HERE); |
134 device_path_ = cellular->path(); | 135 device_path_ = cellular->path(); |
135 GetNetworkDeviceHandler()->ProposeScan( | 136 GetNetworkDeviceHandler()->ProposeScan( |
136 device_path_, | 137 device_path_, |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 : WebUIController(web_ui) { | 253 : WebUIController(web_ui) { |
253 ChooseMobileNetworkHandler* handler = new ChooseMobileNetworkHandler(); | 254 ChooseMobileNetworkHandler* handler = new ChooseMobileNetworkHandler(); |
254 web_ui->AddMessageHandler(handler); | 255 web_ui->AddMessageHandler(handler); |
255 // Set up the "chrome://choose-mobile-network" source. | 256 // Set up the "chrome://choose-mobile-network" source. |
256 Profile* profile = Profile::FromWebUI(web_ui); | 257 Profile* profile = Profile::FromWebUI(web_ui); |
257 content::WebUIDataSource::Add( | 258 content::WebUIDataSource::Add( |
258 profile, CreateChooseMobileNetworkUIHTMLSource()); | 259 profile, CreateChooseMobileNetworkUIHTMLSource()); |
259 } | 260 } |
260 | 261 |
261 } // namespace chromeos | 262 } // namespace chromeos |
OLD | NEW |