Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "extensions/browser/extension_function.h" | 5 #include "extensions/browser/extension_function.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/public/browser/notification_source.h" | 8 #include "content/public/browser/notification_source.h" |
| 9 #include "content/public/browser/notification_types.h" | 9 #include "content/public/browser/notification_types.h" |
| 10 #include "content/public/browser/render_frame_host.h" | 10 #include "content/public/browser/render_frame_host.h" |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 314 base::Value* value; | 314 base::Value* value; |
| 315 return args_->Get(index, &value) && !value->IsType(base::Value::TYPE_NULL); | 315 return args_->Get(index, &value) && !value->IsType(base::Value::TYPE_NULL); |
| 316 } | 316 } |
| 317 | 317 |
| 318 void ExtensionFunction::SendResponseImpl(bool success) { | 318 void ExtensionFunction::SendResponseImpl(bool success) { |
| 319 DCHECK(!response_callback_.is_null()); | 319 DCHECK(!response_callback_.is_null()); |
| 320 | 320 |
| 321 ResponseType type = success ? SUCCEEDED : FAILED; | 321 ResponseType type = success ? SUCCEEDED : FAILED; |
| 322 if (bad_message_) { | 322 if (bad_message_) { |
| 323 type = BAD_MESSAGE; | 323 type = BAD_MESSAGE; |
| 324 LOG(ERROR) << "Bad extension message " << name_; | |
|
tommycli
2014/08/19 16:36:03
Interesting... why?
Oren Blasberg
2014/08/20 22:59:37
Ugh. My bad, this was removed in error (i was debu
| |
| 325 } | 324 } |
| 326 | 325 |
| 327 // If results were never set, we send an empty argument list. | 326 // If results were never set, we send an empty argument list. |
| 328 if (!results_) | 327 if (!results_) |
| 329 results_.reset(new base::ListValue()); | 328 results_.reset(new base::ListValue()); |
| 330 | 329 |
| 331 response_callback_.Run(type, *results_, GetError()); | 330 response_callback_.Run(type, *results_, GetError()); |
| 332 } | 331 } |
| 333 | 332 |
| 334 void ExtensionFunction::OnRespondingLater(ResponseValue value) { | 333 void ExtensionFunction::OnRespondingLater(ResponseValue value) { |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 481 | 480 |
| 482 ExtensionFunction::ResponseAction SyncIOThreadExtensionFunction::Run() { | 481 ExtensionFunction::ResponseAction SyncIOThreadExtensionFunction::Run() { |
| 483 return RespondNow(RunSync() ? ArgumentList(results_.Pass()) : Error(error_)); | 482 return RespondNow(RunSync() ? ArgumentList(results_.Pass()) : Error(error_)); |
| 484 } | 483 } |
| 485 | 484 |
| 486 // static | 485 // static |
| 487 bool SyncIOThreadExtensionFunction::ValidationFailure( | 486 bool SyncIOThreadExtensionFunction::ValidationFailure( |
| 488 SyncIOThreadExtensionFunction* function) { | 487 SyncIOThreadExtensionFunction* function) { |
| 489 return false; | 488 return false; |
| 490 } | 489 } |
| OLD | NEW |