summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-14 01:10:46 +0000
committerscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-14 01:10:46 +0000
commitd8f1004bcf08a2c0d629198a3695808b3a400487 (patch)
tree77d0c11dfba7586a6a85347cabb2c3e83d8735ce
parente32934786cf3edc23e2055c7f898d1ef77eced59 (diff)
downloadchromium_src-d8f1004bcf08a2c0d629198a3695808b3a400487.zip
chromium_src-d8f1004bcf08a2c0d629198a3695808b3a400487.tar.gz
chromium_src-d8f1004bcf08a2c0d629198a3695808b3a400487.tar.bz2
re-re-land of https://codereview.chromium.org/11364053/
First attempt here: https://codereview.chromium.org/11364053/ : failed linux_chromeos_asan Second attempt here: http://codereview.chromium.org/11362216/ : collided with renames in http://crrev.com/167418 This cl is the same as the second attempt, with the namespaces and includes updated for file renames. TBR=ben@chromium.org BUG=128578 Review URL: https://chromiumcodereview.appspot.com/11377140 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167547 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ash/shell.cc9
-rw-r--r--ash/shell.h6
-rw-r--r--ash/shell/shell_delegate_impl.cc4
-rw-r--r--ash/shell/shell_delegate_impl.h1
-rw-r--r--ash/shell_delegate.h4
-rw-r--r--ash/test/test_shell_delegate.cc5
-rw-r--r--ash/test/test_shell_delegate.h1
-rw-r--r--ash/wm/stacking_controller.cc8
-rw-r--r--ash/wm/stacking_controller.h10
-rw-r--r--chrome/browser/prerender/prerender_manager.cc4
-rw-r--r--chrome/browser/prerender/prerender_unittest.cc4
-rw-r--r--chrome/browser/ui/ash/chrome_shell_delegate.cc5
-rw-r--r--chrome/browser/ui/ash/chrome_shell_delegate.h1
-rw-r--r--chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.cc3
-rw-r--r--chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.h8
-rw-r--r--chrome/browser/ui/aura/stacking_client_aura.cc6
-rw-r--r--chrome/browser/ui/aura/stacking_client_aura.h4
-rw-r--r--chrome/browser/ui/browser_commands.cc4
-rw-r--r--chrome/browser/ui/browser_tabstrip.cc5
-rw-r--r--chrome/browser/ui/views/frame/browser_frame.cc9
-rw-r--r--chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc1
-rw-r--r--chrome/browser/ui/views/status_bubble_views.cc1
-rw-r--r--chrome/chrome_browser_ui.gypi2
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura.cc6
-rw-r--r--content/shell/shell_aura.cc1
-rw-r--r--content/shell/shell_stacking_client_ash.cc2
-rw-r--r--content/shell/shell_stacking_client_ash.h3
-rw-r--r--ui/aura/client/stacking_client.cc22
-rw-r--r--ui/aura/client/stacking_client.h18
-rw-r--r--ui/aura/demo/demo_main.cc3
-rw-r--r--ui/aura/desktop/desktop_stacking_client.cc60
-rw-r--r--ui/aura/desktop/desktop_stacking_client.h65
-rw-r--r--ui/aura/test/test_stacking_client.cc3
-rw-r--r--ui/aura/test/test_stacking_client.h3
-rw-r--r--ui/aura/window.cc3
-rw-r--r--ui/views/examples/content_client/examples_browser_main_parts.cc1
-rw-r--r--ui/views/widget/desktop_aura/desktop_native_widget_aura.cc29
-rw-r--r--ui/views/widget/desktop_aura/desktop_native_widget_aura.h2
-rw-r--r--ui/views/widget/desktop_aura/desktop_stacking_client.cc3
-rw-r--r--ui/views/widget/desktop_aura/desktop_stacking_client.h3
-rw-r--r--ui/views/widget/native_widget_aura.cc4
-rw-r--r--ui/views/widget/widget.cc6
-rw-r--r--ui/views/widget/widget.h4
43 files changed, 123 insertions, 223 deletions
diff --git a/ash/shell.cc b/ash/shell.cc
index e95d1d7..bac0bb6 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -67,6 +67,7 @@
#include "base/command_line.h"
#include "base/debug/leak_annotations.h"
#include "ui/aura/client/aura_constants.h"
+#include "ui/aura/client/stacking_client.h"
#include "ui/aura/client/user_action_client.h"
#include "ui/aura/display_manager.h"
#include "ui/aura/env.h"
@@ -455,7 +456,9 @@ void Shell::Init() {
// Create Controllers that may need root window.
// TODO(oshima): Move as many controllers before creating
// RootWindowController as possible.
- stacking_controller_.reset(new internal::StackingController);
+ stacking_client_.reset(delegate_->CreateStackingClient());
+ if (stacking_client_.get())
+ aura::client::SetStackingClient(stacking_client_.get());
visibility_controller_.reset(new internal::VisibilityController);
drag_drop_controller_.reset(new internal::DragDropController);
user_action_client_.reset(delegate_->CreateUserActionClient());
@@ -764,6 +767,10 @@ void Shell::DoInitialWorkspaceAnimation() {
DoInitialAnimation();
}
+aura::client::StackingClient* Shell::stacking_client() {
+ return stacking_client_.get();
+}
+
void Shell::InitRootWindowController(
internal::RootWindowController* controller) {
aura::RootWindow* root_window = controller->root_window();
diff --git a/ash/shell.h b/ash/shell.h
index 6ceb339..8e27380 100644
--- a/ash/shell.h
+++ b/ash/shell.h
@@ -31,6 +31,7 @@ class FocusManager;
class RootWindow;
class Window;
namespace client {
+class StackingClient;
class UserActionClient;
}
}
@@ -99,7 +100,6 @@ class RootWindowLayoutManager;
class ScreenPositionController;
class ShadowController;
class SlowAnimationEventFilter;
-class StackingController;
class StatusAreaWidget;
class SystemGestureEventFilter;
class SystemModalContainerEventFilter;
@@ -405,6 +405,8 @@ class ASH_EXPORT Shell : internal::SystemModalContainerEventFilterDelegate,
}
#endif // defined(OS_CHROMEOS)
+ aura::client::StackingClient* stacking_client();
+
private:
FRIEND_TEST_ALL_PREFIXES(ExtendedDesktopTest, TestCursor);
FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, MouseEventCursors);
@@ -463,7 +465,7 @@ class ASH_EXPORT Shell : internal::SystemModalContainerEventFilterDelegate,
scoped_ptr<internal::AppListController> app_list_controller_;
- scoped_ptr<internal::StackingController> stacking_controller_;
+ scoped_ptr<aura::client::StackingClient> stacking_client_;
scoped_ptr<internal::ActivationController> activation_controller_;
scoped_ptr<internal::CaptureController> capture_controller_;
scoped_ptr<internal::WindowModalityController> window_modality_controller_;
diff --git a/ash/shell/shell_delegate_impl.cc b/ash/shell/shell_delegate_impl.cc
index 380af07..206a476 100644
--- a/ash/shell/shell_delegate_impl.cc
+++ b/ash/shell/shell_delegate_impl.cc
@@ -173,5 +173,9 @@ ui::MenuModel* ShellDelegateImpl::CreateContextMenu(aura::RootWindow* root) {
return new ContextMenu(root);
}
+aura::client::StackingClient* ShellDelegateImpl::CreateStackingClient() {
+ return NULL;
+}
+
} // namespace shell
} // namespace ash
diff --git a/ash/shell/shell_delegate_impl.h b/ash/shell/shell_delegate_impl.h
index 987c7af..6f55237 100644
--- a/ash/shell/shell_delegate_impl.h
+++ b/ash/shell/shell_delegate_impl.h
@@ -59,6 +59,7 @@ class ShellDelegateImpl : public ash::ShellDelegate {
virtual double GetSavedScreenMagnifierScale() OVERRIDE;
virtual ui::MenuModel* CreateContextMenu(
aura::RootWindow* root_window) OVERRIDE;
+ virtual aura::client::StackingClient* CreateStackingClient() OVERRIDE;
private:
// Used to update Launcher. Owned by main.
diff --git a/ash/shell_delegate.h b/ash/shell_delegate.h
index 5f69459..6f3c7f3 100644
--- a/ash/shell_delegate.h
+++ b/ash/shell_delegate.h
@@ -21,6 +21,7 @@ namespace aura {
class RootWindow;
class Window;
namespace client {
+class StackingClient;
class UserActionClient;
}
}
@@ -181,6 +182,9 @@ class ASH_EXPORT ShellDelegate {
// Creates a menu model of the context for the |root_window|.
virtual ui::MenuModel* CreateContextMenu(aura::RootWindow* root_window) = 0;
+
+ // Creates the stacking client. Shell takes ownership of the object.
+ virtual aura::client::StackingClient* CreateStackingClient() = 0;
};
} // namespace ash
diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc
index b3706db..e406d76 100644
--- a/ash/test/test_shell_delegate.cc
+++ b/ash/test/test_shell_delegate.cc
@@ -10,6 +10,7 @@
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/test/test_launcher_delegate.h"
+#include "ash/wm/stacking_controller.h"
#include "ash/wm/window_util.h"
#include "content/public/test/test_browser_context.h"
#include "ui/aura/window.h"
@@ -161,6 +162,10 @@ double TestShellDelegate::GetSavedScreenMagnifierScale() {
return std::numeric_limits<double>::min();
}
+aura::client::StackingClient* TestShellDelegate::CreateStackingClient() {
+ return new StackingController;
+}
+
void TestShellDelegate::SetSessionStarted(bool session_started) {
session_started_ = session_started;
if (session_started)
diff --git a/ash/test/test_shell_delegate.h b/ash/test/test_shell_delegate.h
index 8138aa8..f96c370 100644
--- a/ash/test/test_shell_delegate.h
+++ b/ash/test/test_shell_delegate.h
@@ -57,6 +57,7 @@ class TestShellDelegate : public ShellDelegate {
virtual void SaveScreenMagnifierScale(double scale) OVERRIDE;
virtual double GetSavedScreenMagnifierScale() OVERRIDE;
virtual ui::MenuModel* CreateContextMenu(aura::RootWindow* root) OVERRIDE;
+ virtual aura::client::StackingClient* CreateStackingClient() OVERRIDE;
int num_exit_requests() const { return num_exit_requests_; }
private:
diff --git a/ash/wm/stacking_controller.cc b/ash/wm/stacking_controller.cc
index c2f6545..a9df31d 100644
--- a/ash/wm/stacking_controller.cc
+++ b/ash/wm/stacking_controller.cc
@@ -17,7 +17,6 @@
#include "ui/base/ui_base_types.h"
namespace ash {
-namespace internal {
namespace {
// Find a root window that matches the |bounds|. If the virtual screen
@@ -56,7 +55,6 @@ bool IsWindowModal(aura::Window* window) {
// StackingController, public:
StackingController::StackingController() {
- aura::client::SetStackingClient(this);
}
StackingController::~StackingController() {
@@ -65,7 +63,8 @@ StackingController::~StackingController() {
////////////////////////////////////////////////////////////////////////////////
// StackingController, aura::StackingClient implementation:
-aura::Window* StackingController::GetDefaultParent(aura::Window* window,
+aura::Window* StackingController::GetDefaultParent(aura::Window* context,
+ aura::Window* window,
const gfx::Rect& bounds) {
aura::RootWindow* target_root = NULL;
if (window->transient_parent()) {
@@ -149,10 +148,9 @@ StackingController::GetAlwaysOnTopController(aura::RootWindow* root_window) {
root_window->GetChildById(
internal::kShellWindowId_AlwaysOnTopContainer));
// RootWindow owns the AlwaysOnTopController object.
- root_window->SetProperty(kAlwaysOnTopControllerKey, controller);
+ root_window->SetProperty(internal::kAlwaysOnTopControllerKey, controller);
}
return controller;
}
-} // namespace internal
} // namespace ash
diff --git a/ash/wm/stacking_controller.h b/ash/wm/stacking_controller.h
index ae90555..21611ed 100644
--- a/ash/wm/stacking_controller.h
+++ b/ash/wm/stacking_controller.h
@@ -5,6 +5,7 @@
#ifndef ASH_WM_STACKING_CONTROLLER_H_
#define ASH_WM_STACKING_CONTROLLER_H_
+#include "ash/ash_export.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
@@ -15,17 +16,19 @@ class RootWindow;
}
namespace ash {
-namespace internal {
+namespace internal {
class AlwaysOnTopController;
+}
-class StackingController : public aura::client::StackingClient {
+class ASH_EXPORT StackingController : public aura::client::StackingClient {
public:
StackingController();
virtual ~StackingController();
// Overridden from aura::client::StackingClient:
- virtual aura::Window* GetDefaultParent(aura::Window* window,
+ virtual aura::Window* GetDefaultParent(aura::Window* context,
+ aura::Window* window,
const gfx::Rect& bounds) OVERRIDE;
private:
@@ -44,7 +47,6 @@ class StackingController : public aura::client::StackingClient {
DISALLOW_COPY_AND_ASSIGN(StackingController);
};
-} // namespace internal
} // namespace ash
#endif // ASH_WM_STACKING_CONTROLLER_H_
diff --git a/chrome/browser/prerender/prerender_manager.cc b/chrome/browser/prerender/prerender_manager.cc
index 5e7d093..c4169d8 100644
--- a/chrome/browser/prerender/prerender_manager.cc
+++ b/chrome/browser/prerender/prerender_manager.cc
@@ -236,6 +236,10 @@ PrerenderHandle* PrerenderManager::AddPrerenderFromLinkRelPrerender(
// TODO(jcivelli): http://crbug.com/113322 We should have an option to disable
// link-prerender and enable omnibox-prerender only.
return NULL;
+#elif defined(OS_WIN) && defined(USE_AURA)
+ // TODO(scottmg): http://crbug.com/128578 WebContentsViewAura can't get a
+ // valid parent window here.
+ return NULL;
#else
DCHECK(!size.IsEmpty());
Origin origin = ORIGIN_LINK_REL_PRERENDER_CROSSDOMAIN;
diff --git a/chrome/browser/prerender/prerender_unittest.cc b/chrome/browser/prerender/prerender_unittest.cc
index a839fed..665c8f7 100644
--- a/chrome/browser/prerender/prerender_unittest.cc
+++ b/chrome/browser/prerender/prerender_unittest.cc
@@ -317,6 +317,8 @@ class PrerenderTest : public testing::Test {
int last_prerender_id_;
};
+// TODO(scottmg): http://crbug.com/128578
+#if !defined(OS_WIN) && !defined(USE_AURA)
TEST_F(PrerenderTest, FoundTest) {
GURL url("http://www.google.com/");
DummyPrerenderContents* prerender_contents =
@@ -1161,4 +1163,6 @@ TEST_F(PrerenderTest, LinkManagerCancelThenAddAgain) {
EXPECT_FALSE(IsEmptyPrerenderLinkManager());
}
+#endif // OS_WIN && USE_AURA
+
} // namespace prerender
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.cc b/chrome/browser/ui/ash/chrome_shell_delegate.cc
index 624b2c8..6e2975a 100644
--- a/chrome/browser/ui/ash/chrome_shell_delegate.cc
+++ b/chrome/browser/ui/ash/chrome_shell_delegate.cc
@@ -6,6 +6,7 @@
#include "ash/launcher/launcher_types.h"
#include "ash/system/tray/system_tray_delegate.h"
+#include "ash/wm/stacking_controller.h"
#include "ash/wm/window_util.h"
#include "base/bind.h"
#include "base/command_line.h"
@@ -471,6 +472,10 @@ ui::MenuModel* ChromeShellDelegate::CreateContextMenu(aura::RootWindow* root) {
return new LauncherContextMenu(launcher_delegate_, root);
}
+aura::client::StackingClient* ChromeShellDelegate::CreateStackingClient() {
+ return new ash::StackingController;
+}
+
void ChromeShellDelegate::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.h b/chrome/browser/ui/ash/chrome_shell_delegate.h
index 3795833..f108fe7 100644
--- a/chrome/browser/ui/ash/chrome_shell_delegate.h
+++ b/chrome/browser/ui/ash/chrome_shell_delegate.h
@@ -73,6 +73,7 @@ class ChromeShellDelegate : public ash::ShellDelegate,
virtual void SaveScreenMagnifierScale(double scale) OVERRIDE;
virtual double GetSavedScreenMagnifierScale() OVERRIDE;
virtual ui::MenuModel* CreateContextMenu(aura::RootWindow* root) OVERRIDE;
+ virtual aura::client::StackingClient* CreateStackingClient() OVERRIDE;
// content::NotificationObserver override:
virtual void Observe(int type,
diff --git a/chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.cc b/chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.cc
index 2b854e0e..c5cf354 100644
--- a/chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.cc
+++ b/chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/chrome_browser_main.h"
#include "chrome/browser/toolkit_extra_parts.h"
+#include "chrome/browser/ui/aura/stacking_client_aura.h"
#include "ui/aura/env.h"
#include "ui/aura/single_display_manager.h"
#include "ui/gfx/screen.h"
@@ -16,6 +17,7 @@
#if defined(OS_LINUX)
#include "chrome/browser/ui/libgtk2ui/gtk2_ui.h"
#include "ui/base/linux_ui.h"
+#else
#endif
#if defined(USE_ASH)
@@ -38,6 +40,7 @@ void ChromeBrowserMainExtraPartsAura::PreProfileInit() {
views::CreateDesktopScreen());
aura::Env::GetInstance()->SetDisplayManager(new aura::SingleDisplayManager);
stacking_client_.reset(new views::DesktopStackingClient);
+ aura::client::SetStackingClient(stacking_client_.get());
}
#endif
diff --git a/chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.h b/chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.h
index 1f4128a..3f0784a 100644
--- a/chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.h
+++ b/chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.h
@@ -10,8 +10,10 @@
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/chrome_browser_main_extra_parts.h"
-namespace views {
-class DesktopStackingClient;
+namespace aura {
+namespace client {
+class StackingClient;
+}
}
class ChromeBrowserMainExtraPartsAura : public ChromeBrowserMainExtraParts {
@@ -24,7 +26,7 @@ class ChromeBrowserMainExtraPartsAura : public ChromeBrowserMainExtraParts {
virtual void PostMainMessageLoopRun() OVERRIDE;
private:
- scoped_ptr<views::DesktopStackingClient> stacking_client_;
+ scoped_ptr<aura::client::StackingClient> stacking_client_;
DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainExtraPartsAura);
};
diff --git a/chrome/browser/ui/aura/stacking_client_aura.cc b/chrome/browser/ui/aura/stacking_client_aura.cc
index 569c7a5..e2e70e4 100644
--- a/chrome/browser/ui/aura/stacking_client_aura.cc
+++ b/chrome/browser/ui/aura/stacking_client_aura.cc
@@ -6,14 +6,14 @@
#include "ash/shell.h"
#include "ash/wm/stacking_controller.h"
-#include "ui/aura/desktop/desktop_stacking_client.h"
#include "ui/aura/focus_manager.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
-#include "ui/views/widget/desktop_native_widget_aura.h"
+#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
+#include "ui/views/widget/desktop_aura/desktop_stacking_client.h"
StackingClientAura::StackingClientAura() {
- desktop_stacking_client_.reset(new aura::DesktopStackingClient);
+ desktop_stacking_client_.reset(new views::DesktopStackingClient);
}
StackingClientAura::~StackingClientAura() {
diff --git a/chrome/browser/ui/aura/stacking_client_aura.h b/chrome/browser/ui/aura/stacking_client_aura.h
index 9bbd5a4..e478df8 100644
--- a/chrome/browser/ui/aura/stacking_client_aura.h
+++ b/chrome/browser/ui/aura/stacking_client_aura.h
@@ -16,7 +16,7 @@ namespace ash {
class StackingController;
}
-namespace aura {
+namespace views {
class DesktopStackingClient;
class Window;
}
@@ -34,7 +34,7 @@ class StackingClientAura : public aura::client::StackingClient {
const gfx::Rect& bounds) OVERRIDE;
private:
- scoped_ptr<aura::DesktopStackingClient> desktop_stacking_client_;
+ scoped_ptr<views::DesktopStackingClient> desktop_stacking_client_;
DISALLOW_COPY_AND_ASSIGN(StackingClientAura);
};
diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc
index d5f3744..a01c791 100644
--- a/chrome/browser/ui/browser_commands.cc
+++ b/chrome/browser/ui/browser_commands.cc
@@ -306,6 +306,10 @@ void NewEmptyWindow(Profile* profile) {
}
Browser* OpenEmptyWindow(Profile* profile, HostDesktopType desktop_type) {
+ // TODO(scottmg): http://crbug.com/128578
+ // This is necessary because WebContentsViewAura doesn't have enough context
+ // to get the right StackingClient (and therefore parent window) otherwise.
+ ScopedForceDesktopType force_desktop_type(desktop_type);
Browser* browser = new Browser(
Browser::CreateParams(Browser::TYPE_TABBED, profile, desktop_type));
AddBlankTabAt(browser, -1, true);
diff --git a/chrome/browser/ui/browser_tabstrip.cc b/chrome/browser/ui/browser_tabstrip.cc
index d060db9..9273b7c 100644
--- a/chrome/browser/ui/browser_tabstrip.cc
+++ b/chrome/browser/ui/browser_tabstrip.cc
@@ -56,6 +56,11 @@ void ActivateTabAt(Browser* browser, int index, bool user_gesture) {
}
void AddBlankTabAt(Browser* browser, int index, bool foreground) {
+ // TODO(scottmg): http://crbug.com/128578
+ // This is necessary because WebContentsViewAura doesn't have enough context
+ // to get the right StackingClient (and therefore parent window) otherwise.
+ ScopedForceDesktopType force_desktop_type(browser->host_desktop_type());
+
// Time new tab page creation time. We keep track of the timing data in
// WebContents, but we want to include the time it takes to create the
// WebContents object too.
diff --git a/chrome/browser/ui/views/frame/browser_frame.cc b/chrome/browser/ui/views/frame/browser_frame.cc
index 5561dc5..b0d49b8 100644
--- a/chrome/browser/ui/views/frame/browser_frame.cc
+++ b/chrome/browser/ui/views/frame/browser_frame.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/ui/views/frame/browser_frame.h"
+#include "ash/shell.h"
#include "base/chromeos/chromeos_version.h"
#include "base/i18n/rtl.h"
#include "chrome/browser/themes/theme_service.h"
@@ -16,6 +17,8 @@
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/native_browser_frame.h"
#include "chrome/common/chrome_switches.h"
+#include "ui/aura/root_window.h"
+#include "ui/aura/window.h"
#include "ui/base/theme_provider.h"
#include "ui/gfx/screen.h"
#include "ui/views/widget/native_widget.h"
@@ -61,6 +64,12 @@ void BrowserFrame::InitBrowserFrame() {
// activation.
params.type = views::Widget::InitParams::TYPE_PANEL;
}
+#if defined(USE_ASH)
+ if (browser_view_->browser()->host_desktop_type() ==
+ chrome::HOST_DESKTOP_TYPE_ASH) {
+ params.context = ash::Shell::GetAllRootWindows()[0];
+ }
+#endif
Init(params);
native_browser_frame_->InitSystemContextMenu();
diff --git a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
index 5880bed..df5a5ac 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
@@ -215,6 +215,7 @@ void OmniboxPopupContentsView::UpdatePopupAppearance() {
params.transparent = true;
params.parent_widget = location_bar_->GetWidget();
params.bounds = GetPopupBounds();
+ params.context = location_bar_->GetWidget()->GetNativeView();
popup_->Init(params);
#if defined(USE_ASH)
ash::SetWindowVisibilityAnimationType(
diff --git a/chrome/browser/ui/views/status_bubble_views.cc b/chrome/browser/ui/views/status_bubble_views.cc
index d9f7b09..309faee 100644
--- a/chrome/browser/ui/views/status_bubble_views.cc
+++ b/chrome/browser/ui/views/status_bubble_views.cc
@@ -575,6 +575,7 @@ void StatusBubbleViews::Init() {
params.accept_events = false;
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
params.parent_widget = frame;
+ params.context = frame->GetNativeView();
popup_->Init(params);
// We do our own animation and don't want any from the system.
popup_->SetVisibilityChangedAnimationsEnabled(false);
diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi
index df40657..b53b578 100644
--- a/chrome/chrome_browser_ui.gypi
+++ b/chrome/chrome_browser_ui.gypi
@@ -161,6 +161,8 @@
'browser/ui/ash/window_positioner.h',
'browser/ui/aura/chrome_browser_main_extra_parts_aura.cc',
'browser/ui/aura/chrome_browser_main_extra_parts_aura.h',
+ 'browser/ui/aura/stacking_client_aura.cc',
+ 'browser/ui/aura/stacking_client_aura.h',
'browser/ui/aura/tabs/dock_info_aurax11.cc',
'browser/ui/autofill/autofill_dialog_controller.cc',
'browser/ui/autofill/autofill_dialog_controller.h',
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index 76e1cc1..1dad713 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -335,7 +335,8 @@ void RenderWidgetHostViewAura::InitAsPopup(
gfx::Point origin_in_screen(bounds_in_display.origin());
screen_position_client->ConvertPointToScreen(root, &origin_in_screen);
parent = aura::client::GetStackingClient()->GetDefaultParent(
- window_, gfx::Rect(origin_in_screen, bounds_in_display.size()));
+ window_, window_,
+ gfx::Rect(origin_in_screen, bounds_in_display.size()));
}
window_->SetParent(parent);
SetBounds(bounds_in_display);
@@ -362,7 +363,8 @@ void RenderWidgetHostViewAura::InitAsFullscreen(
aura::client::StackingClient* stacking_client =
aura::client::GetStackingClient();
if (stacking_client)
- parent = stacking_client->GetDefaultParent(window_, display.bounds());
+ parent = stacking_client->GetDefaultParent(
+ window_, window_, display.bounds());
}
window_->SetParent(parent);
Show();
diff --git a/content/shell/shell_aura.cc b/content/shell/shell_aura.cc
index 47fedeb..235cdd9 100644
--- a/content/shell/shell_aura.cc
+++ b/content/shell/shell_aura.cc
@@ -293,6 +293,7 @@ void Shell::PlatformInitialize() {
gfx::Screen::SetScreenInstance(
gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen());
#endif
+ aura::client::SetStackingClient(stacking_client_);
views_delegate_ = new ShellViewsDelegateAura();
}
diff --git a/content/shell/shell_stacking_client_ash.cc b/content/shell/shell_stacking_client_ash.cc
index cdc93a7..75a708b 100644
--- a/content/shell/shell_stacking_client_ash.cc
+++ b/content/shell/shell_stacking_client_ash.cc
@@ -14,7 +14,6 @@
namespace content {
ShellStackingClientAsh::ShellStackingClientAsh() {
- aura::client::SetStackingClient(this);
}
ShellStackingClientAsh::~ShellStackingClientAsh() {
@@ -25,6 +24,7 @@ ShellStackingClientAsh::~ShellStackingClientAsh() {
}
aura::Window* ShellStackingClientAsh::GetDefaultParent(
+ aura::Window* context,
aura::Window* window,
const gfx::Rect& bounds) {
if (!root_window_.get()) {
diff --git a/content/shell/shell_stacking_client_ash.h b/content/shell/shell_stacking_client_ash.h
index d5adbc9..73e420d 100644
--- a/content/shell/shell_stacking_client_ash.h
+++ b/content/shell/shell_stacking_client_ash.h
@@ -42,7 +42,8 @@ class ShellStackingClientAsh : public aura::client::StackingClient {
virtual ~ShellStackingClientAsh();
// Overridden from client::StackingClient:
- virtual aura::Window* GetDefaultParent(aura::Window* window,
+ virtual aura::Window* GetDefaultParent(aura::Window* context,
+ aura::Window* window,
const gfx::Rect& bounds) OVERRIDE;
private:
diff --git a/ui/aura/client/stacking_client.cc b/ui/aura/client/stacking_client.cc
index 2bab521..9c821a5 100644
--- a/ui/aura/client/stacking_client.cc
+++ b/ui/aura/client/stacking_client.cc
@@ -24,27 +24,5 @@ StackingClient* GetStackingClient() {
return Env::GetInstance()->stacking_client();
}
-void SetStackingClient(Window* window, StackingClient* stacking_client) {
- if (window) {
- RootWindow* root_window = window->GetRootWindow();
- DCHECK(root_window);
- root_window->SetProperty(kRootWindowStackingClientKey, stacking_client);
- } else {
- SetStackingClient(stacking_client);
- }
-}
-
-StackingClient* GetStackingClient(Window* window) {
- if (window) {
- RootWindow* root_window = window->GetRootWindow();
- DCHECK(root_window);
- StackingClient* root_window_stacking_client =
- root_window->GetProperty(kRootWindowStackingClientKey);
- if (root_window_stacking_client)
- return root_window_stacking_client;
- }
- return GetStackingClient();
-}
-
} // namespace client
} // namespace aura
diff --git a/ui/aura/client/stacking_client.h b/ui/aura/client/stacking_client.h
index 671c755..ab75dc9 100644
--- a/ui/aura/client/stacking_client.h
+++ b/ui/aura/client/stacking_client.h
@@ -21,25 +21,21 @@ class AURA_EXPORT StackingClient {
virtual ~StackingClient() {}
// Called by the Window when its parent is set to NULL, returns the window
- // that |window| should be added to instead.
+ // that |window| should be added to instead. |context| provides a Window
+ // (generally a RootWindow) that can be used to determine which desktop type
+ // the default parent should be chosen from.
// NOTE: this may have side effects. It should only be used when |window| is
// going to be immediately added.
- virtual Window* GetDefaultParent(Window* window, const gfx::Rect& bounds) = 0;
+ virtual Window* GetDefaultParent(
+ Window* context,
+ Window* window,
+ const gfx::Rect& bounds) = 0;
};
// Set/Get the default stacking client.
AURA_EXPORT void SetStackingClient(StackingClient* stacking_client);
AURA_EXPORT StackingClient* GetStackingClient();
-// Set/Get a stacking client for a specific window. Setting the stacking client
-// sets the stacking client on the window's RootWindow, not the window itself.
-// Likewise getting obtains it from the window's RootWindow. If |window| is
-// non-NULL it must be in a RootWindow. If |window| is NULL, the default
-// stacking client is used.
-AURA_EXPORT void SetStackingClient(Window* window,
- StackingClient* stacking_client);
-AURA_EXPORT StackingClient* GetStackingClient(Window* window);
-
} // namespace client
} // namespace aura
diff --git a/ui/aura/demo/demo_main.cc b/ui/aura/demo/demo_main.cc
index 451affb5..46dbe72 100644
--- a/ui/aura/demo/demo_main.cc
+++ b/ui/aura/demo/demo_main.cc
@@ -100,7 +100,8 @@ class DemoStackingClient : public aura::client::StackingClient {
}
// Overridden from aura::client::StackingClient:
- virtual aura::Window* GetDefaultParent(aura::Window* window,
+ virtual aura::Window* GetDefaultParent(aura::Window* context,
+ aura::Window* window,
const gfx::Rect& bounds) OVERRIDE {
if (!capture_client_.get()) {
capture_client_.reset(
diff --git a/ui/aura/desktop/desktop_stacking_client.cc b/ui/aura/desktop/desktop_stacking_client.cc
deleted file mode 100644
index ccc7795..0000000
--- a/ui/aura/desktop/desktop_stacking_client.cc
+++ /dev/null
@@ -1,60 +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 "ui/aura/desktop/desktop_stacking_client.h"
-
-#include "ui/aura/client/activation_client.h"
-#include "ui/aura/client/default_capture_client.h"
-#include "ui/aura/desktop/desktop_activation_client.h"
-#include "ui/aura/focus_manager.h"
-#include "ui/aura/root_window.h"
-#include "ui/aura/window.h"
-#include "ui/views/corewm/compound_event_filter.h"
-#include "ui/views/corewm/input_method_event_filter.h"
-
-namespace aura {
-
-DesktopStackingClient::DesktopStackingClient()
- : window_event_filter_(NULL) {
- client::SetStackingClient(this);
-}
-
-DesktopStackingClient::~DesktopStackingClient() {
- if (window_event_filter_)
- window_event_filter_->RemoveFilter(input_method_filter_.get());
-
- client::SetStackingClient(NULL);
-}
-
-Window* DesktopStackingClient::GetDefaultParent(Window* window,
- const gfx::Rect& bounds) {
- if (!null_parent_.get())
- CreateNULLParent();
-
- return null_parent_.get();
-}
-
-void DesktopStackingClient::CreateNULLParent() {
- focus_manager_.reset(new FocusManager);
-
- activation_client_.reset(new DesktopActivationClient(focus_manager_.get()));
-
- null_parent_.reset(new RootWindow(
- RootWindow::CreateParams(gfx::Rect(100, 100))));
- null_parent_->Init();
- null_parent_->set_focus_manager(focus_manager_.get());
-
- client::SetActivationClient(null_parent_.get(), activation_client_.get());
-
- window_event_filter_ = new views::corewm::CompoundEventFilter;
- null_parent_->SetEventFilter(window_event_filter_);
-
- input_method_filter_.reset(new views::corewm::InputMethodEventFilter);
- input_method_filter_->SetInputMethodPropertyInRootWindow(null_parent_.get());
- window_event_filter_->AddFilter(input_method_filter_.get());
-
- capture_client_.reset(new client::DefaultCaptureClient(null_parent_.get()));
-}
-
-} // namespace aura
diff --git a/ui/aura/desktop/desktop_stacking_client.h b/ui/aura/desktop/desktop_stacking_client.h
deleted file mode 100644
index ab3e849..0000000
--- a/ui/aura/desktop/desktop_stacking_client.h
+++ /dev/null
@@ -1,65 +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.
-
-#ifndef UI_AURA_DESKTOP_DESKTOP_STACKING_CLIENT_H_
-#define UI_AURA_DESKTOP_DESKTOP_STACKING_CLIENT_H_
-
-#include "ui/aura/client/stacking_client.h"
-
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
-#include "base/memory/scoped_ptr.h"
-#include "ui/views/views_export.h"
-
-namespace views {
-namespace corewm {
-class CompoundEventFilter;
-class InputMethodEventFilter;
-}
-}
-
-namespace aura {
-class DesktopActivationClient;
-class FocusManager;
-class RootWindow;
-class Window;
-
-namespace client {
-class DefaultCaptureClient;
-}
-
-// A stacking client for the desktop; always sets the default parent to the
-// RootWindow of the passed in Window.
-class VIEWS_EXPORT DesktopStackingClient : public client::StackingClient {
- public:
- DesktopStackingClient();
- virtual ~DesktopStackingClient();
-
- // Overridden from client::StackingClient:
- virtual Window* GetDefaultParent(Window* window,
- const gfx::Rect& bounds) OVERRIDE;
-
- private:
- void CreateNULLParent();
-
- // Windows with NULL parents are parented to this.
- scoped_ptr<RootWindow> null_parent_;
-
- // All the member variables below are necessary for the NULL parent root
- // window to function.
- scoped_ptr<FocusManager> focus_manager_;
- // Depends on focus_manager_.
- scoped_ptr<DesktopActivationClient> activation_client_;
-
- scoped_ptr<views::corewm::InputMethodEventFilter> input_method_filter_;
- views::corewm::CompoundEventFilter* window_event_filter_;
-
- scoped_ptr<client::DefaultCaptureClient> capture_client_;
-
- DISALLOW_COPY_AND_ASSIGN(DesktopStackingClient);
-};
-
-} // namespace aura
-
-#endif // UI_AURA_DESKTOP_DESKTOP_STACKING_CLIENT_H_
diff --git a/ui/aura/test/test_stacking_client.cc b/ui/aura/test/test_stacking_client.cc
index c45537e..6dd5dcf 100644
--- a/ui/aura/test/test_stacking_client.cc
+++ b/ui/aura/test/test_stacking_client.cc
@@ -18,7 +18,8 @@ TestStackingClient::~TestStackingClient() {
client::SetStackingClient(NULL);
}
-Window* TestStackingClient::GetDefaultParent(Window* window,
+Window* TestStackingClient::GetDefaultParent(Window* context,
+ Window* window,
const gfx::Rect& bounds) {
return root_window_;
}
diff --git a/ui/aura/test/test_stacking_client.h b/ui/aura/test/test_stacking_client.h
index b5963ce..7c9747b 100644
--- a/ui/aura/test/test_stacking_client.h
+++ b/ui/aura/test/test_stacking_client.h
@@ -20,7 +20,8 @@ class TestStackingClient : public client::StackingClient {
virtual ~TestStackingClient();
// Overridden from client::StackingClient:
- virtual Window* GetDefaultParent(Window* window,
+ virtual Window* GetDefaultParent(Window* context,
+ Window* window,
const gfx::Rect& bounds) OVERRIDE;
private:
diff --git a/ui/aura/window.cc b/ui/aura/window.cc
index 217e38e1..6303b76 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -40,7 +40,8 @@ Window* GetParentForWindow(Window* window, Window* suggested_parent) {
if (suggested_parent)
return suggested_parent;
if (client::GetStackingClient())
- return client::GetStackingClient()->GetDefaultParent(window, gfx::Rect());
+ return client::GetStackingClient()->GetDefaultParent(
+ window, window, gfx::Rect());
return NULL;
}
diff --git a/ui/views/examples/content_client/examples_browser_main_parts.cc b/ui/views/examples/content_client/examples_browser_main_parts.cc
index 462b0675..2c371f1 100644
--- a/ui/views/examples/content_client/examples_browser_main_parts.cc
+++ b/ui/views/examples/content_client/examples_browser_main_parts.cc
@@ -43,6 +43,7 @@ void ExamplesBrowserMainParts::PreMainMessageLoopRun() {
#if defined(USE_AURA)
aura::Env::GetInstance()->SetDisplayManager(new aura::SingleDisplayManager);
stacking_client_.reset(new DesktopStackingClient);
+ aura::client::SetStackingClient(stacking_client_.get());
gfx::Screen::SetScreenInstance(
gfx::SCREEN_TYPE_NATIVE, CreateDesktopScreen());
#endif
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
index 083ab6b..8e5edd2 100644
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
@@ -29,33 +29,6 @@ namespace views {
DEFINE_WINDOW_PROPERTY_KEY(DesktopNativeWidgetAura*,
kDesktopNativeWidgetAuraKey, NULL);
-namespace {
-
-class DesktopNativeWidgetAuraStackingClient :
- public aura::client::StackingClient {
- public:
- explicit DesktopNativeWidgetAuraStackingClient(aura::RootWindow* root_window)
- : root_window_(root_window) {
- aura::client::SetStackingClient(root_window_, this);
- }
- virtual ~DesktopNativeWidgetAuraStackingClient() {
- aura::client::SetStackingClient(root_window_, NULL);
- }
-
- // Overridden from client::StackingClient:
- virtual aura::Window* GetDefaultParent(aura::Window* window,
- const gfx::Rect& bounds) OVERRIDE {
- return root_window_;
- }
-
- private:
- aura::RootWindow* root_window_;
-
- DISALLOW_COPY_AND_ASSIGN(DesktopNativeWidgetAuraStackingClient);
-};
-
-} // namespace
-
////////////////////////////////////////////////////////////////////////////////
// DesktopNativeWidgetAura, public:
@@ -108,8 +81,6 @@ void DesktopNativeWidgetAura::InitNativeWidget(
this, params.bounds);
root_window_.reset(
desktop_root_window_host_->Init(window_, params));
- stacking_client_.reset(
- new DesktopNativeWidgetAuraStackingClient(root_window_.get()));
aura::client::SetActivationDelegate(window_, this);
}
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.h b/ui/views/widget/desktop_aura/desktop_native_widget_aura.h
index c4fbf60..cd0e803 100644
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.h
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.h
@@ -180,8 +180,6 @@ class VIEWS_EXPORT DesktopNativeWidgetAura
aura::Window* window_;
internal::NativeWidgetDelegate* native_widget_delegate_;
- scoped_ptr<aura::client::StackingClient> stacking_client_;
-
DISALLOW_COPY_AND_ASSIGN(DesktopNativeWidgetAura);
};
diff --git a/ui/views/widget/desktop_aura/desktop_stacking_client.cc b/ui/views/widget/desktop_aura/desktop_stacking_client.cc
index 9c111a6..0893564 100644
--- a/ui/views/widget/desktop_aura/desktop_stacking_client.cc
+++ b/ui/views/widget/desktop_aura/desktop_stacking_client.cc
@@ -27,7 +27,8 @@ DesktopStackingClient::~DesktopStackingClient() {
aura::client::SetStackingClient(NULL);
}
-aura::Window* DesktopStackingClient::GetDefaultParent(aura::Window* window,
+aura::Window* DesktopStackingClient::GetDefaultParent(aura::Window* context,
+ aura::Window* window,
const gfx::Rect& bounds) {
if (!null_parent_.get())
CreateNULLParent();
diff --git a/ui/views/widget/desktop_aura/desktop_stacking_client.h b/ui/views/widget/desktop_aura/desktop_stacking_client.h
index caf1b94..239064a 100644
--- a/ui/views/widget/desktop_aura/desktop_stacking_client.h
+++ b/ui/views/widget/desktop_aura/desktop_stacking_client.h
@@ -36,7 +36,8 @@ class VIEWS_EXPORT DesktopStackingClient : public aura::client::StackingClient {
virtual ~DesktopStackingClient();
// Overridden from aura::client::StackingClient:
- virtual aura::Window* GetDefaultParent(aura::Window* window,
+ virtual aura::Window* GetDefaultParent(aura::Window* context,
+ aura::Window* window,
const gfx::Rect& bounds) OVERRIDE;
private:
diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc
index 7b30923..22fa7c9 100644
--- a/ui/views/widget/native_widget_aura.cc
+++ b/ui/views/widget/native_widget_aura.cc
@@ -123,8 +123,8 @@ void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) {
// If the parent is not specified, find the default parent for
// the |window_| using the desired |window_bounds|.
if (!parent) {
- parent = aura::client::GetStackingClient(params.GetParent())->
- GetDefaultParent(window_, window_bounds);
+ parent = aura::client::GetStackingClient()->
+ GetDefaultParent(params.context, window_, window_bounds);
} else if (window_bounds == gfx::Rect()) {
// If a parent is specified but no bounds are given,
// use the origin of the parent's display so that the widget
diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc
index d0c71ef..6226b3a 100644
--- a/ui/views/widget/widget.cc
+++ b/ui/views/widget/widget.cc
@@ -159,7 +159,8 @@ Widget::InitParams::InitParams()
native_widget(NULL),
desktop_root_window_host(NULL),
top_level(false),
- layer_type(ui::LAYER_TEXTURED) {
+ layer_type(ui::LAYER_TEXTURED),
+ context(NULL) {
}
Widget::InitParams::InitParams(Type type)
@@ -184,7 +185,8 @@ Widget::InitParams::InitParams(Type type)
native_widget(NULL),
desktop_root_window_host(NULL),
top_level(false),
- layer_type(ui::LAYER_TEXTURED) {
+ layer_type(ui::LAYER_TEXTURED),
+ context(NULL) {
}
gfx::NativeView Widget::InitParams::GetParent() const {
diff --git a/ui/views/widget/widget.h b/ui/views/widget/widget.h
index ecaaf3a..525402f 100644
--- a/ui/views/widget/widget.h
+++ b/ui/views/widget/widget.h
@@ -191,6 +191,10 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
// Only used by NativeWidgetAura. Specifies the type of layer for the
// aura::Window. Default is LAYER_TEXTURED.
ui::LayerType layer_type;
+ // Only used by Aura. Provides additional context (generally a RootWindow)
+ // during creation to allow the widget to determine which desktop type it
+ // will belong to. NULL indicates a normal native desktop.
+ gfx::NativeView context;
};
Widget();