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

Side by Side Diff: chrome/browser/ui/webui/signin/user_manager_screen_handler.cc

Issue 591533002: Different message for offline unlock, first time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « chrome/browser/profiles/profile_metrics.h ('k') | tools/metrics/histograms/histograms.xml » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/signin/user_manager_screen_handler.h" 5 #include "chrome/browser/ui/webui/signin/user_manager_screen_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/value_conversions.h" 10 #include "base/value_conversions.h"
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 const GoogleServiceAuthError& error) { 466 const GoogleServiceAuthError& error) {
467 const GoogleServiceAuthError::State state = error.state(); 467 const GoogleServiceAuthError::State state = error.state();
468 // Some "error" results mean the password was correct but some other action 468 // Some "error" results mean the password was correct but some other action
469 // should be taken. For our purposes, we only care that the password was 469 // should be taken. For our purposes, we only care that the password was
470 // correct so count those as a success. 470 // correct so count those as a success.
471 bool success = (state == GoogleServiceAuthError::NONE || 471 bool success = (state == GoogleServiceAuthError::NONE ||
472 state == GoogleServiceAuthError::CAPTCHA_REQUIRED || 472 state == GoogleServiceAuthError::CAPTCHA_REQUIRED ||
473 state == GoogleServiceAuthError::TWO_FACTOR || 473 state == GoogleServiceAuthError::TWO_FACTOR ||
474 state == GoogleServiceAuthError::ACCOUNT_DELETED || 474 state == GoogleServiceAuthError::ACCOUNT_DELETED ||
475 state == GoogleServiceAuthError::ACCOUNT_DISABLED); 475 state == GoogleServiceAuthError::ACCOUNT_DISABLED);
476 ReportAuthenticationResult(success, 476 bool offline = (state == GoogleServiceAuthError::CONNECTION_FAILED ||
477 success ? ProfileMetrics::AUTH_ONLINE 477 state == GoogleServiceAuthError::SERVICE_UNAVAILABLE ||
478 : ProfileMetrics::AUTH_FAILED); 478 state == GoogleServiceAuthError::REQUEST_CANCELED);
479 ProfileMetrics::ProfileAuth failure_metric =
480 offline ? ProfileMetrics::AUTH_FAILED_OFFLINE
481 : ProfileMetrics::AUTH_FAILED;
noms (inactive) 2014/09/19 17:38:09 nit: put the : at the end of L480
482 ReportAuthenticationResult(
483 success, success ? ProfileMetrics::AUTH_ONLINE : failure_metric);
479 } 484 }
480 485
481 void UserManagerScreenHandler::RegisterMessages() { 486 void UserManagerScreenHandler::RegisterMessages() {
482 web_ui()->RegisterMessageCallback(kJsApiUserManagerInitialize, 487 web_ui()->RegisterMessageCallback(kJsApiUserManagerInitialize,
483 base::Bind(&UserManagerScreenHandler::HandleInitialize, 488 base::Bind(&UserManagerScreenHandler::HandleInitialize,
484 base::Unretained(this))); 489 base::Unretained(this)));
485 web_ui()->RegisterMessageCallback(kJsApiUserManagerAddUser, 490 web_ui()->RegisterMessageCallback(kJsApiUserManagerAddUser,
486 base::Bind(&UserManagerScreenHandler::HandleAddUser, 491 base::Bind(&UserManagerScreenHandler::HandleAddUser,
487 base::Unretained(this))); 492 base::Unretained(this)));
488 web_ui()->RegisterMessageCallback(kJsApiUserManagerAuthLaunchUser, 493 web_ui()->RegisterMessageCallback(kJsApiUserManagerAuthLaunchUser,
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 authenticating_profile_index_, false); 684 authenticating_profile_index_, false);
680 base::FilePath path = info_cache.GetPathOfProfileAtIndex( 685 base::FilePath path = info_cache.GetPathOfProfileAtIndex(
681 authenticating_profile_index_); 686 authenticating_profile_index_);
682 profiles::SwitchToProfile(path, desktop_type_, true, 687 profiles::SwitchToProfile(path, desktop_type_, true,
683 base::Bind(&OnSwitchToProfileComplete), 688 base::Bind(&OnSwitchToProfileComplete),
684 ProfileMetrics::SWITCH_PROFILE_UNLOCK); 689 ProfileMetrics::SWITCH_PROFILE_UNLOCK);
685 } else { 690 } else {
686 web_ui()->CallJavascriptFunction( 691 web_ui()->CallJavascriptFunction(
687 "cr.ui.Oobe.showSignInError", 692 "cr.ui.Oobe.showSignInError",
688 base::FundamentalValue(0), 693 base::FundamentalValue(0),
689 base::StringValue( 694 base::StringValue(l10n_util::GetStringUTF8(
690 l10n_util::GetStringUTF8(IDS_LOGIN_ERROR_AUTHENTICATING)), 695 auth == ProfileMetrics::AUTH_FAILED_OFFLINE
696 ? IDS_LOGIN_ERROR_AUTHENTICATING_OFFLINE
noms (inactive) 2014/09/19 17:38:09 The ? and : should go to at the end of the line. A
697 : IDS_LOGIN_ERROR_AUTHENTICATING)),
691 base::StringValue(""), 698 base::StringValue(""),
692 base::FundamentalValue(0)); 699 base::FundamentalValue(0));
693 } 700 }
694 } 701 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_metrics.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698