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

Unified Diff: components/arc/opt_in/arc_opt_in_manager.h

Issue 1618193003: arc: Pass auth token from Chrome to ARC instance. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor formating Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: components/arc/opt_in/arc_opt_in_manager.h
diff --git a/components/arc/opt_in/arc_opt_in_manager.h b/components/arc/opt_in/arc_opt_in_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..302e88526d016e3f091acc4b43940107d73840de
--- /dev/null
+++ b/components/arc/opt_in/arc_opt_in_manager.h
@@ -0,0 +1,58 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_ARC_OPT_IN_ARC_OPT_IN_MANAGER_H_
+#define COMPONENTS_ARC_OPT_IN_ARC_OPT_IN_MANAGER_H_
+
+#include <string>
+
+#include "base/macros.h"
+
+class Profile;
+
+namespace arc {
+
+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.
+ public:
+ enum class State {
+ DISABLE, // ARC is not allowed to run (default).
+ FETCHING_TOKEN, // ARC is allowed, receiving auth_2 token.
+ NO_TOKEN, // ARC is allowed, auth_2 token was not received.
+ ENABLE, // ARC is allowed, auth_2 token was received.
+ };
+
+ class Observer {
+ public:
+ // Called whenever Opt-In state of the ARC has been changed.
+ virtual void OnOptInChanged(State state) = 0;
+ };
+
+ virtual ~ArcOptInManager() {}
+
+ virtual void SetProfile(Profile* profile) = 0;
+
+ 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.
+
+ // Sets the auth token. Can be set from internally or from external component
+ // that accepts user's credentials. This actually starts ARC bridge service.
+ virtual void SetAuthTokenAndStartArc(const std::string auth_token) = 0;
+
+ // Returns the auth token. For security reason this token can be used only
+ // once and exists for specific period of time.
+ virtual std::string GetAuthToken() = 0;
+
+ // Adds or removes observers.
+ virtual void AddObserver(Observer* observer) = 0;
+ virtual void RemoveObserver(Observer* observer) = 0;
+
+ protected:
+ ArcOptInManager() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ArcOptInManager);
+};
+
+} // namespace arc
+
+#endif // COMPONENTS_ARC_OPT_IN_ARC_OPT_IN_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698