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

Side by Side Diff: chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h

Issue 23450022: Put a hard limit on initial policy fetch wait time. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address nits, rebase. Created 7 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ 6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "base/timer/timer.h"
15 #include "chrome/browser/policy/cloud/cloud_policy_client.h" 16 #include "chrome/browser/policy/cloud/cloud_policy_client.h"
16 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" 17 #include "chrome/browser/policy/cloud/cloud_policy_constants.h"
17 #include "chrome/browser/policy/cloud/cloud_policy_manager.h" 18 #include "chrome/browser/policy/cloud/cloud_policy_manager.h"
18 #include "chrome/browser/policy/cloud/cloud_policy_service.h" 19 #include "chrome/browser/policy/cloud/cloud_policy_service.h"
19 #include "chrome/browser/policy/cloud/component_cloud_policy_service.h" 20 #include "chrome/browser/policy/cloud/component_cloud_policy_service.h"
20 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 21 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
21 22
22 class GoogleServiceAuthError; 23 class GoogleServiceAuthError;
23 class PrefService; 24 class PrefService;
24 25
(...skipping 14 matching lines...) Expand all
39 public CloudPolicyClient::Observer, 40 public CloudPolicyClient::Observer,
40 public CloudPolicyService::Observer, 41 public CloudPolicyService::Observer,
41 public ComponentCloudPolicyService::Delegate, 42 public ComponentCloudPolicyService::Delegate,
42 public BrowserContextKeyedService { 43 public BrowserContextKeyedService {
43 public: 44 public:
44 // If |wait_for_policy_fetch| is true, IsInitializationComplete() will return 45 // If |wait_for_policy_fetch| is true, IsInitializationComplete() will return
45 // false as long as there hasn't been a successful policy fetch. 46 // false as long as there hasn't been a successful policy fetch.
46 UserCloudPolicyManagerChromeOS( 47 UserCloudPolicyManagerChromeOS(
47 scoped_ptr<CloudPolicyStore> store, 48 scoped_ptr<CloudPolicyStore> store,
48 scoped_ptr<ResourceCache> resource_cache, 49 scoped_ptr<ResourceCache> resource_cache,
49 bool wait_for_policy_fetch); 50 bool wait_for_policy_fetch,
51 base::TimeDelta initial_policy_fetch_timeout);
50 virtual ~UserCloudPolicyManagerChromeOS(); 52 virtual ~UserCloudPolicyManagerChromeOS();
51 53
52 // Initializes the cloud connection. |local_state| and 54 // Initializes the cloud connection. |local_state| and
53 // |device_management_service| must stay valid until this object is deleted. 55 // |device_management_service| must stay valid until this object is deleted.
54 void Connect(PrefService* local_state, 56 void Connect(PrefService* local_state,
55 DeviceManagementService* device_management_service, 57 DeviceManagementService* device_management_service,
56 scoped_refptr<net::URLRequestContextGetter> request_context, 58 scoped_refptr<net::URLRequestContextGetter> request_context,
57 UserAffiliation user_affiliation); 59 UserAffiliation user_affiliation);
58 60
59 // This class is one of the policy providers, and must be ready for the 61 // This class is one of the policy providers, and must be ready for the
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 scoped_ptr<CloudPolicyStore> store_; 119 scoped_ptr<CloudPolicyStore> store_;
118 120
119 // Handles fetching and storing cloud policy for components. It uses the 121 // Handles fetching and storing cloud policy for components. It uses the
120 // |store_|, so destroy it first. 122 // |store_|, so destroy it first.
121 scoped_ptr<ComponentCloudPolicyService> component_policy_service_; 123 scoped_ptr<ComponentCloudPolicyService> component_policy_service_;
122 124
123 // Whether to wait for a policy fetch to complete before reporting 125 // Whether to wait for a policy fetch to complete before reporting
124 // IsInitializationComplete(). 126 // IsInitializationComplete().
125 bool wait_for_policy_fetch_; 127 bool wait_for_policy_fetch_;
126 128
129 // A timer that puts a hard limit on the maximum time to wait for the intial
130 // policy fetch.
131 base::Timer policy_fetch_timeout_;
132
127 // The pref service to pass to the refresh scheduler on initialization. 133 // The pref service to pass to the refresh scheduler on initialization.
128 PrefService* local_state_; 134 PrefService* local_state_;
129 135
130 // Used to fetch the policy OAuth token, when necessary. This object holds 136 // Used to fetch the policy OAuth token, when necessary. This object holds
131 // a callback with an unretained reference to the manager, when it exists. 137 // a callback with an unretained reference to the manager, when it exists.
132 scoped_ptr<PolicyOAuth2TokenFetcher> token_fetcher_; 138 scoped_ptr<PolicyOAuth2TokenFetcher> token_fetcher_;
133 139
134 // The access token passed to OnAccessTokenAvailable. It is stored here so 140 // The access token passed to OnAccessTokenAvailable. It is stored here so
135 // that it can be used if OnInitializationCompleted is called later. 141 // that it can be used if OnInitializationCompleted is called later.
136 std::string access_token_; 142 std::string access_token_;
137 143
138 // Timestamps for collecting timing UMA stats. 144 // Timestamps for collecting timing UMA stats.
139 base::Time time_init_started_; 145 base::Time time_init_started_;
140 base::Time time_init_completed_; 146 base::Time time_init_completed_;
141 base::Time time_token_available_; 147 base::Time time_token_available_;
142 base::Time time_client_registered_; 148 base::Time time_client_registered_;
143 149
144 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerChromeOS); 150 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerChromeOS);
145 }; 151 };
146 152
147 } // namespace policy 153 } // namespace policy
148 154
149 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ 155 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698