Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 COMPONENTS_ARC_OPT_IN_ARC_OPT_IN_MANAGER_H_ | |
| 6 #define COMPONENTS_ARC_OPT_IN_ARC_OPT_IN_MANAGER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 | |
| 12 class Profile; | |
| 13 | |
| 14 namespace arc { | |
| 15 | |
| 16 class ArcOptInManager { | |
|
lhc(google)
2016/01/22 22:18:33
The only implementation that exists is ArcOptInMan
khmel
2016/01/23 00:41:43
Done.
| |
| 17 public: | |
| 18 enum class State { | |
| 19 DISABLE, // ARC is not allowed to run (default). | |
| 20 FETCHING_TOKEN, // ARC is allowed, receiving auth_2 token. | |
| 21 NO_TOKEN, // ARC is allowed, auth_2 token was not received. | |
| 22 ENABLE, // ARC is allowed, auth_2 token was received. | |
| 23 }; | |
| 24 | |
| 25 class Observer { | |
| 26 public: | |
| 27 // Called whenever Opt-In state of the ARC has been changed. | |
| 28 virtual void OnOptInChanged(State state) = 0; | |
| 29 }; | |
| 30 | |
| 31 virtual ~ArcOptInManager() {} | |
| 32 | |
| 33 virtual void SetProfile(Profile* profile) = 0; | |
| 34 | |
| 35 virtual State state() const = 0; | |
|
lhc(google)
2016/01/22 22:18:33
Only inlined trivial functions can be lowercase. E
khmel
2016/01/23 00:41:43
Done.
| |
| 36 | |
| 37 // Sets the auth token. Can be set from internally or from external component | |
| 38 // that accepts user's credentials. This actually starts ARC bridge service. | |
| 39 virtual void SetAuthTokenAndStartArc(const std::string auth_token) = 0; | |
| 40 | |
| 41 // Returns the auth token. For security reason this token can be used only | |
| 42 // once and exists for specific period of time. | |
| 43 virtual std::string GetAuthToken() = 0; | |
| 44 | |
| 45 // Adds or removes observers. | |
| 46 virtual void AddObserver(Observer* observer) = 0; | |
| 47 virtual void RemoveObserver(Observer* observer) = 0; | |
| 48 | |
| 49 protected: | |
| 50 ArcOptInManager() {} | |
| 51 | |
| 52 private: | |
| 53 DISALLOW_COPY_AND_ASSIGN(ArcOptInManager); | |
| 54 }; | |
| 55 | |
| 56 } // namespace arc | |
| 57 | |
| 58 #endif // COMPONENTS_ARC_OPT_IN_ARC_OPT_IN_MANAGER_H_ | |
| OLD | NEW |