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

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

Issue 2765463002: Remote fetch device status (attributes and logs) command (Closed)
Patch Set: Addressed Drew's comments, treating StatusUploader and SystemLogUploader as one Created 3 years, 9 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
OLDNEW
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
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 10 matching lines...) Expand all
100 102
101 // The time the last upload was performed. 103 // The time the last upload was performed.
102 base::Time last_upload_; 104 base::Time last_upload_;
103 105
104 // Callback invoked via a delay to upload device status. 106 // Callback invoked via a delay to upload device status.
105 base::CancelableClosure upload_callback_; 107 base::CancelableClosure upload_callback_;
106 108
107 // True if there has been any captured media in this session. 109 // True if there has been any captured media in this session.
108 bool has_captured_media_; 110 bool has_captured_media_;
109 111
112 // Used to prevent a race condition where two status uploads are being
113 // executed in parallel.
114 bool status_upload_in_progress_ = false;
115
110 // Note: This should remain the last member so it'll be destroyed and 116 // Note: This should remain the last member so it'll be destroyed and
111 // invalidate the weak pointers before any other members are destroyed. 117 // invalidate the weak pointers before any other members are destroyed.
112 base::WeakPtrFactory<StatusUploader> weak_factory_; 118 base::WeakPtrFactory<StatusUploader> weak_factory_;
113 119
114 DISALLOW_COPY_AND_ASSIGN(StatusUploader); 120 DISALLOW_COPY_AND_ASSIGN(StatusUploader);
115 }; 121 };
116 122
117 } // namespace policy 123 } // namespace policy
118 124
119 #endif // CHROME_BROWSER_CHROMEOS_POLICY_STATUS_UPLOADER_H_ 125 #endif // CHROME_BROWSER_CHROMEOS_POLICY_STATUS_UPLOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698