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

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

Issue 2705213002: Show different error message if ARC is disabled. (Closed)
Patch Set: Fix browsertests and add a new test for 904 Arc Disabled Created 3 years, 10 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 2016 The Chromium Authors. All rights reserved. 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 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_ARC_AUTH_ARC_AUTH_INFO_FETCHER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_AUTH_INFO_FETCHER_H_
6 #define CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_AUTH_INFO_FETCHER_H_ 6 #define CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_AUTH_INFO_FETCHER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 11
12 namespace arc { 12 namespace arc {
13 13
14 enum class ArcAuthInfoFetchStatus {
15 SUCCESS, // The fetch was successful.
16 FAILURE, // The request failed.
17 ARC_DISABLED, // ARC is not enabled.
18 SIZE, // The size of this enum; keep last.
Luis Héctor Chávez 2017/02/21 19:32:11 Do you *need* the SIZE? Seems like you're only usi
Marton Hunyady 2017/02/22 16:07:54 Done. (This also means I can't forward declare it
19 };
20
14 // Interface to implement auth_code or enrollment token fetching. 21 // Interface to implement auth_code or enrollment token fetching.
15 class ArcAuthInfoFetcher { 22 class ArcAuthInfoFetcher {
16 public: 23 public:
17 virtual ~ArcAuthInfoFetcher() = default; 24 virtual ~ArcAuthInfoFetcher() = default;
18 25
19 // Fetches the auth code or the enrollment token. On success, |callback| is 26 // Fetches the auth code or the enrollment token.
20 // called with the fetched |auth_info|. Otherwise, |callback| is called with 27 // On success, |callback| is called with status = SUCCESS and with the fetched
Luis Héctor Chávez 2017/02/21 19:32:11 nit: "|status|". Same below.
Marton Hunyady 2017/02/22 16:07:54 Done.
21 // empty string. 28 // |auth_info|. Otherwise, status contains the reason of the failure.
22 // Fetch() should be called once per instance, and it is expected that 29 // Fetch() should be called once per instance, and it is expected that
23 // the inflight operation is cancelled without calling the |callback| 30 // the inflight operation is cancelled without calling the |callback|
24 // when the instance is deleted. 31 // when the instance is deleted.
25 using FetchCallback = base::Callback<void(const std::string& auth_info)>; 32 using FetchCallback = base::Callback<void(ArcAuthInfoFetchStatus status,
33 const std::string& auth_info)>;
26 virtual void Fetch(const FetchCallback& callback) = 0; 34 virtual void Fetch(const FetchCallback& callback) = 0;
27 }; 35 };
28 36
29 } // namespace arc 37 } // namespace arc
30 38
31 #endif // CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_AUTH_INFO_FETCHER_H_ 39 #endif // CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_AUTH_INFO_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698