Chromium Code Reviews| Index: athena/main/athena_main.cc |
| diff --git a/athena/main/athena_main.cc b/athena/main/athena_main.cc |
| index 3d5408e8621c73c0bcc06ce64154bd69fcae9a82..9f72bc3ece4fd6346cd17e5b754c23fe4bfebd83 100644 |
| --- a/athena/main/athena_main.cc |
| +++ b/athena/main/athena_main.cc |
| @@ -2,20 +2,22 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +#include "athena/activity/public/activity_factory.h" |
| +#include "athena/activity/public/activity_manager.h" |
| #include "athena/content/public/web_contents_view_delegate_creator.h" |
| -#include "athena/main/athena_app_window_controller.h" |
| +#include "athena/env/public/athena_env.h" |
| #include "athena/main/athena_launcher.h" |
| #include "athena/screen/public/screen_manager.h" |
| -#include "athena/screen/public/screen_manager_delegate.h" |
| #include "base/command_line.h" |
| #include "base/file_util.h" |
| #include "base/path_service.h" |
| #include "content/public/app/content_main.h" |
| #include "content/public/browser/browser_thread.h" |
| #include "extensions/shell/app/shell_main_delegate.h" |
| +#include "extensions/shell/browser/desktop_controller.h" |
| +#include "extensions/shell/browser/shell_app_window.h" |
| #include "extensions/shell/browser/shell_browser_main_delegate.h" |
| #include "extensions/shell/browser/shell_content_browser_client.h" |
| -#include "extensions/shell/browser/shell_desktop_controller.h" |
| #include "extensions/shell/browser/shell_extension_system.h" |
| #include "extensions/shell/common/switches.h" |
| #include "ui/aura/window_tree_host.h" |
| @@ -31,40 +33,35 @@ const char kDefaultAppPath[] = |
| } // namespace athena |
| -class AthenaDesktopController : public extensions::ShellDesktopController { |
| +class AthenaDesktopController : public extensions::DesktopController { |
| public: |
| AthenaDesktopController() {} |
| virtual ~AthenaDesktopController() {} |
| private: |
| // extensions::ShellDesktopController: |
|
Jun Mukai
2014/08/23 01:11:12
// extensions::DesktopController:
oshima
2014/08/23 01:19:36
Done.
|
| - virtual wm::FocusRules* CreateFocusRules() OVERRIDE { |
| - return athena::ScreenManager::CreateFocusRules(); |
| + virtual aura::WindowTreeHost* GetHost() OVERRIDE { |
| + return athena::AthenaEnv::Get()->GetHost(); |
| } |
| - DISALLOW_COPY_AND_ASSIGN(AthenaDesktopController); |
| -}; |
| - |
| -class AthenaScreenManagerDelegate : public athena::ScreenManagerDelegate { |
| - public: |
| - explicit AthenaScreenManagerDelegate( |
| - extensions::ShellDesktopController* controller) |
| - : controller_(controller) { |
| - } |
| - |
| - virtual ~AthenaScreenManagerDelegate() { |
| + // Creates the window that hosts the app. |
|
Jun Mukai
2014/08/23 01:11:12
I don't think you need to comment overriding metho
oshima
2014/08/23 01:19:36
Done.
|
| + virtual void CreateRootWindow() OVERRIDE {} |
| + |
| + // Creates a new app window and adds it to the desktop. The desktop maintains |
| + // ownership of the window. |
| + virtual extensions::ShellAppWindow* CreateAppWindow( |
| + content::BrowserContext* context) OVERRIDE { |
| + extensions::ShellAppWindow* app_window = new extensions::ShellAppWindow(); |
| + app_window->Init(context, gfx::Size(100, 100)); |
| + athena::ActivityManager::Get()->AddActivity( |
| + athena::ActivityFactory::Get()->CreateAppActivity(app_window)); |
| + return app_window; |
| } |
| - private: |
| - // athena::ScreenManagerDelegate: |
| - virtual void SetWorkAreaInsets(const gfx::Insets& insets) OVERRIDE { |
| - controller_->SetDisplayWorkAreaInsets(insets); |
| - } |
| - |
| - // Not owned. |
| - extensions::ShellDesktopController* controller_; |
| + // Closes and destroys the app windows. |
| + virtual void CloseAppWindows() OVERRIDE {} |
| - DISALLOW_COPY_AND_ASSIGN(AthenaScreenManagerDelegate); |
| + DISALLOW_COPY_AND_ASSIGN(AthenaDesktopController); |
| }; |
| class AthenaBrowserMainDelegate : public extensions::ShellBrowserMainDelegate { |
| @@ -90,14 +87,9 @@ class AthenaBrowserMainDelegate : public extensions::ShellBrowserMainDelegate { |
| extension_system->LoadApp(app_absolute_dir); |
| } |
| - extensions::ShellDesktopController* desktop_controller = |
| - extensions::ShellDesktopController::instance(); |
| - screen_manager_delegate_.reset( |
| - new AthenaScreenManagerDelegate(desktop_controller)); |
| - athena::StartAthenaEnv(desktop_controller->host()->window(), |
| - screen_manager_delegate_.get(), |
| - content::BrowserThread::GetMessageLoopProxyForThread( |
| - content::BrowserThread::FILE)); |
| + // TODO(oshima|mukai): |
|
Jun Mukai
2014/08/23 01:11:12
What is the content of the TODO?
|
| + athena::StartAthenaEnv(content::BrowserThread::GetMessageLoopProxyForThread( |
| + content::BrowserThread::FILE)); |
| athena::StartAthenaSessionWithContext(context); |
| } |
| @@ -105,18 +97,11 @@ class AthenaBrowserMainDelegate : public extensions::ShellBrowserMainDelegate { |
| athena::ShutdownAthena(); |
| } |
| - virtual extensions::ShellDesktopController* CreateDesktopController() |
| - OVERRIDE { |
| - // TODO(mukai): create Athena's own ShellDesktopController subclass so that |
| - // it can initialize its own window manager logic. |
| - extensions::ShellDesktopController* desktop = new AthenaDesktopController(); |
| - desktop->SetAppWindowController(new athena::AthenaAppWindowController()); |
| - return desktop; |
| + virtual extensions::DesktopController* CreateDesktopController() OVERRIDE { |
| + return new AthenaDesktopController(); |
| } |
| private: |
| - scoped_ptr<AthenaScreenManagerDelegate> screen_manager_delegate_; |
| - |
| DISALLOW_COPY_AND_ASSIGN(AthenaBrowserMainDelegate); |
| }; |