OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 #include "chrome/browser/chromeos/policy/status_uploader.h" | 5 #include "chrome/browser/chromeos/policy/status_uploader.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/sequenced_task_runner.h" | 12 #include "base/sequenced_task_runner.h" |
13 #include "chrome/browser/chromeos/policy/device_local_account.h" | 13 #include "chrome/browser/chromeos/policy/device_local_account.h" |
14 #include "chrome/browser/chromeos/policy/device_status_collector.h" | 14 #include "chrome/browser/chromeos/policy/device_status_collector.h" |
15 #include "chromeos/settings/cros_settings_names.h" | 15 #include "chromeos/settings/cros_settings_names.h" |
16 #include "chromeos/settings/cros_settings_provider.h" | 16 #include "chromeos/settings/cros_settings_provider.h" |
17 #include "components/policy/core/common/cloud/cloud_policy_client.h" | 17 #include "components/policy/core/common/cloud/cloud_policy_client.h" |
18 #include "components/policy/core/common/cloud/device_management_service.h" | 18 #include "components/policy/core/common/cloud/device_management_service.h" |
19 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
20 #include "content/public/browser/media_request_state.h" | 20 #include "content/public/browser/media_request_state.h" |
21 #include "content/public/common/media_stream_request.h" | 21 #include "content/public/common/media_stream_request.h" |
22 #include "ui/base/user_activity/user_activity_detector.h" | 22 #include "ui/base/user_activity/user_activity_detector.h" |
23 | 23 |
24 namespace { | 24 namespace { |
25 const int kMinUploadDelayMs = 60 * 1000; // 60 seconds | 25 const int kMinUploadDelayMs = 60 * 1000; // 60 seconds |
26 } // namespace | 26 } // namespace |
27 | 27 |
28 namespace policy { | 28 namespace policy { |
29 | 29 |
30 const int64 StatusUploader::kDefaultUploadDelayMs = | 30 const int64_t StatusUploader::kDefaultUploadDelayMs = |
31 3 * 60 * 60 * 1000; // 3 hours | 31 3 * 60 * 60 * 1000; // 3 hours |
32 | 32 |
33 StatusUploader::StatusUploader( | 33 StatusUploader::StatusUploader( |
34 CloudPolicyClient* client, | 34 CloudPolicyClient* client, |
35 scoped_ptr<DeviceStatusCollector> collector, | 35 scoped_ptr<DeviceStatusCollector> collector, |
36 const scoped_refptr<base::SequencedTaskRunner>& task_runner) | 36 const scoped_refptr<base::SequencedTaskRunner>& task_runner) |
37 : client_(client), | 37 : client_(client), |
38 collector_(collector.Pass()), | 38 collector_(collector.Pass()), |
39 task_runner_(task_runner), | 39 task_runner_(task_runner), |
40 upload_frequency_( | 40 upload_frequency_( |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 172 |
173 // If the upload was successful, tell the collector so it can clear its cache | 173 // If the upload was successful, tell the collector so it can clear its cache |
174 // of pending items. | 174 // of pending items. |
175 if (success) | 175 if (success) |
176 collector_->OnSubmittedSuccessfully(); | 176 collector_->OnSubmittedSuccessfully(); |
177 | 177 |
178 ScheduleNextStatusUpload(); | 178 ScheduleNextStatusUpload(); |
179 } | 179 } |
180 | 180 |
181 } // namespace policy | 181 } // namespace policy |
OLD | NEW |