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

Side by Side Diff: extensions/shell/browser/shell_app_window.cc

Issue 412713002: Move apps/shell to extensions/shell. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 40% Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "apps/shell/browser/shell_app_window.h" 5 #include "extensions/shell/browser/shell_app_window.h"
6 6
7 #include "apps/shell/browser/shell_extension_web_contents_observer.h"
8 #include "content/public/browser/navigation_controller.h" 7 #include "content/public/browser/navigation_controller.h"
9 #include "content/public/browser/render_view_host.h" 8 #include "content/public/browser/render_view_host.h"
10 #include "content/public/browser/web_contents.h" 9 #include "content/public/browser/web_contents.h"
11 #include "extensions/browser/view_type_utils.h" 10 #include "extensions/browser/view_type_utils.h"
12 #include "extensions/common/extension_messages.h" 11 #include "extensions/common/extension_messages.h"
12 #include "extensions/shell/browser/shell_extension_web_contents_observer.h"
13 #include "ipc/ipc_message_macros.h" 13 #include "ipc/ipc_message_macros.h"
14 14
15 using content::BrowserContext; 15 using content::BrowserContext;
16 using content::WebContents; 16 using content::WebContents;
17 17
18 namespace apps { 18 namespace extensions {
19 19
20 ShellAppWindow::ShellAppWindow() {} 20 ShellAppWindow::ShellAppWindow() {
21 }
21 22
22 ShellAppWindow::~ShellAppWindow() {} 23 ShellAppWindow::~ShellAppWindow() {
24 }
23 25
24 void ShellAppWindow::Init(BrowserContext* context, gfx::Size initial_size) { 26 void ShellAppWindow::Init(BrowserContext* context, gfx::Size initial_size) {
25 extension_function_dispatcher_.reset( 27 extension_function_dispatcher_.reset(
26 new extensions::ExtensionFunctionDispatcher(context, this)); 28 new ExtensionFunctionDispatcher(context, this));
27 29
28 // Create the web contents with an initial size to avoid a resize. 30 // Create the web contents with an initial size to avoid a resize.
29 WebContents::CreateParams create_params(context); 31 WebContents::CreateParams create_params(context);
30 create_params.initial_size = initial_size; 32 create_params.initial_size = initial_size;
31 web_contents_.reset(WebContents::Create(create_params)); 33 web_contents_.reset(WebContents::Create(create_params));
32 34
33 content::WebContentsObserver::Observe(web_contents_.get()); 35 content::WebContentsObserver::Observe(web_contents_.get());
34 36
35 // Add support for extension startup. 37 // Add support for extension startup.
36 extensions::ShellExtensionWebContentsObserver::CreateForWebContents( 38 ShellExtensionWebContentsObserver::CreateForWebContents(web_contents_.get());
37 web_contents_.get());
38 39
39 extensions::SetViewType(web_contents_.get(), 40 SetViewType(web_contents_.get(), VIEW_TYPE_APP_WINDOW);
40 extensions::VIEW_TYPE_APP_WINDOW);
41 } 41 }
42 42
43 void ShellAppWindow::LoadURL(const GURL& url) { 43 void ShellAppWindow::LoadURL(const GURL& url) {
44 content::NavigationController::LoadURLParams params(url); 44 content::NavigationController::LoadURLParams params(url);
45 web_contents_->GetController().LoadURLWithParams(params); 45 web_contents_->GetController().LoadURLWithParams(params);
46 web_contents_->Focus(); 46 web_contents_->Focus();
47 } 47 }
48 48
49 aura::Window* ShellAppWindow::GetNativeWindow() { 49 aura::Window* ShellAppWindow::GetNativeWindow() {
50 return web_contents_->GetNativeView(); 50 return web_contents_->GetNativeView();
(...skipping 14 matching lines...) Expand all
65 65
66 content::WebContents* ShellAppWindow::GetAssociatedWebContents() const { 66 content::WebContents* ShellAppWindow::GetAssociatedWebContents() const {
67 return web_contents_.get(); 67 return web_contents_.get();
68 } 68 }
69 69
70 void ShellAppWindow::OnRequest(const ExtensionHostMsg_Request_Params& params) { 70 void ShellAppWindow::OnRequest(const ExtensionHostMsg_Request_Params& params) {
71 extension_function_dispatcher_->Dispatch(params, 71 extension_function_dispatcher_->Dispatch(params,
72 web_contents_->GetRenderViewHost()); 72 web_contents_->GetRenderViewHost());
73 } 73 }
74 74
75 } // namespace apps 75 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/shell/browser/shell_app_window.h ('k') | extensions/shell/browser/shell_app_window_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698