OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 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_REMOTE_COMMANDS_DEVICE_COMMAND_SCREENSHOT
_JOB_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_REMOTE_COMMANDS_DEVICE_COMMAND_SCREENSHOT
_JOB_H_ |
6 #define CHROME_BROWSER_CHROMEOS_POLICY_REMOTE_COMMANDS_DEVICE_COMMAND_SCREENSHOT
_JOB_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_REMOTE_COMMANDS_DEVICE_COMMAND_SCREENSHOT
_JOB_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <list> | 10 #include <list> |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 void OnFailure(UploadJob::ErrorCode error_code) override; | 103 void OnFailure(UploadJob::ErrorCode error_code) override; |
104 | 104 |
105 // RemoteCommandJob: | 105 // RemoteCommandJob: |
106 bool IsExpired(base::TimeTicks now) override; | 106 bool IsExpired(base::TimeTicks now) override; |
107 bool ParseCommandPayload(const std::string& command_payload) override; | 107 bool ParseCommandPayload(const std::string& command_payload) override; |
108 void RunImpl(const CallbackWithResult& succeeded_callback, | 108 void RunImpl(const CallbackWithResult& succeeded_callback, |
109 const CallbackWithResult& failed_callback) override; | 109 const CallbackWithResult& failed_callback) override; |
110 void TerminateImpl() override; | 110 void TerminateImpl() override; |
111 | 111 |
112 void StoreScreenshot(size_t screen, | 112 void StoreScreenshot(size_t screen, |
113 scoped_refptr<base::RefCountedBytes> png_data); | 113 scoped_refptr<base::RefCountedMemory> png_data); |
114 | 114 |
115 void StartScreenshotUpload(); | 115 void StartScreenshotUpload(); |
116 | 116 |
117 // The URL to which the POST request should be directed. | 117 // The URL to which the POST request should be directed. |
118 GURL upload_url_; | 118 GURL upload_url_; |
119 | 119 |
120 // The callback that will be called when the screenshot was successfully | 120 // The callback that will be called when the screenshot was successfully |
121 // uploaded. | 121 // uploaded. |
122 CallbackWithResult succeeded_callback_; | 122 CallbackWithResult succeeded_callback_; |
123 | 123 |
124 // The callback that will be called when this command failed. | 124 // The callback that will be called when this command failed. |
125 CallbackWithResult failed_callback_; | 125 CallbackWithResult failed_callback_; |
126 | 126 |
127 // Tracks the number of pending screenshots. | 127 // Tracks the number of pending screenshots. |
128 int num_pending_screenshots_; | 128 int num_pending_screenshots_; |
129 | 129 |
130 // Caches the already completed screenshots for the different displays. | 130 // Caches the already completed screenshots for the different displays. |
131 std::map<int, scoped_refptr<base::RefCountedBytes>> screenshots_; | 131 std::map<int, scoped_refptr<base::RefCountedMemory>> screenshots_; |
132 | 132 |
133 // The Delegate is used to acquire screenshots and create UploadJobs. | 133 // The Delegate is used to acquire screenshots and create UploadJobs. |
134 std::unique_ptr<Delegate> screenshot_delegate_; | 134 std::unique_ptr<Delegate> screenshot_delegate_; |
135 | 135 |
136 // The upload job instance that will upload the screenshots. | 136 // The upload job instance that will upload the screenshots. |
137 std::unique_ptr<UploadJob> upload_job_; | 137 std::unique_ptr<UploadJob> upload_job_; |
138 | 138 |
139 base::WeakPtrFactory<DeviceCommandScreenshotJob> weak_ptr_factory_; | 139 base::WeakPtrFactory<DeviceCommandScreenshotJob> weak_ptr_factory_; |
140 | 140 |
141 DISALLOW_COPY_AND_ASSIGN(DeviceCommandScreenshotJob); | 141 DISALLOW_COPY_AND_ASSIGN(DeviceCommandScreenshotJob); |
142 }; | 142 }; |
143 | 143 |
144 } // namespace policy | 144 } // namespace policy |
145 | 145 |
146 #endif // CHROME_BROWSER_CHROMEOS_POLICY_REMOTE_COMMANDS_DEVICE_COMMAND_SCREENS
HOT_JOB_H_ | 146 #endif // CHROME_BROWSER_CHROMEOS_POLICY_REMOTE_COMMANDS_DEVICE_COMMAND_SCREENS
HOT_JOB_H_ |
OLD | NEW |