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

Unified Diff: apps/shell/browser/api/shell/shell_api.cc

Issue 257333002: Drive extension functions from ExtensionFunction::Run. The (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comment Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « apps/shell/browser/api/shell/shell_api.h ('k') | apps/shell/browser/shell_app_window_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f06996c2b159b1d6aae942771fc4b2542c8b0cd5..c9850256f79c5943629bb29f467e839786e34682 100644
--- a/apps/shell/browser/api/shell/shell_api.cc
+++ b/apps/shell/browser/api/shell/shell_api.cc
@@ -21,6 +21,8 @@ namespace OnLaunched = apps::shell_api::shell::OnLaunched;
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();
@@ -49,14 +51,14 @@ ShellCreateWindowFunction::ShellCreateWindowFunction() {
ShellCreateWindowFunction::~ShellCreateWindowFunction() {
}
-bool ShellCreateWindowFunction::RunImpl() {
+ExtensionFunction::ResponseAction ShellCreateWindowFunction::Run() {
scoped_ptr<CreateWindow::Params> params(CreateWindow::Params::Create(*args_));
- EXTENSION_FUNCTION_VALIDATE(params.get());
+ EXTENSION_FUNCTION_VALIDATE_TYPESAFE(params.get());
// Convert "main.html" to "chrome-extension:/<id>/main.html".
GURL url = GetExtension()->GetResourceURL(params->url);
if (!url.is_valid())
- return false;
+ return RespondNow(Error(kInvalidArguments));
// The desktop keeps ownership of the window.
apps::ShellAppWindow* app_window =
@@ -65,11 +67,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
« no previous file with comments | « apps/shell/browser/api/shell/shell_api.h ('k') | apps/shell/browser/shell_app_window_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698