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

Side by Side Diff: chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.h

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CONTROLLER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CONTROLLER_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CONTROLLER_H_
7 7
8 #include <memory>
8 #include <string> 9 #include <string>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/callback_list.h" 12 #include "base/callback_list.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/timer/timer.h" 15 #include "base/timer/timer.h"
16 #include "chrome/browser/chromeos/policy/auto_enrollment_client.h" 16 #include "chrome/browser/chromeos/policy/auto_enrollment_client.h"
17 #include "chrome/browser/chromeos/settings/device_settings_service.h" 17 #include "chrome/browser/chromeos/settings/device_settings_service.h"
18 18
19 namespace policy { 19 namespace policy {
20 class ServerBackedStateKeysBroker; 20 class ServerBackedStateKeysBroker;
21 } 21 }
22 22
23 namespace chromeos { 23 namespace chromeos {
(...skipping 29 matching lines...) Expand all
53 // Starts the auto-enrollment check. 53 // Starts the auto-enrollment check.
54 void Start(); 54 void Start();
55 55
56 // Stops any pending auto-enrollment checking. 56 // Stops any pending auto-enrollment checking.
57 void Cancel(); 57 void Cancel();
58 58
59 // Retry checking. 59 // Retry checking.
60 void Retry(); 60 void Retry();
61 61
62 // Registers a callback to invoke on state changes. 62 // Registers a callback to invoke on state changes.
63 scoped_ptr<ProgressCallbackList::Subscription> RegisterProgressCallback( 63 std::unique_ptr<ProgressCallbackList::Subscription> RegisterProgressCallback(
64 const ProgressCallbackList::CallbackType& callback); 64 const ProgressCallbackList::CallbackType& callback);
65 65
66 policy::AutoEnrollmentState state() const { return state_; } 66 policy::AutoEnrollmentState state() const { return state_; }
67 67
68 private: 68 private:
69 // Callback for the ownership status check. 69 // Callback for the ownership status check.
70 void OnOwnershipStatusCheckDone( 70 void OnOwnershipStatusCheckDone(
71 DeviceSettingsService::OwnershipStatus status); 71 DeviceSettingsService::OwnershipStatus status);
72 72
73 // Starts the auto-enrollment client. 73 // Starts the auto-enrollment client.
74 void StartClient(const std::vector<std::string>& state_keys); 74 void StartClient(const std::vector<std::string>& state_keys);
75 75
76 // Sets |state_| and notifies |progress_callbacks_|. 76 // Sets |state_| and notifies |progress_callbacks_|.
77 void UpdateState(policy::AutoEnrollmentState state); 77 void UpdateState(policy::AutoEnrollmentState state);
78 78
79 // Handles timeout of the safeguard timer and stops waiting for a result. 79 // Handles timeout of the safeguard timer and stops waiting for a result.
80 void Timeout(); 80 void Timeout();
81 81
82 policy::AutoEnrollmentState state_; 82 policy::AutoEnrollmentState state_;
83 ProgressCallbackList progress_callbacks_; 83 ProgressCallbackList progress_callbacks_;
84 84
85 scoped_ptr<policy::AutoEnrollmentClient> client_; 85 std::unique_ptr<policy::AutoEnrollmentClient> client_;
86 86
87 // This timer acts as a belt-and-suspenders safety for the case where one of 87 // This timer acts as a belt-and-suspenders safety for the case where one of
88 // the asynchronous steps required to make the auto-enrollment decision 88 // the asynchronous steps required to make the auto-enrollment decision
89 // doesn't come back. Even though in theory they should all terminate, better 89 // doesn't come back. Even though in theory they should all terminate, better
90 // safe than sorry: There are DBus interactions, an entire network stack etc. 90 // safe than sorry: There are DBus interactions, an entire network stack etc.
91 // - just too many moving pieces to be confident there are no bugs. If 91 // - just too many moving pieces to be confident there are no bugs. If
92 // something goes wrong, the timer will ensure that a decision gets made 92 // something goes wrong, the timer will ensure that a decision gets made
93 // eventually, which is crucial to not block OOBE forever. See 93 // eventually, which is crucial to not block OOBE forever. See
94 // http://crbug.com/433634 for background. 94 // http://crbug.com/433634 for background.
95 base::Timer safeguard_timer_; 95 base::Timer safeguard_timer_;
96 96
97 base::WeakPtrFactory<AutoEnrollmentController> client_start_weak_factory_; 97 base::WeakPtrFactory<AutoEnrollmentController> client_start_weak_factory_;
98 98
99 DISALLOW_COPY_AND_ASSIGN(AutoEnrollmentController); 99 DISALLOW_COPY_AND_ASSIGN(AutoEnrollmentController);
100 }; 100 };
101 101
102 } // namespace chromeos 102 } // namespace chromeos
103 103
104 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CONTROLLER_H _ 104 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CONTROLLER_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698