diff options
author | oshima <oshima@chromium.org> | 2014-08-25 14:32:49 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-08-25 21:35:50 +0000 |
commit | 1629c184e328e7263e93042de97af58651ebe510 (patch) | |
tree | 5d91c6827fc18651b95c6530c7da403a162ea8e0 /athena/main | |
parent | d27cb086ffcbfdc4c3f5b1d1d483b28dff5bd26c (diff) | |
download | chromium_src-1629c184e328e7263e93042de97af58651ebe510.zip chromium_src-1629c184e328e7263e93042de97af58651ebe510.tar.gz chromium_src-1629c184e328e7263e93042de97af58651ebe510.tar.bz2 |
Separate athena's startup process from AppShell's
* Introduced DesktopController interface. app_shell's Init process stays in ShellDesktopController
* Removed ShellAppWindowController
* Athena has its own AthenaDesktopController
* Intorduced AthenaEnv. This is now used for both AthenaMain and Unit test.
* Removed ScreenManagerDelegate and integrate it into AthenaEnv.
* Moved FocusController to ScreenManager, and removed CreateFocusRules()
BUG=397167
TBR=sky@chromium.org
Review URL: https://codereview.chromium.org/480353006
Cr-Commit-Position: refs/heads/master@{#291763}
Diffstat (limited to 'athena/main')
-rw-r--r-- | athena/main/DEPS | 1 | ||||
-rw-r--r-- | athena/main/athena_launcher.cc | 12 | ||||
-rw-r--r-- | athena/main/athena_launcher.h | 5 | ||||
-rw-r--r-- | athena/main/athena_main.cc | 70 | ||||
-rw-r--r-- | athena/main/athena_main.gyp | 2 |
5 files changed, 36 insertions, 54 deletions
diff --git a/athena/main/DEPS b/athena/main/DEPS index c92113c..2dee0498 100644 --- a/athena/main/DEPS +++ b/athena/main/DEPS @@ -1,6 +1,7 @@ include_rules = [ "+athena/activity/public", "+athena/content/public", + "+athena/env/public", "+athena/extensions/public", "+athena/home/public", "+athena/input/public", diff --git a/athena/main/athena_launcher.cc b/athena/main/athena_launcher.cc index 700b869..d34be25 100644 --- a/athena/main/athena_launcher.cc +++ b/athena/main/athena_launcher.cc @@ -9,6 +9,7 @@ #include "athena/content/public/app_registry.h" #include "athena/content/public/content_activity_factory.h" #include "athena/content/public/content_app_model_builder.h" +#include "athena/env/public/athena_env.h" #include "athena/extensions/public/extensions_delegate.h" #include "athena/home/public/home_card.h" #include "athena/home/public/home_card.h" @@ -26,6 +27,7 @@ #include "base/memory/scoped_ptr.h" #include "ui/app_list/app_list_switches.h" #include "ui/aura/window_property.h" +#include "ui/aura/window_tree_host.h" #include "ui/keyboard/keyboard_controller.h" #include "ui/keyboard/keyboard_controller_observer.h" #include "ui/native_theme/native_theme_switches.h" @@ -92,9 +94,9 @@ class AthenaViewsDelegate : public views::ViewsDelegate { DISALLOW_COPY_AND_ASSIGN(AthenaViewsDelegate); }; -void StartAthenaEnv(aura::Window* root_window, - athena::ScreenManagerDelegate* delegate, - scoped_refptr<base::TaskRunner> file_runner) { +void StartAthenaEnv(scoped_refptr<base::TaskRunner> file_runner) { + athena::AthenaEnv::Create(); + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); // Force showing in the experimental app-list view. @@ -111,13 +113,14 @@ void StartAthenaEnv(aura::Window* root_window, // Setup VisibilityClient env_state->visibility_client.reset(new ::wm::VisibilityController); + aura::Window* root_window = athena::AthenaEnv::Get()->GetHost()->window(); aura::client::SetVisibilityClient(root_window, env_state->visibility_client.get()); athena::SystemUI::Create(file_runner); athena::InputManager::Create()->OnRootWindowCreated(root_window); - athena::ScreenManager::Create(delegate, root_window); + athena::ScreenManager::Create(root_window); athena::WindowManager::Create(); athena::AppRegistry::Create(); SetupBackgroundImage(); @@ -159,6 +162,7 @@ void ShutdownAthena() { athena::InputManager::Shutdown(); athena::SystemUI::Shutdown(); athena::ExtensionsDelegate::Shutdown(); + athena::AthenaEnv::Shutdown(); delete views::ViewsDelegate::views_delegate; } diff --git a/athena/main/athena_launcher.h b/athena/main/athena_launcher.h index c256e7d..cf08dc7 100644 --- a/athena/main/athena_launcher.h +++ b/athena/main/athena_launcher.h @@ -22,12 +22,9 @@ class BrowserContext; namespace athena { class ActivityFactory; class AppModelBuilder; -class ScreenManagerDelegate; // Starts down the athena shell environment. -void StartAthenaEnv(aura::Window* root_window, - ScreenManagerDelegate* screen_manager_delegate, - scoped_refptr<base::TaskRunner> file_runner); +void StartAthenaEnv(scoped_refptr<base::TaskRunner> file_runner); void StartAthenaSessionWithContext(content::BrowserContext* context); diff --git a/athena/main/athena_main.cc b/athena/main/athena_main.cc index 3d5408e..29cbd56 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,33 @@ const char kDefaultAppPath[] = } // namespace athena -class AthenaDesktopController : public extensions::ShellDesktopController { +class AthenaDesktopController : public extensions::DesktopController { public: AthenaDesktopController() {} virtual ~AthenaDesktopController() {} private: - // extensions::ShellDesktopController: - virtual wm::FocusRules* CreateFocusRules() OVERRIDE { - return athena::ScreenManager::CreateFocusRules(); + // extensions::DesktopController: + 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 a new app window and adds it to the desktop. The desktop maintains + // ownership of the window. + virtual extensions::ShellAppWindow* CreateAppWindow( + content::BrowserContext* context, + const extensions::Extension* extension) OVERRIDE { + extensions::ShellAppWindow* app_window = new extensions::ShellAppWindow(); + app_window->Init(context, extension, 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 +85,8 @@ 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)); + athena::StartAthenaEnv(content::BrowserThread::GetMessageLoopProxyForThread( + content::BrowserThread::FILE)); athena::StartAthenaSessionWithContext(context); } @@ -105,18 +94,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); }; diff --git a/athena/main/athena_main.gyp b/athena/main/athena_main.gyp index ca41290..21d6e55 100644 --- a/athena/main/athena_main.gyp +++ b/athena/main/athena_main.gyp @@ -63,8 +63,6 @@ '../..', ], 'sources': [ - 'athena_app_window_controller.cc', - 'athena_app_window_controller.h', 'athena_main.cc', ], } |