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

Side by Side Diff: chrome/browser/policy/device_token_fetcher.h

Issue 6537020: Update policy backend and testserver for the newest policy protocol (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more last minute changes Created 9 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_POLICY_DEVICE_TOKEN_FETCHER_H_ 5 #ifndef CHROME_BROWSER_POLICY_DEVICE_TOKEN_FETCHER_H_
6 #define CHROME_BROWSER_POLICY_DEVICE_TOKEN_FETCHER_H_ 6 #define CHROME_BROWSER_POLICY_DEVICE_TOKEN_FETCHER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/observer_list.h" 11 #include "base/observer_list.h"
12 #include "base/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
13 #include "base/task.h" 13 #include "base/task.h"
14 #include "chrome/browser/policy/device_management_backend.h" 14 #include "chrome/browser/policy/device_management_backend.h"
15 #include "chrome/browser/policy/proto/device_management_backend.pb.h"
15 16
16 namespace policy { 17 namespace policy {
17 18
18 class CloudPolicyCache; 19 class CloudPolicyCache;
19 class DeviceManagementService; 20 class DeviceManagementService;
20 21
21 namespace em = enterprise_management; 22 namespace em = enterprise_management;
22 23
23 // Fetches the device token that can be used for policy requests with the device 24 // Fetches the device token that can be used for policy requests with the device
24 // management server, either from disk if it already has been successfully 25 // management server, either from disk if it already has been successfully
(...skipping 16 matching lines...) Expand all
41 // Version for tests that allows to set timing paramters. 42 // Version for tests that allows to set timing paramters.
42 DeviceTokenFetcher(DeviceManagementService* service, 43 DeviceTokenFetcher(DeviceManagementService* service,
43 CloudPolicyCache* cache, 44 CloudPolicyCache* cache,
44 int64 token_fetch_error_delay_ms, 45 int64 token_fetch_error_delay_ms,
45 int64 unmanaged_device_refresh_rate_ms); 46 int64 unmanaged_device_refresh_rate_ms);
46 virtual ~DeviceTokenFetcher(); 47 virtual ~DeviceTokenFetcher();
47 48
48 // Starts fetching a token. 49 // Starts fetching a token.
49 // Declared virtual so it can be overridden by mocks. 50 // Declared virtual so it can be overridden by mocks.
50 virtual void FetchToken(const std::string& auth_token, 51 virtual void FetchToken(const std::string& auth_token,
51 const std::string& device_id); 52 const std::string& device_id,
53 em::DeviceRegisterRequest_Type policy_type,
54 const std::string& machine_id);
52 55
53 // Returns the device management token or the empty string if not available. 56 // Returns the device management token or the empty string if not available.
54 // Declared virtual so it can be overridden by mocks. 57 // Declared virtual so it can be overridden by mocks.
55 virtual const std::string& GetDeviceToken(); 58 virtual const std::string& GetDeviceToken();
56 59
57 void AddObserver(Observer* observer); 60 void AddObserver(Observer* observer);
58 void RemoveObserver(Observer* observer); 61 void RemoveObserver(Observer* observer);
59 62
60 // DeviceManagementBackend::DeviceRegisterResponseDelegate method overrides: 63 // DeviceManagementBackend::DeviceRegisterResponseDelegate method overrides:
61 virtual void HandleRegisterResponse( 64 virtual void HandleRegisterResponse(
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // State the fetcher is currently in. 121 // State the fetcher is currently in.
119 FetcherState state_; 122 FetcherState state_;
120 123
121 // Current device token. 124 // Current device token.
122 std::string device_token_; 125 std::string device_token_;
123 126
124 // Contains the AuthToken for the device management server. 127 // Contains the AuthToken for the device management server.
125 std::string auth_token_; 128 std::string auth_token_;
126 // Device identifier to send to the server. 129 // Device identifier to send to the server.
127 std::string device_id_; 130 std::string device_id_;
131 // Contains policy type to send to the server.
132 em::DeviceRegisterRequest_Type policy_type_;
133 // Contains physical machine id to send to the server.
134 std::string machine_id_;
128 135
129 // Task that has been scheduled to retry fetching a token. 136 // Task that has been scheduled to retry fetching a token.
130 CancelableTask* retry_task_; 137 CancelableTask* retry_task_;
131 138
132 ScopedRunnableMethodFactory<DeviceTokenFetcher> method_factory_; 139 ScopedRunnableMethodFactory<DeviceTokenFetcher> method_factory_;
133 140
134 ObserverList<Observer, true> observer_list_; 141 ObserverList<Observer, true> observer_list_;
135 }; 142 };
136 143
137 } // namespace policy 144 } // namespace policy
138 145
139 #endif // CHROME_BROWSER_POLICY_DEVICE_TOKEN_FETCHER_H_ 146 #endif // CHROME_BROWSER_POLICY_DEVICE_TOKEN_FETCHER_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/device_policy_identity_strategy.cc ('k') | chrome/browser/policy/device_token_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698