| Index: extensions/shell/browser/shell_desktop_controller.cc
|
| diff --git a/extensions/shell/browser/shell_desktop_controller.cc b/extensions/shell/browser/shell_desktop_controller.cc
|
| index e7d20575f15c6a8723e7ae493f4c49badb4e6760..b6f98ee3750e84b586fd07a313833c1b0b9674dd 100644
|
| --- a/extensions/shell/browser/shell_desktop_controller.cc
|
| +++ b/extensions/shell/browser/shell_desktop_controller.cc
|
| @@ -6,7 +6,7 @@
|
|
|
| #include "base/command_line.h"
|
| #include "content/public/browser/context_factory.h"
|
| -#include "extensions/shell/browser/shell_app_window_controller.h"
|
| +#include "extensions/shell/browser/shell_app_window.h"
|
| #include "extensions/shell/common/switches.h"
|
| #include "ui/aura/client/cursor_client.h"
|
| #include "ui/aura/client/default_capture_client.h"
|
| @@ -152,8 +152,6 @@ class AppsFocusRules : public wm::BaseFocusRules {
|
| DISALLOW_COPY_AND_ASSIGN(AppsFocusRules);
|
| };
|
|
|
| -ShellDesktopController* g_instance = NULL;
|
| -
|
| } // namespace
|
|
|
| ShellDesktopController::ShellDesktopController() {
|
| @@ -165,40 +163,34 @@ ShellDesktopController::ShellDesktopController() {
|
| #endif
|
| aura::Env::CreateInstance(true);
|
| aura::Env::GetInstance()->set_context_factory(content::GetContextFactory());
|
| -
|
| - g_instance = this;
|
| }
|
|
|
| ShellDesktopController::~ShellDesktopController() {
|
| - app_window_controller_.reset();
|
| - g_instance = NULL;
|
| DestroyRootWindow();
|
| aura::Env::DeleteInstance();
|
| }
|
|
|
| -// static
|
| -ShellDesktopController* ShellDesktopController::instance() {
|
| - return g_instance;
|
| -}
|
| -
|
| -void ShellDesktopController::SetAppWindowController(
|
| - ShellAppWindowController* app_window_controller) {
|
| - app_window_controller_.reset(app_window_controller);
|
| +aura::WindowTreeHost* ShellDesktopController::GetHost() {
|
| + return host_.get();
|
| }
|
|
|
| ShellAppWindow* ShellDesktopController::CreateAppWindow(
|
| content::BrowserContext* context) {
|
| - return app_window_controller_->CreateAppWindow(context);
|
| -}
|
| + aura::Window* root_window = GetHost()->window();
|
|
|
| -void ShellDesktopController::CloseAppWindows() {
|
| - if (app_window_controller_)
|
| - app_window_controller_->CloseAppWindows();
|
| + app_window_.reset(new ShellAppWindow);
|
| + app_window_->Init(context, root_window->bounds().size());
|
| +
|
| + // Attach the web contents view to our window hierarchy.
|
| + aura::Window* content = app_window_->GetNativeWindow();
|
| + root_window->AddChild(content);
|
| + content->Show();
|
| +
|
| + return app_window_.get();
|
| }
|
|
|
| -void ShellDesktopController::SetDisplayWorkAreaInsets(
|
| - const gfx::Insets& insets) {
|
| - test_screen_->SetWorkAreaInsets(insets);
|
| +void ShellDesktopController::CloseAppWindows() {
|
| + app_window_.reset();
|
| }
|
|
|
| aura::Window* ShellDesktopController::GetDefaultParent(
|
| @@ -261,7 +253,7 @@ void ShellDesktopController::CreateRootWindow() {
|
|
|
| void ShellDesktopController::InitWindowManager() {
|
| wm::FocusController* focus_controller =
|
| - new wm::FocusController(CreateFocusRules());
|
| + new wm::FocusController(new AppsFocusRules());
|
| aura::client::SetFocusClient(host_->window(), focus_controller);
|
| host_->window()->AddPreTargetHandler(focus_controller);
|
| aura::client::SetActivationClient(host_->window(), focus_controller);
|
| @@ -295,10 +287,6 @@ void ShellDesktopController::InitWindowManager() {
|
| #endif
|
| }
|
|
|
| -wm::FocusRules* ShellDesktopController::CreateFocusRules() {
|
| - return new AppsFocusRules();
|
| -}
|
| -
|
| void ShellDesktopController::DestroyRootWindow() {
|
| host_->RemoveObserver(this);
|
| if (input_method_filter_)
|
|
|