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

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

Issue 16915006: Convert most of extensions and some other random stuff to using the base namespace for Values. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 void ExtensionFunction::SetArgs(const base::ListValue* args) { 81 void ExtensionFunction::SetArgs(const base::ListValue* args) {
82 DCHECK(!args_.get()); // Should only be called once. 82 DCHECK(!args_.get()); // Should only be called once.
83 args_.reset(args->DeepCopy()); 83 args_.reset(args->DeepCopy());
84 } 84 }
85 85
86 void ExtensionFunction::SetResult(base::Value* result) { 86 void ExtensionFunction::SetResult(base::Value* result) {
87 results_.reset(new base::ListValue()); 87 results_.reset(new base::ListValue());
88 results_->Append(result); 88 results_->Append(result);
89 } 89 }
90 90
91 const ListValue* ExtensionFunction::GetResultList() { 91 const base::ListValue* ExtensionFunction::GetResultList() {
92 return results_.get(); 92 return results_.get();
93 } 93 }
94 94
95 const std::string ExtensionFunction::GetError() { 95 const std::string ExtensionFunction::GetError() {
96 return error_; 96 return error_;
97 } 97 }
98 98
99 void ExtensionFunction::SetError(const std::string& error) { 99 void ExtensionFunction::SetError(const std::string& error) {
100 error_ = error; 100 error_ = error;
101 } 101 }
(...skipping 19 matching lines...) Expand all
121 DCHECK(!response_callback_.is_null()); 121 DCHECK(!response_callback_.is_null());
122 122
123 ResponseType type = success ? SUCCEEDED : FAILED; 123 ResponseType type = success ? SUCCEEDED : FAILED;
124 if (bad_message_) { 124 if (bad_message_) {
125 type = BAD_MESSAGE; 125 type = BAD_MESSAGE;
126 LOG(ERROR) << "Bad extension message " << name_; 126 LOG(ERROR) << "Bad extension message " << name_;
127 } 127 }
128 128
129 // If results were never set, we send an empty argument list. 129 // If results were never set, we send an empty argument list.
130 if (!results_) 130 if (!results_)
131 results_.reset(new ListValue()); 131 results_.reset(new base::ListValue());
132 132
133 response_callback_.Run(type, *results_, GetError()); 133 response_callback_.Run(type, *results_, GetError());
134 } 134 }
135 135
136 UIThreadExtensionFunction::UIThreadExtensionFunction() 136 UIThreadExtensionFunction::UIThreadExtensionFunction()
137 : render_view_host_(NULL), 137 : render_view_host_(NULL),
138 profile_(NULL), 138 profile_(NULL),
139 delegate_(NULL) { 139 delegate_(NULL) {
140 } 140 }
141 141
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 300
301 SyncIOThreadExtensionFunction::SyncIOThreadExtensionFunction() { 301 SyncIOThreadExtensionFunction::SyncIOThreadExtensionFunction() {
302 } 302 }
303 303
304 SyncIOThreadExtensionFunction::~SyncIOThreadExtensionFunction() { 304 SyncIOThreadExtensionFunction::~SyncIOThreadExtensionFunction() {
305 } 305 }
306 306
307 void SyncIOThreadExtensionFunction::Run() { 307 void SyncIOThreadExtensionFunction::Run() {
308 SendResponse(RunImpl()); 308 SendResponse(RunImpl());
309 } 309 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698