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

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

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 years, 7 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 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
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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 weak_ptr_factory_.GetWeakPtr(), screen), 234 weak_ptr_factory_.GetWeakPtr(), screen),
235 base::ThreadTaskRunnerHandle::Get())); 235 base::ThreadTaskRunnerHandle::Get()));
236 } 236 }
237 } 237 }
238 238
239 void DeviceCommandScreenshotJob::TerminateImpl() { 239 void DeviceCommandScreenshotJob::TerminateImpl() {
240 weak_ptr_factory_.InvalidateWeakPtrs(); 240 weak_ptr_factory_.InvalidateWeakPtrs();
241 } 241 }
242 242
243 } // namespace policy 243 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698