Chromium Code Reviews| Index: apps/shell/browser/api/shell/shell_api.cc |
| diff --git a/apps/shell/browser/api/shell/shell_api.cc b/apps/shell/browser/api/shell/shell_api.cc |
| index 929d1db531faecb63843cdd16b992a95fe3f3b51..72ca118fb5defa64c6c98aeeeec15e7457c3b353 100644 |
| --- a/apps/shell/browser/api/shell/shell_api.cc |
| +++ b/apps/shell/browser/api/shell/shell_api.cc |
| @@ -13,6 +13,8 @@ using base::DictionaryValue; |
| namespace apps { |
| namespace { |
| +const char kInvalidArguments[] = "Invalid arguments"; |
| + |
| // Creates a function call result to send to the renderer. |
| DictionaryValue* CreateResult(apps::ShellAppWindow* app_window) { |
| int view_id = app_window->GetRenderViewRoutingID(); |
| @@ -30,20 +32,20 @@ ShellCreateWindowFunction::ShellCreateWindowFunction() { |
| ShellCreateWindowFunction::~ShellCreateWindowFunction() { |
| } |
| -bool ShellCreateWindowFunction::RunImpl() { |
| +ExtensionFunction::ResponseAction ShellCreateWindowFunction::Run() { |
|
not at google - send to devlin
2014/04/30 16:19:18
app_shell didn't compile, so I fixed this up, and
|
| // Arguments must contain a URL and may contain options and a callback. |
| if (args_->GetSize() < 1 || args_->GetSize() > 3) |
| - return false; |
| + return RespondNow(Error(kInvalidArguments)); |
| // Extract the URL for the window contents, e.g. "main.html". |
| std::string url_string; |
| if (!args_->GetString(0, &url_string)) |
| - return false; |
| + return RespondNow(Error(kInvalidArguments)); |
| // Convert "main.html" to "chrome-extension:/<id>/main.html". |
| GURL url = GetExtension()->GetResourceURL(url_string); |
| if (!url.is_valid()) |
| - return false; |
| + return RespondNow(Error(kInvalidArguments)); |
| // The desktop keeps ownership of the window. |
| apps::ShellAppWindow* app_window = |
| @@ -52,11 +54,7 @@ bool ShellCreateWindowFunction::RunImpl() { |
| app_window->LoadURL(url); |
| // Create the reply to send to the renderer. |
| - DictionaryValue* result = CreateResult(app_window); |
| - SetResult(result); |
| - |
| - SendResponse(true /* success */); |
| - return true; |
| + return RespondNow(SingleArgument(CreateResult(app_window))); |
| } |
| } // namespace apps |