summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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.cc5
-rw-r--r--chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.h6
-rw-r--r--chrome/browser/ui/aura/stacking_client_aura.cc33
-rw-r--r--chrome/browser/ui/aura/stacking_client_aura.h42
-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.cc4
-rw-r--r--ui/aura/desktop/desktop_stacking_client.h3
-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_native_widget_aura.cc29
-rw-r--r--ui/views/widget/desktop_native_widget_aura.h2
-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
41 files changed, 193 insertions, 94 deletions
diff --git a/ash/shell.cc b/ash/shell.cc
index 579bd76..3a94294 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -66,6 +66,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"
@@ -454,7 +455,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());
@@ -771,6 +774,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 d25998e..ad24bc5 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;
@@ -410,6 +410,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);
@@ -468,7 +470,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 8575d6b..c165707 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"
@@ -159,5 +160,9 @@ double TestShellDelegate::GetSavedScreenMagnifierScale() {
return std::numeric_limits<double>::min();
}
+aura::client::StackingClient* TestShellDelegate::CreateStackingClient() {
+ return new StackingController;
+}
+
} // namespace test
} // namespace ash
diff --git a/ash/test/test_shell_delegate.h b/ash/test/test_shell_delegate.h
index 76b48b1..a1e9747 100644
--- a/ash/test/test_shell_delegate.h
+++ b/ash/test/test_shell_delegate.h
@@ -55,6 +55,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 f5b2c06..a5517d1 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()) {
@@ -148,10 +147,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 73b1d43..52ecc6e 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/desktop/desktop_screen.h"
#include "ui/aura/desktop/desktop_stacking_client.h"
#include "ui/aura/env.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)
@@ -37,7 +39,8 @@ void ChromeBrowserMainExtraPartsAura::PreProfileInit() {
gfx::Screen::SetScreenInstance(
gfx::SCREEN_TYPE_NATIVE, aura::CreateDesktopScreen());
aura::Env::GetInstance()->SetDisplayManager(new aura::SingleDisplayManager);
- stacking_client_.reset(new aura::DesktopStackingClient);
+ stacking_client_.reset(new StackingClientAura);
+ 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 199279b..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
@@ -11,7 +11,9 @@
#include "chrome/browser/chrome_browser_main_extra_parts.h"
namespace aura {
-class DesktopStackingClient;
+namespace client {
+class StackingClient;
+}
}
class ChromeBrowserMainExtraPartsAura : public ChromeBrowserMainExtraParts {
@@ -24,7 +26,7 @@ class ChromeBrowserMainExtraPartsAura : public ChromeBrowserMainExtraParts {
virtual void PostMainMessageLoopRun() OVERRIDE;
private:
- scoped_ptr<aura::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
new file mode 100644
index 0000000..569c7a5
--- /dev/null
+++ b/chrome/browser/ui/aura/stacking_client_aura.cc
@@ -0,0 +1,33 @@
+// 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 "chrome/browser/ui/aura/stacking_client_aura.h"
+
+#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"
+
+StackingClientAura::StackingClientAura() {
+ desktop_stacking_client_.reset(new aura::DesktopStackingClient);
+}
+
+StackingClientAura::~StackingClientAura() {
+}
+
+aura::Window* StackingClientAura::GetDefaultParent(aura::Window* context,
+ aura::Window* window,
+ const gfx::Rect& bounds) {
+#if defined(USE_ASH)
+ if (chrome::GetHostDesktopTypeForNativeView(context) ==
+ chrome::HOST_DESKTOP_TYPE_ASH) {
+ return ash::Shell::GetInstance()->stacking_client()->GetDefaultParent(
+ context, window, bounds);
+ }
+#endif
+ return desktop_stacking_client_->GetDefaultParent(context, window, bounds);
+}
diff --git a/chrome/browser/ui/aura/stacking_client_aura.h b/chrome/browser/ui/aura/stacking_client_aura.h
new file mode 100644
index 0000000..9bbd5a4
--- /dev/null
+++ b/chrome/browser/ui/aura/stacking_client_aura.h
@@ -0,0 +1,42 @@
+// 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 CHROME_BROWSER_UI_AURA_STACKING_CLIENT_AURA_H_
+#define CHROME_BROWSER_UI_AURA_STACKING_CLIENT_AURA_H_
+
+#include "ui/aura/client/stacking_client.h"
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/ui/host_desktop.h"
+
+namespace ash {
+class StackingController;
+}
+
+namespace aura {
+class DesktopStackingClient;
+class Window;
+}
+
+// A stacking client for the two worlds aura, dispatches to either a
+// DesktopStackingClient or an ash::StackingController.
+class StackingClientAura : public aura::client::StackingClient {
+ public:
+ StackingClientAura();
+ virtual ~StackingClientAura();
+
+ // Overridden from client::StackingClient:
+ virtual aura::Window* GetDefaultParent(aura::Window* context,
+ aura::Window* window,
+ const gfx::Rect& bounds) OVERRIDE;
+
+ private:
+ scoped_ptr<aura::DesktopStackingClient> desktop_stacking_client_;
+
+ DISALLOW_COPY_AND_ASSIGN(StackingClientAura);
+};
+
+#endif // CHROME_BROWSER_UI_AURA_STACKING_CLIENT_AURA_H_
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 d5097d4..22079eb 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 9ffe30b..a9dcef2 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -325,7 +325,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);
@@ -352,7 +353,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 fa58914..16157b5 100644
--- a/content/shell/shell_aura.cc
+++ b/content/shell/shell_aura.cc
@@ -290,6 +290,7 @@ void Shell::PlatformInitialize() {
gfx::SCREEN_TYPE_NATIVE, new ash::ScreenAsh);
#else
stacking_client_ = new aura::DesktopStackingClient();
+ aura::client::SetStackingClient(stacking_client_);
gfx::Screen::SetScreenInstance(
gfx::SCREEN_TYPE_NATIVE, aura::CreateDesktopScreen());
#endif
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
index ccc7795..6b79ea6 100644
--- a/ui/aura/desktop/desktop_stacking_client.cc
+++ b/ui/aura/desktop/desktop_stacking_client.cc
@@ -17,7 +17,6 @@ namespace aura {
DesktopStackingClient::DesktopStackingClient()
: window_event_filter_(NULL) {
- client::SetStackingClient(this);
}
DesktopStackingClient::~DesktopStackingClient() {
@@ -27,7 +26,8 @@ DesktopStackingClient::~DesktopStackingClient() {
client::SetStackingClient(NULL);
}
-Window* DesktopStackingClient::GetDefaultParent(Window* window,
+Window* DesktopStackingClient::GetDefaultParent(Window* context,
+ Window* window,
const gfx::Rect& bounds) {
if (!null_parent_.get())
CreateNULLParent();
diff --git a/ui/aura/desktop/desktop_stacking_client.h b/ui/aura/desktop/desktop_stacking_client.h
index ab3e849..ea3bec6 100644
--- a/ui/aura/desktop/desktop_stacking_client.h
+++ b/ui/aura/desktop/desktop_stacking_client.h
@@ -37,7 +37,8 @@ class VIEWS_EXPORT DesktopStackingClient : public client::StackingClient {
virtual ~DesktopStackingClient();
// 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/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 c31e999..f97ad22 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 aura::DesktopStackingClient);
+ aura::client::SetStackingClient(stacking_client_.get());
gfx::Screen::SetScreenInstance(
gfx::SCREEN_TYPE_NATIVE, aura::CreateDesktopScreen());
#endif
diff --git a/ui/views/widget/desktop_native_widget_aura.cc b/ui/views/widget/desktop_native_widget_aura.cc
index 76abf9e..4befc40 100644
--- a/ui/views/widget/desktop_native_widget_aura.cc
+++ b/ui/views/widget/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_native_widget_aura.h b/ui/views/widget/desktop_native_widget_aura.h
index b335ce6..cd2f20b 100644
--- a/ui/views/widget/desktop_native_widget_aura.h
+++ b/ui/views/widget/desktop_native_widget_aura.h
@@ -181,8 +181,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/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc
index 4e47ab2..ff382a7 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 bdc355b..adb3c6c 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 cd4d0ce..63f4967 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();