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

Side by Side Diff: chrome/browser/chromeos/arc/auth/arc_robot_auth.h

Issue 2547073002: Fix race issue in ArcAuthService. (Closed)
Patch Set: Address comments Created 4 years 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_ROBOT_AUTH_H_
6 #define CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_ROBOT_AUTH_H_
7
8 #include <memory>
9
10 #include "base/callback.h"
11 #include "base/macros.h"
12 #include "components/policy/core/common/cloud/device_management_service.h"
13
14 namespace arc {
15
16 // This class is responsible to fetch auth code for robot account. Robot auth
17 // code is used for creation an account on Android side in ARC kiosk mode.
18 class ArcRobotAuth {
19 public:
20 using RobotAuthCodeCallback = base::Callback<void(const std::string&)>;
21 ArcRobotAuth();
22 ~ArcRobotAuth();
23
24 // Fetches robot auth code. When auth code is fetched, the callback is
25 // invoked. Invoking callback with empty string means a fetch error.
26 // FetchRobotAuthCode() should not be called while another inflight operation
27 // is running.
28 void FetchRobotAuthCode(const RobotAuthCodeCallback& callback);
29
30 private:
31 void OnFetchRobotAuthCodeCompleted(
32 RobotAuthCodeCallback callback,
33 policy::DeviceManagementStatus status,
34 int net_error,
35 const enterprise_management::DeviceManagementResponse& response);
36
37 std::unique_ptr<policy::DeviceManagementRequestJob> fetch_request_job_;
38 base::WeakPtrFactory<ArcRobotAuth> weak_ptr_factory_;
39
40 DISALLOW_COPY_AND_ASSIGN(ArcRobotAuth);
41 };
42
43 } // namespace arc
44
45 #endif // CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_ROBOT_AUTH_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/arc/auth/arc_manual_auth_code_fetcher.cc ('k') | chrome/browser/chromeos/arc/auth/arc_robot_auth.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698