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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // This checks to ensure that the current session is a kiosk session, and | 52 // This checks to ensure that the current session is a kiosk session, and |
53 // that no user input (keyboard, mouse, touch, audio/video) has been received. | 53 // that no user input (keyboard, mouse, touch, audio/video) has been received. |
54 bool IsSessionDataUploadAllowed(); | 54 bool IsSessionDataUploadAllowed(); |
55 | 55 |
56 // MediaCaptureDevicesDispatcher::Observer implementation | 56 // MediaCaptureDevicesDispatcher::Observer implementation |
57 void OnRequestUpdate(int render_process_id, | 57 void OnRequestUpdate(int render_process_id, |
58 int render_frame_id, | 58 int render_frame_id, |
59 content::MediaStreamType stream_type, | 59 content::MediaStreamType stream_type, |
60 const content::MediaRequestState state) override; | 60 const content::MediaRequestState state) override; |
61 | 61 |
| 62 void ScheduleNextStatusUploadImmediately(); |
| 63 |
62 private: | 64 private: |
63 // Callback invoked periodically to upload the device status from the | 65 // Callback invoked periodically to upload the device status from the |
64 // DeviceStatusCollector. | 66 // DeviceStatusCollector. |
65 void UploadStatus(); | 67 void UploadStatus(); |
66 | 68 |
67 // Called asynchronously by DeviceStatusCollector when status arrives | 69 // Called asynchronously by DeviceStatusCollector when status arrives |
68 void OnStatusReceived( | 70 void OnStatusReceived( |
69 std::unique_ptr<enterprise_management::DeviceStatusReportRequest> | 71 std::unique_ptr<enterprise_management::DeviceStatusReportRequest> |
70 device_status, | 72 device_status, |
71 std::unique_ptr<enterprise_management::SessionStatusReportRequest> | 73 std::unique_ptr<enterprise_management::SessionStatusReportRequest> |
72 session_status); | 74 session_status); |
73 | 75 |
74 // Invoked once a status upload has completed. | 76 // Invoked once a status upload has completed. |
75 void OnUploadCompleted(bool success); | 77 void OnUploadCompleted(bool success); |
76 | 78 |
77 // Helper method that figures out when the next status upload should | 79 // Helper method that figures out when the next status upload should |
78 // be scheduled. | 80 // be scheduled. |
79 void ScheduleNextStatusUpload(); | 81 void ScheduleNextStatusUpload(bool immediately = false); |
80 | 82 |
81 // Updates the upload frequency from settings and schedules a new upload | 83 // Updates the upload frequency from settings and schedules a new upload |
82 // if appropriate. | 84 // if appropriate. |
83 void RefreshUploadFrequency(); | 85 void RefreshUploadFrequency(); |
84 | 86 |
85 // CloudPolicyClient used to issue requests to the server. | 87 // CloudPolicyClient used to issue requests to the server. |
86 CloudPolicyClient* client_; | 88 CloudPolicyClient* client_; |
87 | 89 |
88 // DeviceStatusCollector that provides status for uploading. | 90 // DeviceStatusCollector that provides status for uploading. |
89 std::unique_ptr<DeviceStatusCollector> collector_; | 91 std::unique_ptr<DeviceStatusCollector> collector_; |
(...skipping 20 matching lines...) Expand all Loading... |
110 // Note: This should remain the last member so it'll be destroyed and | 112 // Note: This should remain the last member so it'll be destroyed and |
111 // invalidate the weak pointers before any other members are destroyed. | 113 // invalidate the weak pointers before any other members are destroyed. |
112 base::WeakPtrFactory<StatusUploader> weak_factory_; | 114 base::WeakPtrFactory<StatusUploader> weak_factory_; |
113 | 115 |
114 DISALLOW_COPY_AND_ASSIGN(StatusUploader); | 116 DISALLOW_COPY_AND_ASSIGN(StatusUploader); |
115 }; | 117 }; |
116 | 118 |
117 } // namespace policy | 119 } // namespace policy |
118 | 120 |
119 #endif // CHROME_BROWSER_CHROMEOS_POLICY_STATUS_UPLOADER_H_ | 121 #endif // CHROME_BROWSER_CHROMEOS_POLICY_STATUS_UPLOADER_H_ |
OLD | NEW |