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

Side by Side Diff: chrome/browser/chromeos/policy/remote_commands/device_command_screenshot_job.cc

Issue 2592983002: [devtools] Support different encodings for Page.CaptureScreenshot. (Closed)
Patch Set: Encode in ui snapshot methods instead. Created 3 years, 11 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 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 #include "chrome/browser/chromeos/policy/remote_commands/device_command_screensh ot_job.h" 5 #include "chrome/browser/chromeos/policy/remote_commands/device_command_screensh ot_job.h"
6 6
7 #include <fstream> 7 #include <fstream>
8 #include <utility> 8 #include <utility>
9 9
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 const char* const kFileTypeHeaderName = "File-Type"; 51 const char* const kFileTypeHeaderName = "File-Type";
52 52
53 // String constant signalling that the data segment contains screenshots. 53 // String constant signalling that the data segment contains screenshots.
54 const char* const kFileTypeScreenshotFile = "screenshot_file"; 54 const char* const kFileTypeScreenshotFile = "screenshot_file";
55 55
56 // String constant identifying the upload url field in the command payload. 56 // String constant identifying the upload url field in the command payload.
57 const char* const kUploadUrlFieldName = "fileUploadUrl"; 57 const char* const kUploadUrlFieldName = "fileUploadUrl";
58 58
59 // A helper function which invokes |store_screenshot_callback| on |task_runner|. 59 // A helper function which invokes |store_screenshot_callback| on |task_runner|.
60 void RunStoreScreenshotOnTaskRunner( 60 void RunStoreScreenshotOnTaskRunner(
61 const ui::GrabWindowSnapshotAsyncPNGCallback& store_screenshot_callback, 61 const ui::GrabWindowSnapshotAsyncEncodedCallback& store_screenshot_callback,
62 scoped_refptr<base::TaskRunner> task_runner, 62 scoped_refptr<base::TaskRunner> task_runner,
63 scoped_refptr<base::RefCountedBytes> png_data) { 63 scoped_refptr<base::RefCountedBytes> png_data) {
64 task_runner->PostTask(FROM_HERE, 64 task_runner->PostTask(FROM_HERE,
65 base::Bind(store_screenshot_callback, png_data)); 65 base::Bind(store_screenshot_callback, png_data));
66 } 66 }
67 67
68 } // namespace 68 } // namespace
69 69
70 class DeviceCommandScreenshotJob::Payload 70 class DeviceCommandScreenshotJob::Payload
71 : public RemoteCommandJob::ResultPayload { 71 : public RemoteCommandJob::ResultPayload {
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 weak_ptr_factory_.GetWeakPtr(), screen), 241 weak_ptr_factory_.GetWeakPtr(), screen),
242 base::ThreadTaskRunnerHandle::Get())); 242 base::ThreadTaskRunnerHandle::Get()));
243 } 243 }
244 } 244 }
245 245
246 void DeviceCommandScreenshotJob::TerminateImpl() { 246 void DeviceCommandScreenshotJob::TerminateImpl() {
247 weak_ptr_factory_.InvalidateWeakPtrs(); 247 weak_ptr_factory_.InvalidateWeakPtrs();
248 } 248 }
249 249
250 } // namespace policy 250 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698