OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/shell/browser/api/shell/shell_api.h" | 5 #include "extensions/shell/browser/api/shell/shell_api.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "extensions/common/extension.h" | 9 #include "extensions/common/extension.h" |
10 #include "extensions/shell/browser/shell_app_window.h" | 10 #include "extensions/shell/browser/shell_app_window.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 scoped_ptr<CreateWindow::Params> params(CreateWindow::Params::Create(*args_)); | 42 scoped_ptr<CreateWindow::Params> params(CreateWindow::Params::Create(*args_)); |
43 EXTENSION_FUNCTION_VALIDATE(params.get()); | 43 EXTENSION_FUNCTION_VALIDATE(params.get()); |
44 | 44 |
45 // Convert "main.html" to "chrome-extension:/<id>/main.html". | 45 // Convert "main.html" to "chrome-extension:/<id>/main.html". |
46 GURL url = extension()->GetResourceURL(params->url); | 46 GURL url = extension()->GetResourceURL(params->url); |
47 if (!url.is_valid()) | 47 if (!url.is_valid()) |
48 return RespondNow(Error(kInvalidArguments)); | 48 return RespondNow(Error(kInvalidArguments)); |
49 | 49 |
50 // The desktop keeps ownership of the window. | 50 // The desktop keeps ownership of the window. |
51 ShellAppWindow* app_window = | 51 ShellAppWindow* app_window = |
52 ShellDesktopController::instance()->CreateAppWindow(browser_context()); | 52 ShellDesktopController::instance()->CreateAppWindow(browser_context(), |
| 53 extension()); |
53 app_window->LoadURL(url); | 54 app_window->LoadURL(url); |
54 | 55 |
55 // Create the reply to send to the renderer. | 56 // Create the reply to send to the renderer. |
56 return RespondNow(OneArgument(CreateResult(app_window))); | 57 return RespondNow(OneArgument(CreateResult(app_window))); |
57 } | 58 } |
58 | 59 |
59 } // namespace extensions | 60 } // namespace extensions |
OLD | NEW |