| Index: wm/shell/content_client/shell_browser_main_parts.cc
|
| diff --git a/ash/shell/content_client/shell_browser_main_parts.cc b/wm/shell/content_client/shell_browser_main_parts.cc
|
| similarity index 55%
|
| copy from ash/shell/content_client/shell_browser_main_parts.cc
|
| copy to wm/shell/content_client/shell_browser_main_parts.cc
|
| index afd91477cd896b789241dbbb636bd8afc4d224dc..675b6b7e5af4e85dce7566b62b52ff8e99eb2e70 100644
|
| --- a/ash/shell/content_client/shell_browser_main_parts.cc
|
| +++ b/wm/shell/content_client/shell_browser_main_parts.cc
|
| @@ -1,35 +1,20 @@
|
| -// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "ash/shell/content_client/shell_browser_main_parts.h"
|
| +#include "wm/shell/content_client/shell_browser_main_parts.h"
|
|
|
| #include "ash/desktop_background/desktop_background_controller.h"
|
| #include "ash/shell.h"
|
| -#include "ash/shell/shell_delegate_impl.h"
|
| #include "ash/shell/window_watcher.h"
|
| -#include "base/bind.h"
|
| -#include "base/command_line.h"
|
| -#include "base/i18n/icu_util.h"
|
| -#include "base/message_loop.h"
|
| -#include "base/string_number_conversions.h"
|
| -#include "base/threading/thread.h"
|
| -#include "base/threading/thread_restrictions.h"
|
| -#include "content/public/common/content_switches.h"
|
| #include "content/shell/shell_browser_context.h"
|
| -#include "googleurl/src/gurl.h"
|
| -#include "net/base/net_module.h"
|
| -#include "ui/aura/client/stacking_client.h"
|
| #include "ui/aura/env.h"
|
| #include "ui/aura/root_window.h"
|
| -#include "ui/aura/window.h"
|
| #include "ui/base/resource/resource_bundle.h"
|
| -#include "ui/base/ui_base_paths.h"
|
| -#include "ui/compositor/compositor.h"
|
| -#include "ui/compositor/test/compositor_test_support.h"
|
| -#include "ui/gfx/screen.h"
|
| -#include "ui/views/focus/accelerator_handler.h"
|
| #include "ui/views/test/test_views_delegate.h"
|
| +#include "wm/foreign_test_window.h"
|
| +#include "wm/gpu/foreign_window_texture_factory.h"
|
| +#include "wm/shell/shell_delegate_impl.h"
|
|
|
| #if defined(OS_LINUX)
|
| #include "ui/base/touch/touch_factory.h"
|
| @@ -42,6 +27,11 @@
|
| namespace ash {
|
| namespace shell {
|
| void InitWindowTypeLauncher();
|
| +} // namespace shell
|
| +} // namespace ash
|
| +
|
| +namespace wm {
|
| +namespace shell {
|
|
|
| namespace {
|
| class ShellViewsDelegate : public views::TestViewsDelegate {
|
| @@ -54,19 +44,10 @@ class ShellViewsDelegate : public views::TestViewsDelegate {
|
| views::Widget* widget) OVERRIDE {
|
| return ash::Shell::GetInstance()->CreateDefaultNonClientFrameView(widget);
|
| }
|
| - virtual bool UseTransparentWindows() const OVERRIDE {
|
| + bool UseTransparentWindows() const OVERRIDE {
|
| // Ash uses transparent window frames.
|
| return true;
|
| }
|
| - virtual void OnBeforeWidgetInit(
|
| - views::Widget::InitParams* params,
|
| - views::internal::NativeWidgetDelegate* delegate) OVERRIDE {
|
| - if (params->native_widget)
|
| - return;
|
| -
|
| - if (!params->parent && !params->context && params->top_level)
|
| - params->context = Shell::GetPrimaryRootWindow();
|
| - }
|
|
|
| private:
|
| DISALLOW_COPY_AND_ASSIGN(ShellViewsDelegate);
|
| @@ -76,20 +57,17 @@ class ShellViewsDelegate : public views::TestViewsDelegate {
|
|
|
| ShellBrowserMainParts::ShellBrowserMainParts(
|
| const content::MainFunctionParams& parameters)
|
| - : BrowserMainParts(),
|
| - delegate_(NULL) {
|
| + : BrowserMainParts() {
|
| }
|
|
|
| ShellBrowserMainParts::~ShellBrowserMainParts() {
|
| }
|
|
|
| -#if !defined(OS_MACOSX)
|
| void ShellBrowserMainParts::PreMainMessageLoopStart() {
|
| #if defined(OS_LINUX)
|
| ui::TouchFactory::SetTouchDeviceListFromCommandLine();
|
| #endif
|
| }
|
| -#endif
|
|
|
| void ShellBrowserMainParts::PostMainMessageLoopStart() {
|
| #if defined(OS_CHROMEOS)
|
| @@ -98,43 +76,43 @@ void ShellBrowserMainParts::PostMainMessageLoopStart() {
|
| }
|
|
|
| void ShellBrowserMainParts::PreMainMessageLoopRun() {
|
| + ForeignWindowTextureFactory::Initialize();
|
| +
|
| browser_context_.reset(new content::ShellBrowserContext(false));
|
|
|
| // A ViewsDelegate is required.
|
| if (!views::ViewsDelegate::views_delegate)
|
| views::ViewsDelegate::views_delegate = new ShellViewsDelegate;
|
|
|
| - delegate_ = new ash::shell::ShellDelegateImpl;
|
| - ash::Shell::CreateInstance(delegate_);
|
| + wm::shell::ShellDelegateImpl* delegate = new wm::shell::ShellDelegateImpl;
|
| + ash::Shell::CreateInstance(delegate);
|
| ash::Shell::GetInstance()->set_browser_context(browser_context_.get());
|
|
|
| window_watcher_.reset(new ash::shell::WindowWatcher);
|
| - gfx::Screen* screen = Shell::GetInstance()->GetScreen();
|
| - screen->AddObserver(window_watcher_.get());
|
| - delegate_->SetWatcher(window_watcher_.get());
|
| + delegate->SetWatcher(window_watcher_.get());
|
|
|
| ash::shell::InitWindowTypeLauncher();
|
|
|
| - DesktopBackgroundController* controller =
|
| - Shell::GetInstance()->desktop_background_controller();
|
| - if (controller->GetAppropriateResolution() == WALLPAPER_RESOLUTION_LARGE)
|
| - controller->SetDefaultWallpaper(kDefaultLargeWallpaper);
|
| + ash::DesktopBackgroundController* controller =
|
| + ash::Shell::GetInstance()->desktop_background_controller();
|
| + if (controller->GetAppropriateResolution() == ash::WALLPAPER_RESOLUTION_LARGE)
|
| + controller->SetDefaultWallpaper(ash::kDefaultLargeWallpaper);
|
| else
|
| - controller->SetDefaultWallpaper(kDefaultSmallWallpaper);
|
| + controller->SetDefaultWallpaper(ash::kDefaultSmallWallpaper);
|
| +
|
| + ForeignTestWindow::CreateParams params(ash::Shell::GetPrimaryRootWindow());
|
| + foreign_test_window_.reset(new ForeignTestWindow(params));
|
| + foreign_test_window_->Show();
|
|
|
| ash::Shell::GetPrimaryRootWindow()->ShowRootWindow();
|
| }
|
|
|
| void ShellBrowserMainParts::PostMainMessageLoopRun() {
|
| browser_context_.reset();
|
| - gfx::Screen* screen = Shell::GetInstance()->GetScreen();
|
| - screen->RemoveObserver(window_watcher_.get());
|
| -
|
| window_watcher_.reset();
|
| - delegate_->SetWatcher(NULL);
|
| - delegate_ = NULL;
|
| ash::Shell::DeleteInstance();
|
| aura::Env::DeleteInstance();
|
| + ForeignWindowTextureFactory::Terminate();
|
| }
|
|
|
| bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) {
|
| @@ -143,4 +121,4 @@ bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) {
|
| }
|
|
|
| } // namespace shell
|
| -} // namespace ash
|
| +} // namespace wm
|
|
|