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

Side by Side Diff: chrome/browser/chromeos/policy/remote_commands/screenshot_delegate.h

Issue 2592983002: [devtools] Support different encodings for Page.CaptureScreenshot. (Closed)
Patch Set: Disabled test on MacOS >=10.11, added ref to bug. Created 3 years, 10 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 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_REMOTE_COMMANDS_SCREENSHOT_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_REMOTE_COMMANDS_SCREENSHOT_DELEGATE_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_REMOTE_COMMANDS_SCREENSHOT_DELEGATE_H_ 6 #define CHROME_BROWSER_CHROMEOS_POLICY_REMOTE_COMMANDS_SCREENSHOT_DELEGATE_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/task_runner.h" 13 #include "base/task_runner.h"
14 #include "chrome/browser/chromeos/policy/remote_commands/device_command_screensh ot_job.h" 14 #include "chrome/browser/chromeos/policy/remote_commands/device_command_screensh ot_job.h"
15 #include "chrome/browser/chromeos/policy/upload_job.h" 15 #include "chrome/browser/chromeos/policy/upload_job.h"
16 #include "ui/gfx/geometry/rect.h" 16 #include "ui/gfx/geometry/rect.h"
17 #include "ui/gfx/native_widget_types.h" 17 #include "ui/gfx/native_widget_types.h"
18 #include "ui/snapshot/snapshot.h" 18 #include "ui/snapshot/snapshot.h"
19 #include "url/gurl.h" 19 #include "url/gurl.h"
20 20
21 namespace policy { 21 namespace policy {
22 22
23 // An implementation of the |DeviceCommandScreenshotJob::Delegate| that uses 23 // An implementation of the |DeviceCommandScreenshotJob::Delegate| that uses
24 // aura's GrabWindowSnapshotAsync() to acquire the window snapshot. 24 // aura's GrabWindowSnapshotAsyncPNG() to acquire the window snapshot.
25 class ScreenshotDelegate : public DeviceCommandScreenshotJob::Delegate { 25 class ScreenshotDelegate : public DeviceCommandScreenshotJob::Delegate {
26 public: 26 public:
27 explicit ScreenshotDelegate( 27 explicit ScreenshotDelegate(
28 scoped_refptr<base::TaskRunner> blocking_task_runner); 28 scoped_refptr<base::TaskRunner> blocking_task_runner);
29 ~ScreenshotDelegate() override; 29 ~ScreenshotDelegate() override;
30 30
31 // DeviceCommandScreenshotJob::Delegate: 31 // DeviceCommandScreenshotJob::Delegate:
32 bool IsScreenshotAllowed() override; 32 bool IsScreenshotAllowed() override;
33 void TakeSnapshot( 33 void TakeSnapshot(
34 gfx::NativeWindow window, 34 gfx::NativeWindow window,
35 const gfx::Rect& source_rect, 35 const gfx::Rect& source_rect,
36 const ui::GrabWindowSnapshotAsyncPNGCallback& callback) override; 36 const ui::GrabWindowSnapshotAsyncPNGCallback& callback) override;
37 std::unique_ptr<UploadJob> CreateUploadJob( 37 std::unique_ptr<UploadJob> CreateUploadJob(
38 const GURL& upload_url, 38 const GURL& upload_url,
39 UploadJob::Delegate* delegate) override; 39 UploadJob::Delegate* delegate) override;
40 40
41 private: 41 private:
42 void StoreScreenshot(const ui::GrabWindowSnapshotAsyncPNGCallback& callback, 42 void StoreScreenshot(const ui::GrabWindowSnapshotAsyncPNGCallback& callback,
43 scoped_refptr<base::RefCountedBytes> png_data); 43 scoped_refptr<base::RefCountedMemory> png_data);
44 44
45 scoped_refptr<base::TaskRunner> blocking_task_runner_; 45 scoped_refptr<base::TaskRunner> blocking_task_runner_;
46 46
47 base::WeakPtrFactory<ScreenshotDelegate> weak_ptr_factory_; 47 base::WeakPtrFactory<ScreenshotDelegate> weak_ptr_factory_;
48 48
49 DISALLOW_COPY_AND_ASSIGN(ScreenshotDelegate); 49 DISALLOW_COPY_AND_ASSIGN(ScreenshotDelegate);
50 }; 50 };
51 51
52 } // namespace policy 52 } // namespace policy
53 53
54 #endif // CHROME_BROWSER_CHROMEOS_POLICY_REMOTE_COMMANDS_SCREENSHOT_DELEGATE_H_ 54 #endif // CHROME_BROWSER_CHROMEOS_POLICY_REMOTE_COMMANDS_SCREENSHOT_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698