OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 COMPONENTS_QUIRKS_QUIRKS_MANAGER_H_ | 5 #ifndef COMPONENTS_QUIRKS_QUIRKS_MANAGER_H_ |
6 #define COMPONENTS_QUIRKS_QUIRKS_MANAGER_H_ | 6 #define COMPONENTS_QUIRKS_QUIRKS_MANAGER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 virtual std::string GetApiKey() const = 0; | 71 virtual std::string GetApiKey() const = 0; |
72 | 72 |
73 // Returns the read-only directory where icc files were added before the | 73 // Returns the read-only directory where icc files were added before the |
74 // Quirks Client provided them. | 74 // Quirks Client provided them. |
75 virtual base::FilePath GetBuiltInDisplayProfileDirectory() const = 0; | 75 virtual base::FilePath GetBuiltInDisplayProfileDirectory() const = 0; |
76 | 76 |
77 // Returns the path to the writable display profile directory. | 77 // Returns the path to the writable display profile directory. |
78 // This directory must already exist. | 78 // This directory must already exist. |
79 virtual base::FilePath GetDownloadDisplayProfileDirectory() const = 0; | 79 virtual base::FilePath GetDownloadDisplayProfileDirectory() const = 0; |
80 | 80 |
| 81 // Whether downloads are allowed by enterprise device policy. |
| 82 virtual bool DevicePolicyEnabled() const = 0; |
| 83 |
81 // Gets days since first login, returned via callback. | 84 // Gets days since first login, returned via callback. |
82 virtual void GetDaysSinceOobe(DaysSinceOobeCallback callback) const = 0; | 85 virtual void GetDaysSinceOobe(DaysSinceOobeCallback callback) const = 0; |
83 | 86 |
84 private: | 87 private: |
85 DISALLOW_ASSIGN(Delegate); | 88 DISALLOW_ASSIGN(Delegate); |
86 }; | 89 }; |
87 | 90 |
88 static void Initialize( | 91 static void Initialize( |
89 scoped_ptr<Delegate> delegate, | 92 scoped_ptr<Delegate> delegate, |
90 scoped_refptr<base::SequencedWorkerPool> blocking_pool, | 93 scoped_refptr<base::SequencedWorkerPool> blocking_pool, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 // Callback after checking OOBE date; launch client if appropriate. | 143 // Callback after checking OOBE date; launch client if appropriate. |
141 void OnDaysSinceOobeReceived( | 144 void OnDaysSinceOobeReceived( |
142 int64_t product_id, | 145 int64_t product_id, |
143 const RequestFinishedCallback& on_request_finished, | 146 const RequestFinishedCallback& on_request_finished, |
144 int days_since_oobe); | 147 int days_since_oobe); |
145 | 148 |
146 // Create and start a client to download file. | 149 // Create and start a client to download file. |
147 void CreateClient(int64_t product_id, | 150 void CreateClient(int64_t product_id, |
148 const RequestFinishedCallback& on_request_finished); | 151 const RequestFinishedCallback& on_request_finished); |
149 | 152 |
| 153 // Whether downloads allowed by cmd line flag and device policy. |
| 154 bool QuirksEnabled(); |
| 155 |
150 // Records time of most recent server check. | 156 // Records time of most recent server check. |
151 void SetLastServerCheck(int64_t product_id, const base::Time& last_check); | 157 void SetLastServerCheck(int64_t product_id, const base::Time& last_check); |
152 | 158 |
153 // Set of active clients, each created to download a different Quirks file. | 159 // Set of active clients, each created to download a different Quirks file. |
154 std::set<scoped_ptr<QuirksClient>> clients_; | 160 std::set<scoped_ptr<QuirksClient>> clients_; |
155 | 161 |
156 // Don't start downloads before first session login. | 162 // Don't start downloads before first session login. |
157 bool waiting_for_login_; | 163 bool waiting_for_login_; |
158 | 164 |
159 // Ensure this class runs on a single thread. | 165 // Ensure this class runs on a single thread. |
160 base::ThreadChecker thread_checker_; | 166 base::ThreadChecker thread_checker_; |
161 | 167 |
162 // These objects provide resources from the browser. | 168 // These objects provide resources from the browser. |
163 scoped_ptr<Delegate> delegate_; // Impl runs from chrome/browser. | 169 scoped_ptr<Delegate> delegate_; // Impl runs from chrome/browser. |
164 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; | 170 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; |
165 PrefService* local_state_; // For local prefs. | 171 PrefService* local_state_; // For local prefs. |
166 scoped_refptr<net::URLRequestContextGetter> url_context_getter_; | 172 scoped_refptr<net::URLRequestContextGetter> url_context_getter_; |
167 | 173 |
168 FakeQuirksFetcherCreator fake_quirks_fetcher_creator_; // For tests. | 174 FakeQuirksFetcherCreator fake_quirks_fetcher_creator_; // For tests. |
169 | 175 |
170 // Factory for callbacks. | 176 // Factory for callbacks. |
171 base::WeakPtrFactory<QuirksManager> weak_ptr_factory_; | 177 base::WeakPtrFactory<QuirksManager> weak_ptr_factory_; |
172 | 178 |
173 DISALLOW_COPY_AND_ASSIGN(QuirksManager); | 179 DISALLOW_COPY_AND_ASSIGN(QuirksManager); |
174 }; | 180 }; |
175 | 181 |
176 } // namespace quirks | 182 } // namespace quirks |
177 | 183 |
178 #endif // COMPONENTS_QUIRKS_QUIRKS_MANAGER_H_ | 184 #endif // COMPONENTS_QUIRKS_QUIRKS_MANAGER_H_ |
OLD | NEW |