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 #include "chrome/browser/chromeos/policy/remote_commands/screenshot_delegate.h" | 5 #include "chrome/browser/chromeos/policy/remote_commands/screenshot_delegate.h" |
6 | 6 |
| 7 #include "base/chromeos/logging.h" |
7 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
8 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
9 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 11 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
11 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | 12 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
12 #include "chrome/browser/chromeos/policy/status_uploader.h" | 13 #include "chrome/browser/chromeos/policy/status_uploader.h" |
13 #include "chrome/browser/chromeos/policy/upload_job_impl.h" | 14 #include "chrome/browser/chromeos/policy/upload_job_impl.h" |
14 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" | 15 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" |
15 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" | 16 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" |
16 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 std::unique_ptr<UploadJob> ScreenshotDelegate::CreateUploadJob( | 51 std::unique_ptr<UploadJob> ScreenshotDelegate::CreateUploadJob( |
51 const GURL& upload_url, | 52 const GURL& upload_url, |
52 UploadJob::Delegate* delegate) { | 53 UploadJob::Delegate* delegate) { |
53 chromeos::DeviceOAuth2TokenService* device_oauth2_token_service = | 54 chromeos::DeviceOAuth2TokenService* device_oauth2_token_service = |
54 chromeos::DeviceOAuth2TokenServiceFactory::Get(); | 55 chromeos::DeviceOAuth2TokenServiceFactory::Get(); |
55 | 56 |
56 scoped_refptr<net::URLRequestContextGetter> system_request_context = | 57 scoped_refptr<net::URLRequestContextGetter> system_request_context = |
57 g_browser_process->system_request_context(); | 58 g_browser_process->system_request_context(); |
58 std::string robot_account_id = | 59 std::string robot_account_id = |
59 device_oauth2_token_service->GetRobotAccountId(); | 60 device_oauth2_token_service->GetRobotAccountId(); |
| 61 |
| 62 CHROMEOS_SYSLOG(WARNING) << "Creating upload job for screenshot"; |
60 return std::unique_ptr<UploadJob>(new UploadJobImpl( | 63 return std::unique_ptr<UploadJob>(new UploadJobImpl( |
61 upload_url, robot_account_id, device_oauth2_token_service, | 64 upload_url, robot_account_id, device_oauth2_token_service, |
62 system_request_context, delegate, | 65 system_request_context, delegate, |
63 base::WrapUnique(new UploadJobImpl::RandomMimeBoundaryGenerator), | 66 base::WrapUnique(new UploadJobImpl::RandomMimeBoundaryGenerator), |
64 base::ThreadTaskRunnerHandle::Get())); | 67 base::ThreadTaskRunnerHandle::Get())); |
65 } | 68 } |
66 | 69 |
67 void ScreenshotDelegate::StoreScreenshot( | 70 void ScreenshotDelegate::StoreScreenshot( |
68 const ui::GrabWindowSnapshotAsyncPNGCallback& callback, | 71 const ui::GrabWindowSnapshotAsyncPNGCallback& callback, |
69 scoped_refptr<base::RefCountedBytes> png_data) { | 72 scoped_refptr<base::RefCountedBytes> png_data) { |
70 callback.Run(png_data); | 73 callback.Run(png_data); |
71 } | 74 } |
72 | 75 |
73 } // namespace policy | 76 } // namespace policy |
OLD | NEW |