Chromium Code Reviews| 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 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_STATUS_UPLOADER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_STATUS_UPLOADER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_POLICY_STATUS_UPLOADER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_STATUS_UPLOADER_H_ |
| 7 | 7 |
| 8 #include "base/cancelable_callback.h" | 8 #include "base/cancelable_callback.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 static const int64 kDefaultUploadDelayMs; | 31 static const int64 kDefaultUploadDelayMs; |
| 32 | 32 |
| 33 // Constructor. |client| must be registered and must stay | 33 // Constructor. |client| must be registered and must stay |
| 34 // valid and registered through the lifetime of this StatusUploader | 34 // valid and registered through the lifetime of this StatusUploader |
| 35 // object. | 35 // object. |
| 36 StatusUploader( | 36 StatusUploader( |
| 37 CloudPolicyClient* client, | 37 CloudPolicyClient* client, |
| 38 scoped_ptr<DeviceStatusCollector> collector, | 38 scoped_ptr<DeviceStatusCollector> collector, |
| 39 const scoped_refptr<base::SequencedTaskRunner>& task_runner); | 39 const scoped_refptr<base::SequencedTaskRunner>& task_runner); |
| 40 | 40 |
| 41 ~StatusUploader(); | 41 virtual ~StatusUploader(); |
| 42 | 42 |
| 43 // Returns the time of the last successful upload, or Time(0) if no upload | 43 // Returns the time of the last successful upload, or Time(0) if no upload |
| 44 // has ever happened. | 44 // has ever happened. |
| 45 base::Time last_upload() const { return last_upload_; } | 45 base::Time last_upload() const { return last_upload_; } |
| 46 | 46 |
| 47 // Returns true if session data upload (screenshots, logs, etc) is allowed. | |
| 48 // This checks to ensure that the current session is a kiosk session, and | |
| 49 // that no user input (keyboard, mouse, touch, audio/video) has been received. | |
| 50 // Virtual to allow mocking in tests. | |
| 51 virtual bool IsSessionDataUploadAllowed(); | |
| 52 | |
| 53 protected: | |
| 54 // Empty constructor to be used when generating mocks. | |
| 55 StatusUploader(); | |
|
cschuet (SLOW)
2015/05/13 15:56:09
I see the necessity to introduce this empty constr
Andrew T Wilson (Slow)
2015/05/15 09:43:51
Removed. Thanks for the feedback - much cleaner no
| |
| 56 | |
| 47 private: | 57 private: |
| 48 // Callback invoked periodically to upload the device status from the | 58 // Callback invoked periodically to upload the device status from the |
| 49 // DeviceStatusCollector. | 59 // DeviceStatusCollector. |
| 50 void UploadStatus(); | 60 void UploadStatus(); |
| 51 | 61 |
| 52 // Invoked once a status upload has completed. | 62 // Invoked once a status upload has completed. |
| 53 void OnUploadCompleted(bool success); | 63 void OnUploadCompleted(bool success); |
| 54 | 64 |
| 55 // Helper method that figures out when the next status upload should | 65 // Helper method that figures out when the next status upload should |
| 56 // be scheduled. | 66 // be scheduled. |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 85 // Note: This should remain the last member so it'll be destroyed and | 95 // Note: This should remain the last member so it'll be destroyed and |
| 86 // invalidate the weak pointers before any other members are destroyed. | 96 // invalidate the weak pointers before any other members are destroyed. |
| 87 base::WeakPtrFactory<StatusUploader> weak_factory_; | 97 base::WeakPtrFactory<StatusUploader> weak_factory_; |
| 88 | 98 |
| 89 DISALLOW_COPY_AND_ASSIGN(StatusUploader); | 99 DISALLOW_COPY_AND_ASSIGN(StatusUploader); |
| 90 }; | 100 }; |
| 91 | 101 |
| 92 } // namespace policy | 102 } // namespace policy |
| 93 | 103 |
| 94 #endif // CHROME_BROWSER_CHROMEOS_POLICY_STATUS_UPLOADER_H_ | 104 #endif // CHROME_BROWSER_CHROMEOS_POLICY_STATUS_UPLOADER_H_ |
| OLD | NEW |