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

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

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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_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>
11 #include <map> 11 #include <map>
12 #include <memory>
12 #include <string> 13 #include <string>
13 14
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
16 #include "base/memory/ref_counted_memory.h" 17 #include "base/memory/ref_counted_memory.h"
17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/task_runner.h" 19 #include "base/task_runner.h"
20 #include "base/timer/timer.h" 20 #include "base/timer/timer.h"
21 #include "chrome/browser/chromeos/policy/upload_job.h" 21 #include "chrome/browser/chromeos/policy/upload_job.h"
22 #include "components/policy/core/common/remote_commands/remote_command_job.h" 22 #include "components/policy/core/common/remote_commands/remote_command_job.h"
23 #include "google_apis/gaia/oauth2_token_service.h" 23 #include "google_apis/gaia/oauth2_token_service.h"
24 #include "net/url_request/url_request_context_getter.h" 24 #include "net/url_request/url_request_context_getter.h"
25 #include "ui/snapshot/snapshot.h" 25 #include "ui/snapshot/snapshot.h"
26 #include "url/gurl.h" 26 #include "url/gurl.h"
27 27
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // Acquires a snapshot of |source_rect| in |window| and invokes |callback| 76 // Acquires a snapshot of |source_rect| in |window| and invokes |callback|
77 // with the PNG data. The passed-in callback will not be invoked after the 77 // with the PNG data. The passed-in callback will not be invoked after the
78 // delegate has been destroyed. See e.g. ScreenshotDelegate. 78 // delegate has been destroyed. See e.g. ScreenshotDelegate.
79 virtual void TakeSnapshot( 79 virtual void TakeSnapshot(
80 gfx::NativeWindow window, 80 gfx::NativeWindow window,
81 const gfx::Rect& source_rect, 81 const gfx::Rect& source_rect,
82 const ui::GrabWindowSnapshotAsyncPNGCallback& callback) = 0; 82 const ui::GrabWindowSnapshotAsyncPNGCallback& callback) = 0;
83 83
84 // Creates a new fully configured instance of an UploadJob. This method 84 // Creates a new fully configured instance of an UploadJob. This method
85 // may be called any number of times. 85 // may be called any number of times.
86 virtual scoped_ptr<UploadJob> CreateUploadJob(const GURL&, 86 virtual std::unique_ptr<UploadJob> CreateUploadJob(
87 UploadJob::Delegate*) = 0; 87 const GURL&,
88 UploadJob::Delegate*) = 0;
88 }; 89 };
89 90
90 explicit DeviceCommandScreenshotJob(scoped_ptr<Delegate> screenshot_delegate); 91 explicit DeviceCommandScreenshotJob(
92 std::unique_ptr<Delegate> screenshot_delegate);
91 ~DeviceCommandScreenshotJob() override; 93 ~DeviceCommandScreenshotJob() override;
92 94
93 // RemoteCommandJob: 95 // RemoteCommandJob:
94 enterprise_management::RemoteCommand_Type GetType() const override; 96 enterprise_management::RemoteCommand_Type GetType() const override;
95 97
96 private: 98 private:
97 class Payload; 99 class Payload;
98 100
99 // UploadJob::Delegate: 101 // UploadJob::Delegate:
100 void OnSuccess() override; 102 void OnSuccess() override;
(...skipping 21 matching lines...) Expand all
122 // The callback that will be called when this command failed. 124 // The callback that will be called when this command failed.
123 CallbackWithResult failed_callback_; 125 CallbackWithResult failed_callback_;
124 126
125 // Tracks the number of pending screenshots. 127 // Tracks the number of pending screenshots.
126 int num_pending_screenshots_; 128 int num_pending_screenshots_;
127 129
128 // Caches the already completed screenshots for the different displays. 130 // Caches the already completed screenshots for the different displays.
129 std::map<int, scoped_refptr<base::RefCountedBytes>> screenshots_; 131 std::map<int, scoped_refptr<base::RefCountedBytes>> screenshots_;
130 132
131 // The Delegate is used to acquire screenshots and create UploadJobs. 133 // The Delegate is used to acquire screenshots and create UploadJobs.
132 scoped_ptr<Delegate> screenshot_delegate_; 134 std::unique_ptr<Delegate> screenshot_delegate_;
133 135
134 // The upload job instance that will upload the screenshots. 136 // The upload job instance that will upload the screenshots.
135 scoped_ptr<UploadJob> upload_job_; 137 std::unique_ptr<UploadJob> upload_job_;
136 138
137 base::WeakPtrFactory<DeviceCommandScreenshotJob> weak_ptr_factory_; 139 base::WeakPtrFactory<DeviceCommandScreenshotJob> weak_ptr_factory_;
138 140
139 DISALLOW_COPY_AND_ASSIGN(DeviceCommandScreenshotJob); 141 DISALLOW_COPY_AND_ASSIGN(DeviceCommandScreenshotJob);
140 }; 142 };
141 143
142 } // namespace policy 144 } // namespace policy
143 145
144 #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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698