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

Side by Side Diff: chrome/browser/chromeos/login/supervised/supervised_user_creation_controller_new.cc

Issue 2771233002: Remove the wrapper functions content::RecordAction et al (Closed)
Patch Set: Rebased Created 3 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/login/supervised/supervised_user_creation_cont roller_new.h" 5 #include "chrome/browser/chromeos/login/supervised/supervised_user_creation_cont roller_new.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/metrics/user_metrics.h"
11 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
13 #include "base/sys_info.h" 14 #include "base/sys_info.h"
14 #include "base/task_runner_util.h" 15 #include "base/task_runner_util.h"
15 #include "base/threading/sequenced_worker_pool.h" 16 #include "base/threading/sequenced_worker_pool.h"
16 #include "base/values.h" 17 #include "base/values.h"
17 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio n.h" 18 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio n.h"
18 #include "chrome/browser/chromeos/login/supervised/supervised_user_constants.h" 19 #include "chrome/browser/chromeos/login/supervised/supervised_user_constants.h"
19 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" 20 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h"
20 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" 21 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h"
21 #include "chrome/browser/chromeos/profiles/profile_helper.h" 22 #include "chrome/browser/chromeos/profiles/profile_helper.h"
22 #include "chrome/browser/lifetime/application_lifetime.h" 23 #include "chrome/browser/lifetime/application_lifetime.h"
23 #include "chrome/browser/sync/profile_sync_service_factory.h" 24 #include "chrome/browser/sync/profile_sync_service_factory.h"
24 #include "chromeos/cryptohome/cryptohome_parameters.h" 25 #include "chromeos/cryptohome/cryptohome_parameters.h"
25 #include "chromeos/dbus/dbus_thread_manager.h" 26 #include "chromeos/dbus/dbus_thread_manager.h"
26 #include "chromeos/dbus/session_manager_client.h" 27 #include "chromeos/dbus/session_manager_client.h"
27 #include "chromeos/login/auth/key.h" 28 #include "chromeos/login/auth/key.h"
28 #include "chromeos/login/auth/user_context.h" 29 #include "chromeos/login/auth/user_context.h"
29 #include "components/browser_sync/profile_sync_service.h" 30 #include "components/browser_sync/profile_sync_service.h"
30 #include "components/signin/core/account_id/account_id.h" 31 #include "components/signin/core/account_id/account_id.h"
31 #include "components/user_manager/user.h" 32 #include "components/user_manager/user.h"
32 #include "components/user_manager/user_manager.h" 33 #include "components/user_manager/user_manager.h"
33 #include "content/public/browser/browser_thread.h" 34 #include "content/public/browser/browser_thread.h"
34 #include "content/public/browser/user_metrics.h"
35 #include "crypto/random.h" 35 #include "crypto/random.h"
36 #include "google_apis/gaia/google_service_auth_error.h" 36 #include "google_apis/gaia/google_service_auth_error.h"
37 37
38 namespace chromeos { 38 namespace chromeos {
39 39
40 namespace { 40 namespace {
41 41
42 const int kUserCreationTimeoutSeconds = 30; // 30 seconds. 42 const int kUserCreationTimeoutSeconds = 30; // 30 seconds.
43 43
44 bool StoreSupervisedUserFiles(const std::string& token, 44 bool StoreSupervisedUserFiles(const std::string& token,
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 user_manager::UserManager::Get()->SaveUserOAuthStatus( 384 user_manager::UserManager::Get()->SaveUserOAuthStatus(
385 AccountId::FromUserEmail(creation_context_->local_user_id), 385 AccountId::FromUserEmail(creation_context_->local_user_id),
386 user_manager::User::OAUTH2_TOKEN_STATUS_VALID); 386 user_manager::User::OAUTH2_TOKEN_STATUS_VALID);
387 387
388 stage_ = TOKEN_WRITTEN; 388 stage_ = TOKEN_WRITTEN;
389 389
390 timeout_timer_.Stop(); 390 timeout_timer_.Stop();
391 ChromeUserManager::Get() 391 ChromeUserManager::Get()
392 ->GetSupervisedUserManager() 392 ->GetSupervisedUserManager()
393 ->CommitCreationTransaction(); 393 ->CommitCreationTransaction();
394 content::RecordAction( 394 base::RecordAction(
395 base::UserMetricsAction("ManagedMode_LocallyManagedUserCreated")); 395 base::UserMetricsAction("ManagedMode_LocallyManagedUserCreated"));
396 396
397 stage_ = TRANSACTION_COMMITTED; 397 stage_ = TRANSACTION_COMMITTED;
398 398
399 if (consumer_) 399 if (consumer_)
400 consumer_->OnCreationSuccess(); 400 consumer_->OnCreationSuccess();
401 } 401 }
402 402
403 void SupervisedUserCreationControllerNew::CreationTimedOut() { 403 void SupervisedUserCreationControllerNew::CreationTimedOut() {
404 LOG(ERROR) << "Supervised user creation timed out. stage = " << stage_; 404 LOG(ERROR) << "Supervised user creation timed out. stage = " << stage_;
405 if (consumer_) 405 if (consumer_)
406 consumer_->OnCreationTimeout(); 406 consumer_->OnCreationTimeout();
407 } 407 }
408 408
409 void SupervisedUserCreationControllerNew::FinishCreation() { 409 void SupervisedUserCreationControllerNew::FinishCreation() {
410 chrome::AttemptUserExit(); 410 chrome::AttemptUserExit();
411 } 411 }
412 412
413 void SupervisedUserCreationControllerNew::CancelCreation() { 413 void SupervisedUserCreationControllerNew::CancelCreation() {
414 creation_context_->registration_utility.reset(); 414 creation_context_->registration_utility.reset();
415 chrome::AttemptUserExit(); 415 chrome::AttemptUserExit();
416 } 416 }
417 417
418 std::string SupervisedUserCreationControllerNew::GetSupervisedUserId() { 418 std::string SupervisedUserCreationControllerNew::GetSupervisedUserId() {
419 DCHECK(creation_context_); 419 DCHECK(creation_context_);
420 return creation_context_->local_user_id; 420 return creation_context_->local_user_id;
421 } 421 }
422 422
423 } // namespace chromeos 423 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/signin/auth_sync_observer.cc ('k') | chrome/browser/chromeos/set_time_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698