summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/automation/automation_constrained_window_tracker.h31
-rwxr-xr-xchrome/browser/automation/automation_provider.cc62
-rw-r--r--chrome/browser/automation/automation_provider.h16
-rw-r--r--chrome/browser/blocked_popup_container_interactive_uitest.cc (renamed from chrome/browser/views/constrained_window_impl_interactive_uitest.cc)17
-rw-r--r--chrome/browser/tab_contents/constrained_window.h21
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc14
-rw-r--r--chrome/browser/views/constrained_window_impl.cc52
-rw-r--r--chrome/browser/views/constrained_window_impl.h8
8 files changed, 34 insertions, 187 deletions
diff --git a/chrome/browser/automation/automation_constrained_window_tracker.h b/chrome/browser/automation/automation_constrained_window_tracker.h
deleted file mode 100644
index fe4261a..0000000
--- a/chrome/browser/automation/automation_constrained_window_tracker.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) 2006-2008 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_AUTOMATION_AUTOMATION_CONSTRAINED_WINDOW_TRACKER_H__
-#define CHROME_BROWSER_AUTOMATION_AUTOMATION_CONSTRAINED_WINDOW_TRACKER_H__
-
-#include "chrome/browser/automation/automation_resource_tracker.h"
-#include "chrome/browser/tab_contents/constrained_window.h"
-
-class AutomationConstrainedWindowTracker
- : public AutomationResourceTracker<ConstrainedWindow*> {
-public:
- AutomationConstrainedWindowTracker(IPC::Message::Sender* automation)
- : AutomationResourceTracker(automation) {}
-
- virtual ~AutomationConstrainedWindowTracker() {
- }
-
- virtual void AddObserver(ConstrainedWindow* resource) {
- registrar_.Add(this, NotificationType::CWINDOW_CLOSED,
- Source<ConstrainedWindow>(resource));
- }
-
- virtual void RemoveObserver(ConstrainedWindow* resource) {
- registrar_.Remove(this, NotificationType::CWINDOW_CLOSED,
- Source<ConstrainedWindow>(resource));
- }
-};
-
-#endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_CONSTRAINED_WINDOW_TRACKER_H__
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 859beaf..9445b92 100755
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -805,12 +805,6 @@ AutomationProvider::AutomationProvider(Profile* profile)
window_tracker_.reset(new AutomationWindowTracker(this));
autocomplete_edit_tracker_.reset(
new AutomationAutocompleteEditTracker(this));
-#if defined(OS_WIN)
- // TODO(port): Enable as the trackers get ported.
- cwindow_tracker_.reset(new AutomationConstrainedWindowTracker(this));
-#else
- NOTIMPLEMENTED() << "hook up constrained window tracker";
-#endif
new_tab_ui_load_observer_.reset(new NewTabUILoadObserver(this));
dom_operation_observer_.reset(new DomOperationNotificationObserver(this));
dom_inspector_observer_.reset(new DomInspectorNotificationObserver(this));
@@ -996,8 +990,6 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) {
ExecuteJavascript)
IPC_MESSAGE_HANDLER(AutomationMsg_ConstrainedWindowCount,
GetConstrainedWindowCount)
- IPC_MESSAGE_HANDLER(AutomationMsg_ConstrainedWindow, GetConstrainedWindow)
- IPC_MESSAGE_HANDLER(AutomationMsg_ConstrainedTitle, GetConstrainedTitle)
IPC_MESSAGE_HANDLER(AutomationMsg_FindInPage, HandleFindInPageRequest)
IPC_MESSAGE_HANDLER(AutomationMsg_GetFocusedViewID, GetFocusedViewID)
IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_InspectElement,
@@ -1051,8 +1043,6 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) {
AutocompleteEditIsQueryInProgress)
IPC_MESSAGE_HANDLER(AutomationMsg_AutocompleteEditGetMatches,
AutocompleteEditGetMatches)
- IPC_MESSAGE_HANDLER(AutomationMsg_ConstrainedWindowBounds,
- GetConstrainedWindowBounds)
IPC_MESSAGE_HANDLER(AutomationMsg_OpenFindInPage,
HandleOpenFindInPageRequest)
IPC_MESSAGE_HANDLER(AutomationMsg_HandleMessageFromExternalHost,
@@ -2002,58 +1992,6 @@ void AutomationProvider::GetConstrainedWindowCount(int handle, int* count) {
}
}
-void AutomationProvider::GetConstrainedWindow(int handle, int index,
- int* cwindow_handle) {
- *cwindow_handle = 0;
- if (tab_tracker_->ContainsHandle(handle) && index >= 0) {
- NavigationController* nav_controller =
- tab_tracker_->GetResource(handle);
- TabContents* tab = nav_controller->tab_contents();
- if (tab && index < static_cast<int>(tab->child_windows_.size())) {
-#if defined(OS_WIN)
- ConstrainedWindow* window = tab->child_windows_[index];
- *cwindow_handle = cwindow_tracker_->Add(window);
-#else
- // TODO(port): Enable when cwindow_tracker is ported.
- NOTIMPLEMENTED();
-#endif
- }
- }
-}
-
-void AutomationProvider::GetConstrainedTitle(int handle,
- int* title_string_size,
- std::wstring* title) {
- *title_string_size = -1; // -1 is the error code
-#if defined(OS_WIN)
- if (cwindow_tracker_->ContainsHandle(handle)) {
- ConstrainedWindow* window = cwindow_tracker_->GetResource(handle);
- *title = window->GetWindowTitle();
- *title_string_size = static_cast<int>(title->size());
- }
-#else
- // TODO(port): Enable when cwindow_tracker is ported.
- NOTIMPLEMENTED();
-#endif
-}
-
-void AutomationProvider::GetConstrainedWindowBounds(int handle, bool* exists,
- gfx::Rect* rect) {
- *rect = gfx::Rect(0, 0, 0, 0);
-#if defined(OS_WIN)
- if (cwindow_tracker_->ContainsHandle(handle)) {
- ConstrainedWindow* window = cwindow_tracker_->GetResource(handle);
- if (window) {
- *exists = true;
- *rect = window->GetCurrentBounds();
- }
- }
-#else
- // TODO(port): Enable when cwindow_tracker is ported.
- NOTIMPLEMENTED();
-#endif
-}
-
void AutomationProvider::HandleFindInPageRequest(
int handle, const std::wstring& find_request,
int forward, int match_case, int* active_ordinal, int* matches_found) {
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h
index 389543a..ccf580d 100644
--- a/chrome/browser/automation/automation_provider.h
+++ b/chrome/browser/automation/automation_provider.h
@@ -32,11 +32,6 @@
#include "views/event.h"
#endif // defined(OS_WIN)
-#if defined(OS_WIN)
-// TODO(port): enable these.
-#include "chrome/browser/automation/automation_constrained_window_tracker.h"
-#endif
-
struct AutomationMsg_Find_Params;
namespace IPC {
@@ -239,13 +234,6 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>,
void ApplyAccelerator(int handle, int id);
void GetConstrainedWindowCount(int handle, int* count);
- void GetConstrainedWindow(int handle, int index, int* cwindow_handle);
-
- void GetConstrainedTitle(int handle, int* title,
- std::wstring* title_string_size);
-
- void GetConstrainedWindowBounds(int handle, bool* exists,
- gfx::Rect* rect);
// This function has been deprecated, please use HandleFindRequest.
void HandleFindInPageRequest(int handle,
@@ -487,10 +475,6 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>,
scoped_ptr<AutomationBrowserTracker> browser_tracker_;
scoped_ptr<AutomationTabTracker> tab_tracker_;
scoped_ptr<AutomationWindowTracker> window_tracker_;
-#if defined(OS_WIN)
- // TODO(port): Enable as trackers get ported.
- scoped_ptr<AutomationConstrainedWindowTracker> cwindow_tracker_;
-#endif
scoped_ptr<AutomationAutocompleteEditTracker> autocomplete_edit_tracker_;
scoped_ptr<NavigationControllerRestoredObserver> restore_tracker_;
LoginHandlerMap login_handler_map_;
diff --git a/chrome/browser/views/constrained_window_impl_interactive_uitest.cc b/chrome/browser/blocked_popup_container_interactive_uitest.cc
index fcd7639..a6eb304 100644
--- a/chrome/browser/views/constrained_window_impl_interactive_uitest.cc
+++ b/chrome/browser/blocked_popup_container_interactive_uitest.cc
@@ -10,7 +10,6 @@
#include "chrome/common/chrome_constants.h"
#include "chrome/test/automation/automation_constants.h"
#include "chrome/test/automation/browser_proxy.h"
-#include "chrome/test/automation/constrained_window_proxy.h"
#include "chrome/test/automation/tab_proxy.h"
#include "chrome/test/automation/window_proxy.h"
#include "chrome/test/ui/ui_test.h"
@@ -18,9 +17,9 @@
#include "net/base/net_util.h"
#include "views/event.h"
-class InteractiveConstrainedWindowTest : public UITest {
+class BlockedPopupContainerInteractiveTest : public UITest {
protected:
- InteractiveConstrainedWindowTest() {
+ BlockedPopupContainerInteractiveTest() {
show_window_ = true;
}
@@ -62,7 +61,7 @@ class InteractiveConstrainedWindowTest : public UITest {
scoped_refptr<TabProxy> tab_;
};
-TEST_F(InteractiveConstrainedWindowTest, TestOpenAndResizeTo) {
+TEST_F(BlockedPopupContainerInteractiveTest, TestOpenAndResizeTo) {
NavigateMainTabTo(L"constrained_window_onload_resizeto.html");
SimulateClickInCenterOf(window_);
@@ -121,7 +120,7 @@ bool ParseCountOutOfTitle(const std::wstring& title, int* output) {
// Tests that in the window.open() equivalent of a fork bomb, we stop building
// windows.
-TEST_F(InteractiveConstrainedWindowTest, DontSpawnEndlessPopups) {
+TEST_F(BlockedPopupContainerInteractiveTest, DontSpawnEndlessPopups) {
NavigateMainTabTo(L"infinite_popups.html");
SimulateClickInCenterOf(window_);
@@ -164,7 +163,7 @@ TEST_F(InteractiveConstrainedWindowTest, DontSpawnEndlessPopups) {
// Make sure that we refuse to close windows when a constrained popup is
// displayed.
-TEST_F(InteractiveConstrainedWindowTest, WindowOpenWindowClosePopup) {
+TEST_F(BlockedPopupContainerInteractiveTest, WindowOpenWindowClosePopup) {
NavigateMainTabTo(L"openclose_main.html");
SimulateClickInCenterOf(window_);
@@ -183,7 +182,7 @@ TEST_F(InteractiveConstrainedWindowTest, WindowOpenWindowClosePopup) {
ASSERT_FALSE(automation()->WaitForWindowCountToBecome(1, 3000));
}
-TEST_F(InteractiveConstrainedWindowTest, BlockAlertFromBlockedPopup) {
+TEST_F(BlockedPopupContainerInteractiveTest, BlockAlertFromBlockedPopup) {
NavigateMainTabTo(L"block_alert.html");
// Wait for there to be an app modal dialog (and fail if it's shown).
@@ -200,7 +199,7 @@ TEST_F(InteractiveConstrainedWindowTest, BlockAlertFromBlockedPopup) {
ASSERT_EQ(1, popup_count);
}
-TEST_F(InteractiveConstrainedWindowTest, ShowAlertFromNormalPopup) {
+TEST_F(BlockedPopupContainerInteractiveTest, ShowAlertFromNormalPopup) {
NavigateMainTabTo(L"show_alert.html");
SimulateClickInCenterOf(window_);
@@ -221,7 +220,7 @@ TEST_F(InteractiveConstrainedWindowTest, ShowAlertFromNormalPopup) {
// Make sure that window focus works while creating a popup window so that we
// don't
-TEST_F(InteractiveConstrainedWindowTest, DontBreakOnBlur) {
+TEST_F(BlockedPopupContainerInteractiveTest, DontBreakOnBlur) {
NavigateMainTabTo(L"window_blur_test.html");
SimulateClickInCenterOf(window_);
diff --git a/chrome/browser/tab_contents/constrained_window.h b/chrome/browser/tab_contents/constrained_window.h
index d26087c..eb30363 100644
--- a/chrome/browser/tab_contents/constrained_window.h
+++ b/chrome/browser/tab_contents/constrained_window.h
@@ -42,27 +42,6 @@ class ConstrainedWindow {
// Closes the Constrained Window.
virtual void CloseConstrainedWindow() = 0;
-
- // Repositions the Constrained Window so that the lower right corner
- // of the titlebar is at the passed in |anchor_point|.
- virtual void RepositionConstrainedWindowTo(
- const gfx::Point& anchor_point) = 0;
-
- // Tells the Constrained Window that the constraining TabContents was hidden,
- // e.g. via a tab switch.
- virtual void WasHidden() = 0;
-
- // Tells the Constrained Window that the constraining TabContents became
- // visible, e.g. via a tab switch.
- virtual void DidBecomeSelected() = 0;
-
- // Returns the title of the Constrained Window.
- virtual std::wstring GetWindowTitle() const = 0;
-
- // Returns the current display rectangle (relative to its
- // parent). This method is only called from the unit tests to check
- // the location/size of a constrained window.
- virtual const gfx::Rect& GetCurrentBounds() const = 0;
};
#endif // #ifndef CHROME_TAB_CONTENTS_BROWSER_CONSTRAINED_WINDOW_H_
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 9453f98..ebea024 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -591,13 +591,6 @@ void TabContents::WasHidden() {
// OnWindowPosChanged() notices and calls HideContents() (which calls us).
if (render_widget_host_view())
render_widget_host_view()->WasHidden();
-
- // Loop through children and send WasHidden to them, too.
- int count = static_cast<int>(child_windows_.size());
- for (int i = count - 1; i >= 0; --i) {
- ConstrainedWindow* window = child_windows_.at(i);
- window->WasHidden();
- }
}
NotificationService::current()->Notify(
@@ -614,13 +607,6 @@ void TabContents::Activate() {
void TabContents::ShowContents() {
if (render_widget_host_view())
render_widget_host_view()->DidBecomeSelected();
-
- // Loop through children and send DidBecomeSelected to them, too.
- int count = static_cast<int>(child_windows_.size());
- for (int i = count - 1; i >= 0; --i) {
- ConstrainedWindow* window = child_windows_.at(i);
- window->DidBecomeSelected();
- }
}
void TabContents::HideContents() {
diff --git a/chrome/browser/views/constrained_window_impl.cc b/chrome/browser/views/constrained_window_impl.cc
index af40fc5..4ff891e 100644
--- a/chrome/browser/views/constrained_window_impl.cc
+++ b/chrome/browser/views/constrained_window_impl.cc
@@ -592,28 +592,6 @@ views::NonClientFrameView* ConstrainedWindowImpl::CreateFrameViewForWindow() {
return new ConstrainedWindowFrameView(this);
}
-void ConstrainedWindowImpl::ActivateConstrainedWindow() {
- // Other pop-ups are simply moved to the front of the z-order.
- SetWindowPos(HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
-
- // Store the focus of our parent focus manager so we can restore it when we
- // close.
- views::FocusManager* focus_manager =
- views::FocusManager::GetFocusManager(GetNativeView());
- DCHECK(focus_manager);
- focus_manager = focus_manager->GetParentFocusManager();
- if (focus_manager) {
- // We could not have a parent focus manager if the ConstrainedWindow is
- // displayed in a tab that is not currently selected.
- // TODO(jcampan): we should store the ConstrainedWindow active events in
- // that case and replay them when the TabContents becomes selected.
- focus_manager->StoreFocusedView();
-
- // Give our window the focus so we get keyboard messages.
- ::SetFocus(GetNativeView());
- }
-}
-
void ConstrainedWindowImpl::CloseConstrainedWindow() {
// Broadcast to all observers of NOTIFY_CWINDOW_CLOSED.
// One example of such an observer is AutomationCWindowTracker in the
@@ -625,14 +603,6 @@ void ConstrainedWindowImpl::CloseConstrainedWindow() {
Close();
}
-void ConstrainedWindowImpl::WasHidden() {
- DLOG(INFO) << "WasHidden";
-}
-
-void ConstrainedWindowImpl::DidBecomeSelected() {
- DLOG(INFO) << "DidBecomeSelected";
-}
-
std::wstring ConstrainedWindowImpl::GetWindowTitle() const {
std::wstring display_title;
if (GetDelegate())
@@ -671,6 +641,28 @@ void ConstrainedWindowImpl::InitAsDialog(const gfx::Rect& initial_bounds) {
ActivateConstrainedWindow();
}
+void ConstrainedWindowImpl::ActivateConstrainedWindow() {
+ // Other pop-ups are simply moved to the front of the z-order.
+ SetWindowPos(HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
+
+ // Store the focus of our parent focus manager so we can restore it when we
+ // close.
+ views::FocusManager* focus_manager =
+ views::FocusManager::GetFocusManager(GetNativeView());
+ DCHECK(focus_manager);
+ focus_manager = focus_manager->GetParentFocusManager();
+ if (focus_manager) {
+ // We could not have a parent focus manager if the ConstrainedWindow is
+ // displayed in a tab that is not currently selected.
+ // TODO(jcampan): we should store the ConstrainedWindow active events in
+ // that case and replay them when the TabContents becomes selected.
+ focus_manager->StoreFocusedView();
+
+ // Give our window the focus so we get keyboard messages.
+ ::SetFocus(GetNativeView());
+ }
+}
+
////////////////////////////////////////////////////////////////////////////////
// ConstrainedWindowImpl, views::WidgetWin overrides:
diff --git a/chrome/browser/views/constrained_window_impl.h b/chrome/browser/views/constrained_window_impl.h
index 0760a4d..2f3c32e 100644
--- a/chrome/browser/views/constrained_window_impl.h
+++ b/chrome/browser/views/constrained_window_impl.h
@@ -36,10 +36,6 @@ class ConstrainedWindowImpl : public ConstrainedWindow,
// Overridden from ConstrainedWindow:
virtual void CloseConstrainedWindow();
- virtual void ActivateConstrainedWindow();
- virtual void RepositionConstrainedWindowTo(const gfx::Point& anchor_point) {}
- virtual void WasHidden();
- virtual void DidBecomeSelected();
virtual std::wstring GetWindowTitle() const;
virtual const gfx::Rect& GetCurrentBounds() const;
@@ -63,6 +59,10 @@ class ConstrainedWindowImpl : public ConstrainedWindow,
// views::View client area.
void InitAsDialog(const gfx::Rect& initial_bounds);
+ // Moves this window to the front of the Z-order and registers us with the
+ // focus manager.
+ void ActivateConstrainedWindow();
+
// The TabContents that owns and constrains this ConstrainedWindow.
TabContents* owner_;