OLD | NEW |
---|---|
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/api/app_window/app_window_api.h" | 5 #include "chrome/browser/extensions/api/app_window/app_window_api.h" |
6 | 6 |
7 #include "base/time.h" | 7 #include "base/time.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/extensions/extension_window_controller.h" | 9 #include "chrome/browser/extensions/extension_window_controller.h" |
10 #include "chrome/browser/extensions/extension_window_list.h" | 10 #include "chrome/browser/extensions/extension_window_list.h" |
(...skipping 13 matching lines...) Expand all Loading... | |
24 bool AppWindowCreateFunction::RunImpl() { | 24 bool AppWindowCreateFunction::RunImpl() { |
25 scoped_ptr<Create::Params> params(Create::Params::Create(*args_)); | 25 scoped_ptr<Create::Params> params(Create::Params::Create(*args_)); |
26 EXTENSION_FUNCTION_VALIDATE(params.get()); | 26 EXTENSION_FUNCTION_VALIDATE(params.get()); |
27 | 27 |
28 GURL url = GetExtension()->GetResourceURL(params->url); | 28 GURL url = GetExtension()->GetResourceURL(params->url); |
29 | 29 |
30 // TODO(jeremya): figure out a way to pass the opening WebContents through to | 30 // TODO(jeremya): figure out a way to pass the opening WebContents through to |
31 // ShellWindow::Create so we can set the opener at create time rather than | 31 // ShellWindow::Create so we can set the opener at create time rather than |
32 // with a hack in AppWindowCustomBindings::GetView(). | 32 // with a hack in AppWindowCustomBindings::GetView(). |
33 ShellWindow::CreateParams create_params; | 33 ShellWindow::CreateParams create_params; |
34 if (params->options.width.get()) | 34 if (params->options.get()) { |
not at google - send to devlin
2012/05/28 04:46:43
nit: save a reference to "params->options.get()" r
jeremya
2012/05/28 06:49:01
Done.
| |
35 create_params.bounds.set_width(*params->options.width.get()); | 35 if (params->options->width.get()) |
36 if (params->options.height.get()) | 36 create_params.bounds.set_width(*params->options->width.get()); |
37 create_params.bounds.set_height(*params->options.height.get()); | 37 if (params->options->height.get()) |
38 if (params->options.left.get()) | 38 create_params.bounds.set_height(*params->options->height.get()); |
39 create_params.bounds.set_x(*params->options.left.get()); | 39 if (params->options->left.get()) |
40 if (params->options.top.get()) | 40 create_params.bounds.set_x(*params->options->left.get()); |
41 create_params.bounds.set_y(*params->options.top.get()); | 41 if (params->options->top.get()) |
42 create_params.bounds.set_y(*params->options->top.get()); | |
43 } | |
42 ShellWindow* shell_window = | 44 ShellWindow* shell_window = |
43 ShellWindow::Create(profile(), GetExtension(), url, create_params); | 45 ShellWindow::Create(profile(), GetExtension(), url, create_params); |
44 shell_window->Show(); | 46 shell_window->Show(); |
45 | 47 |
46 content::WebContents* created_contents = shell_window->web_contents(); | 48 content::WebContents* created_contents = shell_window->web_contents(); |
47 int view_id = created_contents->GetRenderViewHost()->GetRoutingID(); | 49 int view_id = created_contents->GetRenderViewHost()->GetRoutingID(); |
48 | 50 |
49 result_.reset(base::Value::CreateIntegerValue(view_id)); | 51 result_.reset(base::Value::CreateIntegerValue(view_id)); |
50 return true; | 52 return true; |
51 } | 53 } |
52 | 54 |
53 } // namespace extensions | 55 } // namespace extensions |
OLD | NEW |