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

Unified Diff: chrome/browser/policy/cloud/user_policy_signin_service_mobile.h

Issue 264043008: Reuse one UserPolicySigninService for Android and iOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix android build Created 6 years, 7 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: chrome/browser/policy/cloud/user_policy_signin_service_mobile.h
diff --git a/chrome/browser/policy/cloud/user_policy_signin_service_android.h b/chrome/browser/policy/cloud/user_policy_signin_service_mobile.h
similarity index 66%
rename from chrome/browser/policy/cloud/user_policy_signin_service_android.h
rename to chrome/browser/policy/cloud/user_policy_signin_service_mobile.h
index 7242f1b1c9cf9390c7ea8465d7a1a7bc5d8cc6f2..7fc5ba6d0fb8606821710182b9a0bb757e56a13c 100644
--- a/chrome/browser/policy/cloud/user_policy_signin_service_android.h
+++ b/chrome/browser/policy/cloud/user_policy_signin_service_mobile.h
@@ -1,11 +1,12 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2014 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 CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_ANDROID_H_
-#define CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_ANDROID_H_
+#ifndef CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_MOBILE_H_
+#define CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_MOBILE_H_
#include <string>
+#include <vector>
#include "base/basictypes.h"
#include "base/compiler_specific.h"
@@ -25,7 +26,8 @@ namespace policy {
class CloudPolicyClientRegistrationHelper;
-// A specialization of the UserPolicySigninServiceBase for Android.
+// A specialization of the UserPolicySigninServiceBase for the mobile platforms
+// (currently Android and iOS).
class UserPolicySigninService : public UserPolicySigninServiceBase {
public:
// Creates a UserPolicySigninService associated with the passed |profile|.
@@ -47,7 +49,27 @@ class UserPolicySigninService : public UserPolicySigninServiceBase {
void RegisterForPolicy(const std::string& username,
const PolicyRegistrationCallback& callback);
+#if !defined(OS_ANDROID)
+ // Registers a CloudPolicyClient for fetching policy for |username|.
+ // This requires a valid OAuth access token for the scopes returned by the
+ // |GetScopes| static function. |callback| is invoked once we have
+ // registered this device to fetch policy, or once it is determined that
+ // |username| is not a managed account.
+ void RegisterForPolicyWithAccessToken(
+ const std::string& username,
+ const std::string& access_token,
+ const PolicyRegistrationCallback& callback);
+
+ // Returns the list of OAuth access scopes required for policy fetching.
+ static std::vector<std::string> GetScopes();
+#endif
+
private:
+ void RegisterForPolicyInternal(
+ const std::string& username,
+ const std::string& access_token,
+ const PolicyRegistrationCallback& callback);
+
void CallPolicyRegistrationCallback(scoped_ptr<CloudPolicyClient> client,
PolicyRegistrationCallback callback);
@@ -57,6 +79,10 @@ class UserPolicySigninService : public UserPolicySigninServiceBase {
// CloudPolicyService::Observer implementation:
virtual void OnInitializationCompleted(CloudPolicyService* service) OVERRIDE;
+ // Overridden from UserPolicySigninServiceBase to cancel the pending delayed
+ // registration.
+ virtual void ShutdownUserCloudPolicyManager() OVERRIDE;
+
// Registers for cloud policy for an already signed-in user.
void RegisterCloudPolicyService();
@@ -80,4 +106,4 @@ class UserPolicySigninService : public UserPolicySigninServiceBase {
} // namespace policy
-#endif // CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_ANDROID_H_
+#endif // CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_MOBILE_H_

Powered by Google App Engine
This is Rietveld 408576698