diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-16 19:25:41 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-16 19:25:41 +0000 |
commit | 984522c27db175de6fc1835fb6ef2d4327aa7657 (patch) | |
tree | afcd1b6e5e459c82b5e7246da297fb74147903bf /content/shell | |
parent | c115677e34ec8c23b604570e546b1881091fbcf6 (diff) | |
download | chromium_src-984522c27db175de6fc1835fb6ef2d4327aa7657.zip chromium_src-984522c27db175de6fc1835fb6ef2d4327aa7657.tar.gz chromium_src-984522c27db175de6fc1835fb6ef2d4327aa7657.tar.bz2 |
Revert 177182 - ViewTest.ChangeNativeViewHierarchyFindRoots failure
> Finally rip the global StackingClient bandaid off.
>
> - Removes the aura::client::SetStackingClient(StackingClient*) interface.
> - Moves the ash StackingController from a singleton owned by ash::Shell to one StackingController per RootWindow owned by the ash::RootWindowController. (Also removes a spurious delegate method, where every implementation creates the same object, including tests.)
> - Removes the global DesktopStackingClient and related interfaces.
> - Fix the ChromeViewsDelegate so that it still sets context in chromeos builds.
> - Rename content::ShellStackingClientAsh to content::MinimalAsh to reflect what it really does.
>
> In addition, the following fix ups apply:
>
> - Previously, WebContentsViewAura asserted that it needed a context window. Now if no context window is provided, it isn't added to an aura hierarchy. There are times when that context doesn't exist: various chromeos dialogs that directly invoke WebView and toplevel extension/app windows that are created from background pages that don't have contexts.
>
> BUG=161882
>
> Review URL: https://codereview.chromium.org/11829040
TBR=erg@chromium.org
Review URL: https://codereview.chromium.org/11962021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177190 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/shell')
-rw-r--r-- | content/shell/minimal_ash.cc | 53 | ||||
-rw-r--r-- | content/shell/shell.h | 15 | ||||
-rw-r--r-- | content/shell/shell_aura.cc | 27 | ||||
-rw-r--r-- | content/shell/shell_stacking_client_ash.cc | 56 | ||||
-rw-r--r-- | content/shell/shell_stacking_client_ash.h (renamed from content/shell/minimal_ash.h) | 14 |
5 files changed, 79 insertions, 86 deletions
diff --git a/content/shell/minimal_ash.cc b/content/shell/minimal_ash.cc deleted file mode 100644 index e1ff94a..0000000 --- a/content/shell/minimal_ash.cc +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2012 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 "content/shell/minimal_ash.h" - -#include "ui/aura/client/default_capture_client.h" -#include "ui/aura/focus_manager.h" -#include "ui/aura/root_window.h" -#include "ui/aura/test/test_activation_client.h" -#include "ui/views/corewm/compound_event_filter.h" -#include "ui/views/corewm/input_method_event_filter.h" - -namespace content { - -MinimalAsh::MinimalAsh() { - root_window_.reset(new aura::RootWindow( - aura::RootWindow::CreateParams(gfx::Rect(100, 100)))); - root_window_->Init(); - aura::client::SetStackingClient(root_window_.get(), this); - - focus_client_.reset(new aura::FocusManager); - aura::client::SetFocusClient(root_window_.get(), focus_client_.get()); - - root_window_event_filter_ = new views::corewm::CompoundEventFilter; - // Pass ownership of the filter to the root_window. - root_window_->SetEventFilter(root_window_event_filter_); - - input_method_filter_.reset(new views::corewm::InputMethodEventFilter( - root_window_->GetAcceleratedWidget())); - input_method_filter_->SetInputMethodPropertyInRootWindow( - root_window_.get()); - root_window_event_filter_->AddHandler(input_method_filter_.get()); - - test_activation_client_.reset( - new aura::test::TestActivationClient(root_window_.get())); - - capture_client_.reset( - new aura::client::DefaultCaptureClient(root_window_.get())); -} - -MinimalAsh::~MinimalAsh() { - root_window_event_filter_->RemoveHandler(input_method_filter_.get()); -} - -aura::Window* MinimalAsh::GetDefaultParent( - aura::Window* context, - aura::Window* window, - const gfx::Rect& bounds) { - return root_window_.get(); -} - -} // namespace content diff --git a/content/shell/shell.h b/content/shell/shell.h index e2162e8..82e2a6a 100644 --- a/content/shell/shell.h +++ b/content/shell/shell.h @@ -1,6 +1,7 @@ // Copyright (c) 2012 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. + #ifndef CONTENT_SHELL_SHELL_H_ #define CONTENT_SHELL_SHELL_H_ @@ -26,15 +27,15 @@ typedef struct _GtkToolItem GtkToolItem; #elif defined(OS_ANDROID) #include "base/android/scoped_java_ref.h" #elif defined(USE_AURA) -#if defined(OS_CHROMEOS) -namespace content { -class MinimalAsh; -} -#endif namespace views { class Widget; class ViewsDelegate; } +namespace aura { +namespace client { +class StackingClient; +} +} #endif class GURL; @@ -236,9 +237,7 @@ class Shell : public WebContentsDelegate, #elif defined(OS_ANDROID) base::android::ScopedJavaGlobalRef<jobject> java_object_; #elif defined(USE_AURA) -#if defined(OS_CHROMEOS) - static content::MinimalAsh* minimal_ash_; -#endif + static aura::client::StackingClient* stacking_client_; static views::ViewsDelegate* views_delegate_; views::Widget* window_widget_; diff --git a/content/shell/shell_aura.cc b/content/shell/shell_aura.cc index 6641cda..a0986c4 100644 --- a/content/shell/shell_aura.cc +++ b/content/shell/shell_aura.cc @@ -29,8 +29,10 @@ #if defined(OS_CHROMEOS) #include "chromeos/dbus/dbus_thread_manager.h" -#include "content/shell/minimal_ash.h" +#include "content/shell/shell_stacking_client_ash.h" #include "ui/aura/test/test_screen.h" +#else +#include "ui/views/widget/desktop_aura/desktop_stacking_client.h" #endif // ViewDelegate implementation for aura content shell @@ -272,9 +274,7 @@ using views::ShellWindowDelegateView; namespace content { -#if defined(OS_CHROMEOS) -MinimalAsh* Shell::minimal_ash_ = NULL; -#endif +aura::client::StackingClient* Shell::stacking_client_ = NULL; views::ViewsDelegate* Shell::views_delegate_ = NULL; // static @@ -283,21 +283,21 @@ void Shell::PlatformInitialize() { chromeos::DBusThreadManager::Initialize(); #endif #if defined(OS_CHROMEOS) + stacking_client_ = new content::ShellStackingClientAsh(); gfx::Screen::SetScreenInstance( gfx::SCREEN_TYPE_NATIVE, new aura::TestScreen); - minimal_ash_ = new content::MinimalAsh(); #else + stacking_client_ = new views::DesktopStackingClient(); gfx::Screen::SetScreenInstance( gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen()); #endif + aura::client::SetStackingClient(stacking_client_); views_delegate_ = new ShellViewsDelegateAura(); } void Shell::PlatformExit() { -#if defined(OS_CHROMEOS) - if (minimal_ash_) - delete minimal_ash_; -#endif + if (stacking_client_) + delete stacking_client_; if (views_delegate_) delete views_delegate_; #if defined(OS_CHROMEOS) @@ -334,18 +334,9 @@ void Shell::PlatformSetIsLoading(bool loading) { } void Shell::PlatformCreateWindow(int width, int height) { -#if defined(OS_CHROMEOS) - window_widget_ = - views::Widget::CreateWindowWithContextAndBounds( - new ShellWindowDelegateView(this), - minimal_ash_->GetDefaultParent(NULL, NULL, gfx::Rect()), - gfx::Rect(0, 0, width, height)); -#else window_widget_ = views::Widget::CreateWindowWithBounds(new ShellWindowDelegateView(this), gfx::Rect(0, 0, width, height)); -#endif - window_ = window_widget_->GetNativeWindow(); window_widget_->Show(); } diff --git a/content/shell/shell_stacking_client_ash.cc b/content/shell/shell_stacking_client_ash.cc new file mode 100644 index 0000000..f9e7c0a --- /dev/null +++ b/content/shell/shell_stacking_client_ash.cc @@ -0,0 +1,56 @@ +// Copyright (c) 2012 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 "content/shell/shell_stacking_client_ash.h" + +#include "ui/aura/client/default_capture_client.h" +#include "ui/aura/focus_manager.h" +#include "ui/aura/root_window.h" +#include "ui/aura/test/test_activation_client.h" +#include "ui/views/corewm/compound_event_filter.h" +#include "ui/views/corewm/input_method_event_filter.h" + +namespace content { + +ShellStackingClientAsh::ShellStackingClientAsh() { +} + +ShellStackingClientAsh::~ShellStackingClientAsh() { + if (root_window_.get()) + root_window_event_filter_->RemoveHandler(input_method_filter_.get()); + + aura::client::SetStackingClient(NULL); +} + +aura::Window* ShellStackingClientAsh::GetDefaultParent( + aura::Window* context, + aura::Window* window, + const gfx::Rect& bounds) { + if (!root_window_.get()) { + root_window_.reset(new aura::RootWindow( + aura::RootWindow::CreateParams(gfx::Rect(100, 100)))); + root_window_->Init(); + focus_client_.reset(new aura::FocusManager); + aura::client::SetFocusClient(root_window_.get(), focus_client_.get()); + + root_window_event_filter_ = new views::corewm::CompoundEventFilter; + // Pass ownership of the filter to the root_window. + root_window_->SetEventFilter(root_window_event_filter_); + + input_method_filter_.reset(new views::corewm::InputMethodEventFilter( + root_window_->GetAcceleratedWidget())); + input_method_filter_->SetInputMethodPropertyInRootWindow( + root_window_.get()); + root_window_event_filter_->AddHandler(input_method_filter_.get()); + + test_activation_client_.reset( + new aura::test::TestActivationClient(root_window_.get())); + + capture_client_.reset( + new aura::client::DefaultCaptureClient(root_window_.get())); + } + return root_window_.get(); +} + +} // namespace content diff --git a/content/shell/minimal_ash.h b/content/shell/shell_stacking_client_ash.h index f3ec43b..de169c4 100644 --- a/content/shell/minimal_ash.h +++ b/content/shell/shell_stacking_client_ash.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_SHELL_MINIMAL_ASH_H_ -#define CONTENT_SHELL_MINIMAL_ASH_H_ +#ifndef CONTENT_SHELL_SHELL_STACKING_CLIENT_ASH_H_ +#define CONTENT_SHELL_SHELL_STACKING_CLIENT_ASH_H_ #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" @@ -37,10 +37,10 @@ namespace content { // Creates a minimal environment for running the shell. We can't pull in all of // ash here, but we can create attach several of the same things we'd find in // the ash parts of the code. -class MinimalAsh : public aura::client::StackingClient { +class ShellStackingClientAsh : public aura::client::StackingClient { public: - MinimalAsh(); - virtual ~MinimalAsh(); + ShellStackingClientAsh(); + virtual ~ShellStackingClientAsh(); // Overridden from client::StackingClient: virtual aura::Window* GetDefaultParent(aura::Window* context, @@ -58,9 +58,9 @@ class MinimalAsh : public aura::client::StackingClient { scoped_ptr<aura::test::TestActivationClient> test_activation_client_; scoped_ptr<aura::client::FocusClient> focus_client_; - DISALLOW_COPY_AND_ASSIGN(MinimalAsh); + DISALLOW_COPY_AND_ASSIGN(ShellStackingClientAsh); }; } // namespace content; -#endif // CONTENT_SHELL_MINIMAL_ASH_H_ +#endif // CONTENT_SHELL_SHELL_STACKING_CLIENT_ASH_H_ |