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

Unified Diff: chrome/browser/extensions/api/app_window/app_window_api.cc

Issue 10456003: Make 'options' and callback arg to chrome.appWindow.create optional. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 8 years, 7 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
Index: chrome/browser/extensions/api/app_window/app_window_api.cc
diff --git a/chrome/browser/extensions/api/app_window/app_window_api.cc b/chrome/browser/extensions/api/app_window/app_window_api.cc
index 0f78d2ce3ada95086e979e0d7c44c7e136f1c50e..85b892df1b6f7198f91153c4721be33555bd4f9e 100644
--- a/chrome/browser/extensions/api/app_window/app_window_api.cc
+++ b/chrome/browser/extensions/api/app_window/app_window_api.cc
@@ -17,7 +17,8 @@
#include "googleurl/src/gurl.h"
#include "ui/gfx/rect.h"
-namespace Create = extensions::api::app_window::Create;
+namespace app_window = extensions::api::app_window;
+namespace Create = app_window::Create;
Mihai Parparita -not on Chrome 2012/05/29 06:14:42 Nit: would using app_window::Create have worked he
namespace extensions {
@@ -29,24 +30,27 @@ bool AppWindowCreateFunction::RunImpl() {
GURL url = GetExtension()->GetResourceURL(params->url);
- bool use_custom_frame = params->options.frame.get() &&
- *params->options.frame.get() == kCustomFrameOption;
-
// TODO(jeremya): figure out a way to pass the opening WebContents through to
// ShellWindow::Create so we can set the opener at create time rather than
// with a hack in AppWindowCustomBindings::GetView().
ShellWindow::CreateParams create_params;
- if (params->options.width.get())
- create_params.bounds.set_width(*params->options.width.get());
- if (params->options.height.get())
- create_params.bounds.set_height(*params->options.height.get());
- if (params->options.left.get())
- create_params.bounds.set_x(*params->options.left.get());
- if (params->options.top.get())
- create_params.bounds.set_y(*params->options.top.get());
- create_params.frame = use_custom_frame ?
- ShellWindow::CreateParams::FRAME_CUSTOM :
- ShellWindow::CreateParams::FRAME_CHROME;
+ app_window::CreateWindowOptions* options = params->options.get();
+ if (options) {
+ if (options->width.get())
+ create_params.bounds.set_width(*options->width.get());
+ if (options->height.get())
+ create_params.bounds.set_height(*options->height.get());
+ if (options->left.get())
+ create_params.bounds.set_x(*options->left.get());
+ if (options->top.get())
+ create_params.bounds.set_y(*options->top.get());
+
+ if (options->frame.get()) {
+ create_params.frame = *options->frame == kCustomFrameOption ?
+ ShellWindow::CreateParams::FRAME_CUSTOM :
+ ShellWindow::CreateParams::FRAME_CHROME;
+ }
+ }
ShellWindow* shell_window =
ShellWindow::Create(profile(), GetExtension(), url, create_params);
shell_window->Show();

Powered by Google App Engine
This is Rietveld 408576698