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

Side by Side Diff: chrome/browser/extensions/extension_function.cc

Issue 9590002: JSONWriter cleanup: integrate pretty print into write options. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge conflict 7. Created 8 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extensions/extension_function.h" 5 #include "chrome/browser/extensions/extension_function.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "chrome/browser/extensions/extension_function_dispatcher.h" 9 #include "chrome/browser/extensions/extension_function_dispatcher.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 void ExtensionFunction::SetArgs(const ListValue* args) { 88 void ExtensionFunction::SetArgs(const ListValue* args) {
89 DCHECK(!args_.get()); // Should only be called once. 89 DCHECK(!args_.get()); // Should only be called once.
90 args_.reset(args->DeepCopy()); 90 args_.reset(args->DeepCopy());
91 } 91 }
92 92
93 const std::string ExtensionFunction::GetResult() { 93 const std::string ExtensionFunction::GetResult() {
94 std::string json; 94 std::string json;
95 // Some functions might not need to return any results. 95 // Some functions might not need to return any results.
96 if (result_.get()) 96 if (result_.get())
97 base::JSONWriter::Write(result_.get(), false, &json); 97 base::JSONWriter::Write(result_.get(), &json);
98 return json; 98 return json;
99 } 99 }
100 100
101 Value* ExtensionFunction::GetResultValue() { 101 Value* ExtensionFunction::GetResultValue() {
102 return result_.get(); 102 return result_.get();
103 } 103 }
104 104
105 const std::string ExtensionFunction::GetError() { 105 const std::string ExtensionFunction::GetError() {
106 return error_; 106 return error_;
107 } 107 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 237
238 SyncIOThreadExtensionFunction::SyncIOThreadExtensionFunction() { 238 SyncIOThreadExtensionFunction::SyncIOThreadExtensionFunction() {
239 } 239 }
240 240
241 SyncIOThreadExtensionFunction::~SyncIOThreadExtensionFunction() { 241 SyncIOThreadExtensionFunction::~SyncIOThreadExtensionFunction() {
242 } 242 }
243 243
244 void SyncIOThreadExtensionFunction::Run() { 244 void SyncIOThreadExtensionFunction::Run() {
245 SendResponse(RunImpl()); 245 SendResponse(RunImpl());
246 } 246 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_devtools_bridge.cc ('k') | chrome/browser/extensions/extension_idle_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698