summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-26 14:49:09 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-26 14:49:09 +0000
commit32c2a46c5f820f42cdb37b869e99633d8a2d73ad (patch)
tree9e09f67ffd197c2067a286e4e45927ee5c5aa429 /chrome
parent08f8feb39b2c8801dd39a1531fb5958644162e6d (diff)
downloadchromium_src-32c2a46c5f820f42cdb37b869e99633d8a2d73ad.zip
chromium_src-32c2a46c5f820f42cdb37b869e99633d8a2d73ad.tar.gz
chromium_src-32c2a46c5f820f42cdb37b869e99633d8a2d73ad.tar.bz2
Migrate client API setters/getters to take a RootWindow.
http://crbug.com/112131 TEST=none TBR=sky Review URL: https://chromiumcodereview.appspot.com/9455081 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123690 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/ui/views/simple_message_box_views.cc4
-rw-r--r--chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc17
-rw-r--r--chrome/test/base/browser_with_test_window_test.cc21
-rw-r--r--chrome/test/base/browser_with_test_window_test.h3
4 files changed, 31 insertions, 14 deletions
diff --git a/chrome/browser/ui/views/simple_message_box_views.cc b/chrome/browser/ui/views/simple_message_box_views.cc
index 442fdba..3846d0f 100644
--- a/chrome/browser/ui/views/simple_message_box_views.cc
+++ b/chrome/browser/ui/views/simple_message_box_views.cc
@@ -62,8 +62,8 @@ bool SimpleMessageBoxViews::ShowYesNoBox(gfx::NativeWindow parent_window,
g_browser_process->AddRefModule();
#if defined(USE_AURA)
- aura::client::GetDispatcherClient()->RunWithDispatcher(dialog,
- parent_window, true);
+ aura::client::GetDispatcherClient(parent_window->GetRootWindow())->
+ RunWithDispatcher(dialog, parent_window, true);
#else
{
MessageLoop::ScopedNestableTaskAllower allow(MessageLoopForUI::current());
diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc
index 6d22fd8..8834f81 100644
--- a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc
+++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc
@@ -200,7 +200,8 @@ void NativeTabContentsViewAura::StartDragging(const WebDropData& drop_data,
WebKit::WebDragOperationsMask ops,
const SkBitmap& image,
const gfx::Point& image_offset) {
- if (!aura::client::GetDragDropClient())
+ aura::RootWindow* root_window = GetNativeView()->GetRootWindow();
+ if (!aura::client::GetDragDropClient(root_window))
return;
ui::OSExchangeDataProviderAura* provider = new ui::OSExchangeDataProviderAura;
@@ -219,10 +220,10 @@ void NativeTabContentsViewAura::StartDragging(const WebDropData& drop_data,
// always start from a mouse-event (e.g. a touch or gesture event could
// initiate the drag). The location information should be carried over from
// webkit. http://crbug.com/114754
- gfx::Point location(ash::Shell::GetRootWindow()->last_mouse_location());
+ gfx::Point location(root_window->last_mouse_location());
location.Offset(-image_offset.x(), -image_offset.y());
MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current());
- result_op = aura::client::GetDragDropClient()->StartDragAndDrop(
+ result_op = aura::client::GetDragDropClient(root_window)->StartDragAndDrop(
data, location, ConvertFromWeb(ops));
}
@@ -231,13 +232,15 @@ void NativeTabContentsViewAura::StartDragging(const WebDropData& drop_data,
}
void NativeTabContentsViewAura::CancelDrag() {
- if (aura::client::GetDragDropClient())
- aura::client::GetDragDropClient()->DragCancel();
+ aura::RootWindow* root_window = GetNativeView()->GetRootWindow();
+ if (aura::client::GetDragDropClient(root_window))
+ aura::client::GetDragDropClient(root_window)->DragCancel();
}
bool NativeTabContentsViewAura::IsDoingDrag() const {
- if (aura::client::GetDragDropClient())
- return aura::client::GetDragDropClient()->IsDragDropInProgress();
+ aura::RootWindow* root_window = GetNativeView()->GetRootWindow();
+ if (aura::client::GetDragDropClient(root_window))
+ return aura::client::GetDragDropClient(root_window)->IsDragDropInProgress();
return false;
}
diff --git a/chrome/test/base/browser_with_test_window_test.cc b/chrome/test/base/browser_with_test_window_test.cc
index 47be6d8..49cc3cc9 100644
--- a/chrome/test/base/browser_with_test_window_test.cc
+++ b/chrome/test/base/browser_with_test_window_test.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// 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.
@@ -18,6 +18,10 @@
#include "content/public/browser/web_contents.h"
#include "content/public/common/page_transition_types.h"
+#if defined(USE_AURA)
+#include "ui/aura/root_window.h"
+#endif
+
using content::BrowserThread;
using content::NavigationController;
using content::WebContents;
@@ -32,9 +36,6 @@ BrowserWithTestWindowTest::BrowserWithTestWindowTest()
#if defined(OS_WIN)
OleInitialize(NULL);
#endif
-#if defined(USE_AURA)
- test_activation_client_.reset(new aura::test::TestActivationClient);
-#endif
}
void BrowserWithTestWindowTest::SetUp() {
@@ -44,6 +45,18 @@ void BrowserWithTestWindowTest::SetUp() {
browser_.reset(new Browser(Browser::TYPE_TABBED, profile()));
window_.reset(new TestBrowserWindow(browser()));
browser_->SetWindowForTesting(window_.get());
+#if defined(USE_AURA)
+ aura::RootWindow* root_window = aura::RootWindow::GetInstance();
+ test_activation_client_.reset(
+ new aura::test::TestActivationClient(root_window));
+#endif
+}
+
+void BrowserWithTestWindowTest::TearDown() {
+ testing::Test::TearDown();
+#if defined(USE_AURA)
+ aura::RootWindow::DeleteInstance();
+#endif
}
BrowserWithTestWindowTest::~BrowserWithTestWindowTest() {
diff --git a/chrome/test/base/browser_with_test_window_test.h b/chrome/test/base/browser_with_test_window_test.h
index ab88c6a..75477cc 100644
--- a/chrome/test/base/browser_with_test_window_test.h
+++ b/chrome/test/base/browser_with_test_window_test.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// 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.
@@ -61,6 +61,7 @@ class BrowserWithTestWindowTest : public testing::Test {
virtual ~BrowserWithTestWindowTest();
virtual void SetUp() OVERRIDE;
+ virtual void TearDown() OVERRIDE;
// Returns the current RenderViewHost for the current tab as a
// TestRenderViewHost.