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

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

Issue 14729017: Add NetworkHandler to own network handlers in src/chromeos/network (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix chromeos_unittests Created 7 years, 7 months 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
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/network_state_informer.cc ('k') | chromeos/chromeos.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/signin_screen_handler.h" 5 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 217
218 bool IsSigninScreenError(ErrorScreen::ErrorState error_state) { 218 bool IsSigninScreenError(ErrorScreen::ErrorState error_state) {
219 return error_state == ErrorScreen::ERROR_STATE_PORTAL || 219 return error_state == ErrorScreen::ERROR_STATE_PORTAL ||
220 error_state == ErrorScreen::ERROR_STATE_OFFLINE || 220 error_state == ErrorScreen::ERROR_STATE_OFFLINE ||
221 error_state == ErrorScreen::ERROR_STATE_PROXY || 221 error_state == ErrorScreen::ERROR_STATE_PROXY ||
222 error_state == ErrorScreen::ERROR_STATE_AUTH_EXT_TIMEOUT; 222 error_state == ErrorScreen::ERROR_STATE_AUTH_EXT_TIMEOUT;
223 } 223 }
224 224
225 // Returns network name by service path. 225 // Returns network name by service path.
226 std::string GetNetworkName(const std::string& service_path) { 226 std::string GetNetworkName(const std::string& service_path) {
227 const NetworkState* network = 227 const NetworkState* network = NetworkHandler::Get()->network_state_handler()->
228 NetworkStateHandler::Get()->GetNetworkState(service_path); 228 GetNetworkState(service_path);
229 if (!network) 229 if (!network)
230 return std::string(); 230 return std::string();
231 return network->name(); 231 return network->name();
232 } 232 }
233 233
234 // Returns network unique id by service path. 234 // Returns network unique id by service path.
235 std::string GetNetworkUniqueId(const std::string& service_path) { 235 std::string GetNetworkUniqueId(const std::string& service_path) {
236 const NetworkState* network = 236 const NetworkState* network = NetworkHandler::Get()->network_state_handler()->
237 NetworkStateHandler::Get()->GetNetworkState(service_path); 237 GetNetworkState(service_path);
238 if (!network) 238 if (!network)
239 return std::string(); 239 return std::string();
240 return network->guid(); 240 return network->guid();
241 } 241 }
242 242
243 // Returns captive portal state for a network by its service path. 243 // Returns captive portal state for a network by its service path.
244 NetworkPortalDetector::CaptivePortalState GetCaptivePortalState( 244 NetworkPortalDetector::CaptivePortalState GetCaptivePortalState(
245 const std::string& service_path) { 245 const std::string& service_path) {
246 NetworkPortalDetector* detector = NetworkPortalDetector::GetInstance(); 246 NetworkPortalDetector* detector = NetworkPortalDetector::GetInstance();
247 const NetworkState* network = 247 const NetworkState* network = NetworkHandler::Get()->network_state_handler()->
248 NetworkStateHandler::Get()->GetNetworkState(service_path); 248 GetNetworkState(service_path);
249 if (!detector || !network) 249 if (!detector || !network)
250 return NetworkPortalDetector::CaptivePortalState(); 250 return NetworkPortalDetector::CaptivePortalState();
251 return detector->GetCaptivePortalState(network); 251 return detector->GetCaptivePortalState(network);
252 } 252 }
253 253
254 void RecordDiscrepancyWithShill( 254 void RecordDiscrepancyWithShill(
255 const NetworkState* network, 255 const NetworkState* network,
256 const NetworkPortalDetector::CaptivePortalStatus status) { 256 const NetworkPortalDetector::CaptivePortalStatus status) {
257 if (network->connection_state() == flimflam::kStateOnline) { 257 if (network->connection_state() == flimflam::kStateOnline) {
258 UMA_HISTOGRAM_ENUMERATION( 258 UMA_HISTOGRAM_ENUMERATION(
(...skipping 10 matching lines...) Expand all
269 "CaptivePortal.OOBE.DiscrepancyWithShill_Offline", 269 "CaptivePortal.OOBE.DiscrepancyWithShill_Offline",
270 status, 270 status,
271 NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_COUNT); 271 NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_COUNT);
272 } 272 }
273 } 273 }
274 274
275 // Record state and descripancies with shill (e.g. shill thinks that 275 // Record state and descripancies with shill (e.g. shill thinks that
276 // network is online but NetworkPortalDetector claims that it's behind 276 // network is online but NetworkPortalDetector claims that it's behind
277 // portal) for the network identified by |service_path|. 277 // portal) for the network identified by |service_path|.
278 void RecordNetworkPortalDetectorStats(const std::string& service_path) { 278 void RecordNetworkPortalDetectorStats(const std::string& service_path) {
279 const NetworkState* network = 279 const NetworkState* network = NetworkHandler::Get()->network_state_handler()->
280 NetworkStateHandler::Get()->GetNetworkState(service_path); 280 GetNetworkState(service_path);
281 if (!network) 281 if (!network)
282 return; 282 return;
283 NetworkPortalDetector::CaptivePortalState state = 283 NetworkPortalDetector::CaptivePortalState state =
284 GetCaptivePortalState(service_path); 284 GetCaptivePortalState(service_path);
285 if (state.status == NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_UNKNOWN) 285 if (state.status == NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_UNKNOWN)
286 return; 286 return;
287 287
288 UMA_HISTOGRAM_ENUMERATION("CaptivePortal.OOBE.DetectionResult", 288 UMA_HISTOGRAM_ENUMERATION("CaptivePortal.OOBE.DetectionResult",
289 state.status, 289 state.status,
290 NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_COUNT); 290 NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_COUNT);
(...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after
1589 if (!cros_settings) 1589 if (!cros_settings)
1590 return false; 1590 return false;
1591 1591
1592 // Offline login is allowed only when user pods are hidden. 1592 // Offline login is allowed only when user pods are hidden.
1593 bool show_pods; 1593 bool show_pods;
1594 cros_settings->GetBoolean(kAccountsPrefShowUserNamesOnSignIn, &show_pods); 1594 cros_settings->GetBoolean(kAccountsPrefShowUserNamesOnSignIn, &show_pods);
1595 return !show_pods; 1595 return !show_pods;
1596 } 1596 }
1597 1597
1598 } // namespace chromeos 1598 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/network_state_informer.cc ('k') | chromeos/chromeos.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698