Commit 5c34ceb4 authored by hashimoto's avatar hashimoto Committed by Commit bot

Move AppWindowContentsImpl to extensions

Remove unneeded include from app_window_contents.cc
Move app_window_contents.{cc,h} to extensions/browser/app_window
Change the namespace from apps to extensions.

BUG=403726
TBR=derat@chromium.org for include&namespace fix

Review URL: https://codereview.chromium.org/527693002

Cr-Commit-Position: refs/heads/master@{#293094}
parent 3485d1a0
...@@ -19,8 +19,6 @@ static_library("apps") { ...@@ -19,8 +19,6 @@ static_library("apps") {
"app_restore_service.h", "app_restore_service.h",
"app_restore_service_factory.cc", "app_restore_service_factory.cc",
"app_restore_service_factory.h", "app_restore_service_factory.h",
"app_window_contents.cc",
"app_window_contents.h",
"browser_context_keyed_service_factories.cc", "browser_context_keyed_service_factories.cc",
"browser_context_keyed_service_factories.h", "browser_context_keyed_service_factories.h",
"custom_launcher_page_contents.cc", "custom_launcher_page_contents.cc",
......
...@@ -38,8 +38,6 @@ ...@@ -38,8 +38,6 @@
'app_restore_service.h', 'app_restore_service.h',
'app_restore_service_factory.cc', 'app_restore_service_factory.cc',
'app_restore_service_factory.h', 'app_restore_service_factory.h',
'app_window_contents.cc',
'app_window_contents.h',
'browser_context_keyed_service_factories.cc', 'browser_context_keyed_service_factories.cc',
'browser_context_keyed_service_factories.h', 'browser_context_keyed_service_factories.h',
'custom_launcher_page_contents.cc', 'custom_launcher_page_contents.cc',
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "chrome/browser/apps/app_browsertest_util.h" #include "chrome/browser/apps/app_browsertest_util.h"
#include "apps/app_window_contents.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "chrome/browser/extensions/api/tabs/tabs_api.h" #include "chrome/browser/extensions/api/tabs/tabs_api.h"
...@@ -16,6 +15,7 @@ ...@@ -16,6 +15,7 @@
#include "content/public/browser/notification_service.h" #include "content/public/browser/notification_service.h"
#include "content/public/test/browser_test_utils.h" #include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h" #include "content/public/test/test_utils.h"
#include "extensions/browser/app_window/app_window_contents.h"
#include "extensions/browser/app_window/app_window_registry.h" #include "extensions/browser/app_window/app_window_registry.h"
#include "extensions/browser/app_window/native_app_window.h" #include "extensions/browser/app_window/native_app_window.h"
#include "extensions/common/switches.h" #include "extensions/common/switches.h"
...@@ -201,8 +201,7 @@ AppWindow* PlatformAppBrowserTest::CreateAppWindowFromParams( ...@@ -201,8 +201,7 @@ AppWindow* PlatformAppBrowserTest::CreateAppWindowFromParams(
const AppWindow::CreateParams& params) { const AppWindow::CreateParams& params) {
AppWindow* window = AppWindow* window =
new AppWindow(browser()->profile(), new ChromeAppDelegate(), extension); new AppWindow(browser()->profile(), new ChromeAppDelegate(), extension);
window->Init( window->Init(GURL(std::string()), new AppWindowContentsImpl(window), params);
GURL(std::string()), new apps::AppWindowContentsImpl(window), params);
return window; return window;
} }
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "chrome/browser/extensions/api/app_window/app_window_api.h" #include "chrome/browser/extensions/api/app_window/app_window_api.h"
#include "apps/app_window_contents.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
...@@ -18,6 +17,7 @@ ...@@ -18,6 +17,7 @@
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/common/url_constants.h" #include "content/public/common/url_constants.h"
#include "extensions/browser/app_window/app_window.h" #include "extensions/browser/app_window/app_window.h"
#include "extensions/browser/app_window/app_window_contents.h"
#include "extensions/browser/app_window/app_window_registry.h" #include "extensions/browser/app_window/app_window_registry.h"
#include "extensions/browser/app_window/apps_client.h" #include "extensions/browser/app_window/apps_client.h"
#include "extensions/browser/app_window/native_app_window.h" #include "extensions/browser/app_window/native_app_window.h"
...@@ -280,8 +280,7 @@ bool AppWindowCreateFunction::RunAsync() { ...@@ -280,8 +280,7 @@ bool AppWindowCreateFunction::RunAsync() {
AppWindow* app_window = AppWindow* app_window =
AppsClient::Get()->CreateAppWindow(browser_context(), extension()); AppsClient::Get()->CreateAppWindow(browser_context(), extension());
app_window->Init( app_window->Init(url, new AppWindowContentsImpl(app_window), create_params);
url, new apps::AppWindowContentsImpl(app_window), create_params);
if (ExtensionsBrowserClient::Get()->IsRunningInForcedAppMode()) if (ExtensionsBrowserClient::Get()->IsRunningInForcedAppMode())
app_window->ForcedFullscreen(); app_window->ForcedFullscreen();
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "chrome/browser/power/process_power_collector.h" #include "chrome/browser/power/process_power_collector.h"
#include "apps/app_window_contents.h"
#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/apps/chrome_app_delegate.h" #include "chrome/browser/ui/apps/chrome_app_delegate.h"
#include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_commands.h"
...@@ -17,6 +16,7 @@ ...@@ -17,6 +16,7 @@
#include "content/public/browser/site_instance.h" #include "content/public/browser/site_instance.h"
#include "content/public/test/browser_test_utils.h" #include "content/public/test/browser_test_utils.h"
#include "content/public/test/mock_render_process_host.h" #include "content/public/test/mock_render_process_host.h"
#include "extensions/browser/app_window/app_window_contents.h"
#include "extensions/browser/app_window/app_window_registry.h" #include "extensions/browser/app_window/app_window_registry.h"
#include "extensions/browser/app_window/apps_client.h" #include "extensions/browser/app_window/apps_client.h"
#include "extensions/browser/app_window/native_app_window.h" #include "extensions/browser/app_window/native_app_window.h"
......
...@@ -47,7 +47,6 @@ ...@@ -47,7 +47,6 @@
#include "ui/base/models/menu_model.h" #include "ui/base/models/menu_model.h"
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
#include "apps/app_window_contents.h"
#include "ash/test/test_session_state_delegate.h" #include "ash/test/test_session_state_delegate.h"
#include "ash/test/test_shell_delegate.h" #include "ash/test/test_shell_delegate.h"
#include "chrome/browser/chromeos/login/users/fake_user_manager.h" #include "chrome/browser/chromeos/login/users/fake_user_manager.h"
...@@ -64,6 +63,7 @@ ...@@ -64,6 +63,7 @@
#include "chrome/test/base/testing_profile_manager.h" #include "chrome/test/base/testing_profile_manager.h"
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
#include "content/public/test/test_utils.h" #include "content/public/test/test_utils.h"
#include "extensions/browser/app_window/app_window_contents.h"
#include "extensions/browser/app_window/app_window_registry.h" #include "extensions/browser/app_window/app_window_registry.h"
#include "extensions/browser/app_window/native_app_window.h" #include "extensions/browser/app_window/native_app_window.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
...@@ -747,7 +747,7 @@ class V2App { ...@@ -747,7 +747,7 @@ class V2App {
extensions::AppWindow::CreateParams params = extensions::AppWindow::CreateParams params =
extensions::AppWindow::CreateParams(); extensions::AppWindow::CreateParams();
window_->Init(GURL(std::string()), window_->Init(GURL(std::string()),
new apps::AppWindowContentsImpl(window_), params); new extensions::AppWindowContentsImpl(window_), params);
} }
virtual ~V2App() { virtual ~V2App() {
......
...@@ -166,6 +166,8 @@ source_set("browser") { ...@@ -166,6 +166,8 @@ source_set("browser") {
"app_window/app_web_contents_helper.h", "app_window/app_web_contents_helper.h",
"app_window/app_window.cc", "app_window/app_window.cc",
"app_window/app_window.h", "app_window/app_window.h",
"app_window/app_window_contents.cc",
"app_window/app_window_contents.h",
"app_window/app_window_geometry_cache.cc", "app_window/app_window_geometry_cache.cc",
"app_window/app_window_geometry_cache.h", "app_window/app_window_geometry_cache.h",
"app_window/app_window_registry.cc", "app_window/app_window_registry.cc",
......
...@@ -2,13 +2,11 @@ ...@@ -2,13 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "apps/app_window_contents.h" #include "extensions/browser/app_window/app_window_contents.h"
#include <string> #include <string>
#include <utility> #include <utility>
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/common/extensions/api/app_window.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_process_host.h" #include "content/public/browser/render_process_host.h"
...@@ -20,10 +18,7 @@ ...@@ -20,10 +18,7 @@
#include "extensions/browser/app_window/native_app_window.h" #include "extensions/browser/app_window/native_app_window.h"
#include "extensions/common/extension_messages.h" #include "extensions/common/extension_messages.h"
namespace app_window = extensions::api::app_window; namespace extensions {
using extensions::AppWindow;
namespace apps {
AppWindowContentsImpl::AppWindowContentsImpl(AppWindow* host) : host_(host) {} AppWindowContentsImpl::AppWindowContentsImpl(AppWindow* host) : host_(host) {}
...@@ -34,7 +29,7 @@ void AppWindowContentsImpl::Initialize(content::BrowserContext* context, ...@@ -34,7 +29,7 @@ void AppWindowContentsImpl::Initialize(content::BrowserContext* context,
url_ = url; url_ = url;
extension_function_dispatcher_.reset( extension_function_dispatcher_.reset(
new extensions::ExtensionFunctionDispatcher(context, this)); new ExtensionFunctionDispatcher(context, this));
web_contents_.reset( web_contents_.reset(
content::WebContents::Create(content::WebContents::CreateParams( content::WebContents::Create(content::WebContents::CreateParams(
...@@ -66,7 +61,7 @@ void AppWindowContentsImpl::LoadContents(int32 creator_process_id) { ...@@ -66,7 +61,7 @@ void AppWindowContentsImpl::LoadContents(int32 creator_process_id) {
} }
void AppWindowContentsImpl::NativeWindowChanged( void AppWindowContentsImpl::NativeWindowChanged(
extensions::NativeAppWindow* native_app_window) { NativeAppWindow* native_app_window) {
base::ListValue args; base::ListValue args;
base::DictionaryValue* dictionary = new base::DictionaryValue(); base::DictionaryValue* dictionary = new base::DictionaryValue();
args.Append(dictionary); args.Append(dictionary);
...@@ -112,8 +107,7 @@ bool AppWindowContentsImpl::OnMessageReceived(const IPC::Message& message) { ...@@ -112,8 +107,7 @@ bool AppWindowContentsImpl::OnMessageReceived(const IPC::Message& message) {
return handled; return handled;
} }
extensions::WindowController* WindowController* AppWindowContentsImpl::GetExtensionWindowController() const {
AppWindowContentsImpl::GetExtensionWindowController() const {
return NULL; return NULL;
} }
...@@ -128,7 +122,7 @@ void AppWindowContentsImpl::OnRequest( ...@@ -128,7 +122,7 @@ void AppWindowContentsImpl::OnRequest(
} }
void AppWindowContentsImpl::UpdateDraggableRegions( void AppWindowContentsImpl::UpdateDraggableRegions(
const std::vector<extensions::DraggableRegion>& regions) { const std::vector<DraggableRegion>& regions) {
host_->UpdateDraggableRegions(regions); host_->UpdateDraggableRegions(regions);
} }
...@@ -142,4 +136,4 @@ void AppWindowContentsImpl::SuspendRenderViewHost( ...@@ -142,4 +136,4 @@ void AppWindowContentsImpl::SuspendRenderViewHost(
rvh->GetProcess()->GetID(), rvh->GetRoutingID())); rvh->GetProcess()->GetID(), rvh->GetRoutingID()));
} }
} // namespace apps } // namespace extensions
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef APPS_APP_WINDOW_CONTENTS_H_ #ifndef EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_CONTENTS_H_
#define APPS_APP_WINDOW_CONTENTS_H_ #define EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_CONTENTS_H_
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
...@@ -18,28 +18,24 @@ class BrowserContext; ...@@ -18,28 +18,24 @@ class BrowserContext;
} }
namespace extensions { namespace extensions {
struct DraggableRegion;
}
namespace apps { struct DraggableRegion;
// AppWindowContents class specific to app windows. It maintains a // AppWindowContents class specific to app windows. It maintains a
// WebContents instance and observes it for the purpose of passing // WebContents instance and observes it for the purpose of passing
// messages to the extensions system. // messages to the extensions system.
class AppWindowContentsImpl class AppWindowContentsImpl : public AppWindowContents,
: public extensions::AppWindowContents, public content::WebContentsObserver,
public content::WebContentsObserver, public ExtensionFunctionDispatcher::Delegate {
public extensions::ExtensionFunctionDispatcher::Delegate {
public: public:
explicit AppWindowContentsImpl(extensions::AppWindow* host); explicit AppWindowContentsImpl(AppWindow* host);
virtual ~AppWindowContentsImpl(); virtual ~AppWindowContentsImpl();
// AppWindowContents // AppWindowContents
virtual void Initialize(content::BrowserContext* context, virtual void Initialize(content::BrowserContext* context,
const GURL& url) OVERRIDE; const GURL& url) OVERRIDE;
virtual void LoadContents(int32 creator_process_id) OVERRIDE; virtual void LoadContents(int32 creator_process_id) OVERRIDE;
virtual void NativeWindowChanged( virtual void NativeWindowChanged(NativeAppWindow* native_app_window) OVERRIDE;
extensions::NativeAppWindow* native_app_window) OVERRIDE;
virtual void NativeWindowClosed() OVERRIDE; virtual void NativeWindowClosed() OVERRIDE;
virtual void DispatchWindowShownForTests() const OVERRIDE; virtual void DispatchWindowShownForTests() const OVERRIDE;
virtual content::WebContents* GetWebContents() const OVERRIDE; virtual content::WebContents* GetWebContents() const OVERRIDE;
...@@ -48,25 +44,22 @@ class AppWindowContentsImpl ...@@ -48,25 +44,22 @@ class AppWindowContentsImpl
// content::WebContentsObserver // content::WebContentsObserver
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
// extensions::ExtensionFunctionDispatcher::Delegate // ExtensionFunctionDispatcher::Delegate
virtual extensions::WindowController* GetExtensionWindowController() const virtual WindowController* GetExtensionWindowController() const OVERRIDE;
OVERRIDE;
virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE; virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE;
void OnRequest(const ExtensionHostMsg_Request_Params& params); void OnRequest(const ExtensionHostMsg_Request_Params& params);
void UpdateDraggableRegions( void UpdateDraggableRegions(const std::vector<DraggableRegion>& regions);
const std::vector<extensions::DraggableRegion>& regions);
void SuspendRenderViewHost(content::RenderViewHost* rvh); void SuspendRenderViewHost(content::RenderViewHost* rvh);
extensions::AppWindow* host_; // This class is owned by |host_| AppWindow* host_; // This class is owned by |host_|
GURL url_; GURL url_;
scoped_ptr<content::WebContents> web_contents_; scoped_ptr<content::WebContents> web_contents_;
scoped_ptr<extensions::ExtensionFunctionDispatcher> scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_;
extension_function_dispatcher_;
DISALLOW_COPY_AND_ASSIGN(AppWindowContentsImpl); DISALLOW_COPY_AND_ASSIGN(AppWindowContentsImpl);
}; };
} // namespace apps } // namespace extensions
#endif // APPS_APP_WINDOW_CONTENTS_H_ #endif // EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_CONTENTS_H_
...@@ -430,6 +430,8 @@ ...@@ -430,6 +430,8 @@
'browser/app_window/app_web_contents_helper.h', 'browser/app_window/app_web_contents_helper.h',
'browser/app_window/app_window.cc', 'browser/app_window/app_window.cc',
'browser/app_window/app_window.h', 'browser/app_window/app_window.h',
'browser/app_window/app_window_contents.cc',
'browser/app_window/app_window_contents.h',
'browser/app_window/app_window_geometry_cache.cc', 'browser/app_window/app_window_geometry_cache.cc',
'browser/app_window/app_window_geometry_cache.h', 'browser/app_window/app_window_geometry_cache.h',
'browser/app_window/app_window_registry.cc', 'browser/app_window/app_window_registry.cc',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment