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

Side by Side Diff: chrome/browser/chromeos/arc/arc_auth_service.cc

Issue 2508713003: arc: Prepare ArcAuthEndpoint flag for finch experiment. (Closed)
Patch Set: rebase Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/arc/arc_auth_service.h" 5 #include "chrome/browser/chromeos/arc/arc_auth_service.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/common/shelf/shelf_delegate.h" 9 #include "ash/common/shelf/shelf_delegate.h"
10 #include "ash/common/wm_shell.h" 10 #include "ash/common/wm_shell.h"
(...skipping 21 matching lines...) Expand all
32 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" 32 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
33 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" 33 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
34 #include "chrome/browser/ui/browser_commands.h" 34 #include "chrome/browser/ui/browser_commands.h"
35 #include "chrome/common/pref_names.h" 35 #include "chrome/common/pref_names.h"
36 #include "chrome/grit/generated_resources.h" 36 #include "chrome/grit/generated_resources.h"
37 #include "chromeos/chromeos_switches.h" 37 #include "chromeos/chromeos_switches.h"
38 #include "chromeos/cryptohome/cryptohome_parameters.h" 38 #include "chromeos/cryptohome/cryptohome_parameters.h"
39 #include "chromeos/dbus/dbus_thread_manager.h" 39 #include "chromeos/dbus/dbus_thread_manager.h"
40 #include "chromeos/dbus/session_manager_client.h" 40 #include "chromeos/dbus/session_manager_client.h"
41 #include "components/arc/arc_bridge_service.h" 41 #include "components/arc/arc_bridge_service.h"
42 #include "components/arc/arc_features.h"
42 #include "components/pref_registry/pref_registry_syncable.h" 43 #include "components/pref_registry/pref_registry_syncable.h"
43 #include "components/prefs/pref_service.h" 44 #include "components/prefs/pref_service.h"
44 #include "components/sync_preferences/pref_service_syncable.h" 45 #include "components/sync_preferences/pref_service_syncable.h"
45 #include "components/user_manager/user.h" 46 #include "components/user_manager/user.h"
46 #include "content/public/browser/browser_thread.h" 47 #include "content/public/browser/browser_thread.h"
47 #include "extensions/browser/extension_prefs.h" 48 #include "extensions/browser/extension_prefs.h"
48 49
49 namespace arc { 50 namespace arc {
50 51
51 namespace { 52 namespace {
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 395
395 // In Kiosk mode, use Robot auth code fetching. 396 // In Kiosk mode, use Robot auth code fetching.
396 if (IsArcKioskMode()) { 397 if (IsArcKioskMode()) {
397 arc_robot_auth_.reset(new ArcRobotAuth()); 398 arc_robot_auth_.reset(new ArcRobotAuth());
398 arc_robot_auth_->FetchRobotAuthCode( 399 arc_robot_auth_->FetchRobotAuthCode(
399 base::Bind(&ArcAuthService::OnRobotAuthCodeFetched, 400 base::Bind(&ArcAuthService::OnRobotAuthCodeFetched,
400 weak_ptr_factory_.GetWeakPtr())); 401 weak_ptr_factory_.GetWeakPtr()));
401 return; 402 return;
402 } 403 }
403 404
404 // If endpoint is passed via command line flag, use automatic auth code 405 if (base::FeatureList::IsEnabled(arc::kArcUseAuthEndpointFeature)) {
405 // fetching. 406 DCHECK(!auth_code_fetcher_);
406 const base::CommandLine* command_line = 407 auth_code_fetcher_ =
407 base::CommandLine::ForCurrentProcess(); 408 base::MakeUnique<ArcAuthCodeFetcher>(profile_, context_.get());
408 if (command_line->HasSwitch(chromeos::switches::kArcUseAuthEndpoint)) { 409 auth_code_fetcher_->Fetch(base::Bind(&ArcAuthService::OnAuthCodeFetched,
409 std::string auth_endpoint = command_line->GetSwitchValueASCII( 410 weak_ptr_factory_.GetWeakPtr()));
410 chromeos::switches::kArcUseAuthEndpoint); 411 return;
411 if (!auth_endpoint.empty()) {
412 DCHECK(!auth_code_fetcher_);
413 auth_code_fetcher_ = base::MakeUnique<ArcAuthCodeFetcher>(
414 profile_, context_.get(), auth_endpoint);
415 auth_code_fetcher_->Fetch(base::Bind(&ArcAuthService::OnAuthCodeFetched,
416 weak_ptr_factory_.GetWeakPtr()));
417 return;
418 }
419 } 412 }
420 413
421 // Otherwise, show LSO page to user, and let them click "Sign in" button. 414 // Otherwise, show LSO page to user, and let them click "Sign in" button.
422 if (support_host_) 415 if (support_host_)
423 support_host_->ShowLso(); 416 support_host_->ShowLso();
424 } 417 }
425 418
426 void ArcAuthService::OnRobotAuthCodeFetched( 419 void ArcAuthService::OnRobotAuthCodeFetched(
427 const std::string& robot_auth_code) { 420 const std::string& robot_auth_code) {
428 // We fetching robot auth code for ARC kiosk only. 421 // We fetching robot auth code for ARC kiosk only.
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 return os << "ACTIVE"; 1067 return os << "ACTIVE";
1075 } 1068 }
1076 1069
1077 // Some compiler reports an error even if all values of an enum-class are 1070 // Some compiler reports an error even if all values of an enum-class are
1078 // covered indivisually in a switch statement. 1071 // covered indivisually in a switch statement.
1079 NOTREACHED(); 1072 NOTREACHED();
1080 return os; 1073 return os;
1081 } 1074 }
1082 1075
1083 } // namespace arc 1076 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698