| 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/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 | 8 |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 private: | 75 private: |
| 76 std::string payload_; | 76 std::string payload_; |
| 77 | 77 |
| 78 DISALLOW_COPY_AND_ASSIGN(Payload); | 78 DISALLOW_COPY_AND_ASSIGN(Payload); |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 DeviceCommandScreenshotJob::Payload::Payload(ResultCode result_code) { | 81 DeviceCommandScreenshotJob::Payload::Payload(ResultCode result_code) { |
| 82 base::DictionaryValue root_dict; | 82 base::DictionaryValue root_dict; |
| 83 if (result_code != SUCCESS) | 83 if (result_code != SUCCESS) |
| 84 root_dict.Set(kResultFieldName, new base::FundamentalValue(result_code)); | 84 root_dict.SetInteger(kResultFieldName, result_code); |
| 85 base::JSONWriter::Write(&root_dict, &payload_); | 85 base::JSONWriter::Write(root_dict, &payload_); |
| 86 } | 86 } |
| 87 | 87 |
| 88 scoped_ptr<std::string> DeviceCommandScreenshotJob::Payload::Serialize() { | 88 scoped_ptr<std::string> DeviceCommandScreenshotJob::Payload::Serialize() { |
| 89 return make_scoped_ptr(new std::string(payload_)); | 89 return make_scoped_ptr(new std::string(payload_)); |
| 90 } | 90 } |
| 91 | 91 |
| 92 DeviceCommandScreenshotJob::DeviceCommandScreenshotJob( | 92 DeviceCommandScreenshotJob::DeviceCommandScreenshotJob( |
| 93 scoped_ptr<Delegate> screenshot_delegate) | 93 scoped_ptr<Delegate> screenshot_delegate) |
| 94 : num_pending_screenshots_(0), | 94 : num_pending_screenshots_(0), |
| 95 screenshot_delegate_(screenshot_delegate.Pass()), | 95 screenshot_delegate_(screenshot_delegate.Pass()), |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 weak_ptr_factory_.GetWeakPtr(), screen), | 226 weak_ptr_factory_.GetWeakPtr(), screen), |
| 227 base::ThreadTaskRunnerHandle::Get())); | 227 base::ThreadTaskRunnerHandle::Get())); |
| 228 } | 228 } |
| 229 } | 229 } |
| 230 | 230 |
| 231 void DeviceCommandScreenshotJob::TerminateImpl() { | 231 void DeviceCommandScreenshotJob::TerminateImpl() { |
| 232 weak_ptr_factory_.InvalidateWeakPtrs(); | 232 weak_ptr_factory_.InvalidateWeakPtrs(); |
| 233 } | 233 } |
| 234 | 234 |
| 235 } // namespace policy | 235 } // namespace policy |
| OLD | NEW |