summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorwittman@chromium.org <wittman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-06 06:50:23 +0000
committerwittman@chromium.org <wittman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-06 06:50:23 +0000
commit51a2478710c9b2beda273832f2e4f4c825aa279a (patch)
tree77a926fd642222b69989250f7295d95d3cd42724 /ui
parent8cea789efbec4198ab2315ee2f49927523832d2f (diff)
downloadchromium_src-51a2478710c9b2beda273832f2e4f4c825aa279a.zip
chromium_src-51a2478710c9b2beda273832f2e4f4c825aa279a.tar.gz
chromium_src-51a2478710c9b2beda273832f2e4f4c825aa279a.tar.bz2
Refactor modality-specific behavior from ConstrainedWindowViews to WebContentsModalDialogManager
This CL moves the Views web contents modal dialog code towards the interface described in the associated bug. Similar changes for Gtk and Cocoa will be made in follow-on CLs. To that end, this CL contains the following detailed changes: - Introduce NativeWebContentsModalDialogManager for providing platform-specific UI functionality within WebContentsModalDialogManager, and implement NativeWebContentsModalDialogManagerViews. - Under Views, move to a model where WebContentsModalDialogManager listens for closing events rather than requiring notifications from the widget. Continue using the existing model on Gtk and Cocoa, pending refactoring there. - Provide a mechanism for disabling mouse-driven dialog movement on Widget. - Remove NativeConstrainedWindowDelegate and subclasses as they're no longer necessary due to the above two items. - Update tests to account for closing notification to WebContentsModalDialogManager being done from the event loop, rather than synchronously. - Add temporary ConstrainedWindowViews factory function to minimize code churn at construction sites during this refactoring. The next planned steps in this work are: - Refactor ConstrainedWindow subclasses under Gtk and Cocoa to listen for closing events rather than requiring notifications from the widget. - Refactor uses of WebContentsModalDialog interface to use platform-specific equivalents in platform-specific code and, in platform-independent code, invoke functionality via some other mechanism: platform_utils, WebContentsModalDialogManager, ???. Remove WebContentsModalDialog interface. - Generalize WebContentsModalDialogManagerDelegate positioning interface and write WebContentsModalDialogManager::ShowDialog using the new interface. BUG=157161 Review URL: https://chromiumcodereview.appspot.com/12045037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180904 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/views/widget/widget.cc10
-rw-r--r--ui/views/widget/widget.h8
2 files changed, 16 insertions, 2 deletions
diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc
index 4a7bfcd..c1e5602 100644
--- a/ui/views/widget/widget.cc
+++ b/ui/views/widget/widget.cc
@@ -200,7 +200,8 @@ Widget::Widget()
is_mouse_button_pressed_(false),
is_touch_down_(false),
last_mouse_event_was_move_(false),
- root_layers_dirty_(false) {
+ root_layers_dirty_(false),
+ movement_disabled_(false) {
}
Widget::~Widget() {
@@ -1124,9 +1125,14 @@ void Widget::OnNativeWidgetPaint(gfx::Canvas* canvas) {
}
int Widget::GetNonClientComponent(const gfx::Point& point) {
- return non_client_view_ ?
+ int component = non_client_view_ ?
non_client_view_->NonClientHitTest(point) :
HTNOWHERE;
+
+ if (movement_disabled_ && (component == HTCAPTION || component == HTSYSMENU))
+ return HTNOWHERE;
+
+ return component;
}
void Widget::OnKeyEvent(ui::KeyEvent* event) {
diff --git a/ui/views/widget/widget.h b/ui/views/widget/widget.h
index 22fda18..fee59fc 100644
--- a/ui/views/widget/widget.h
+++ b/ui/views/widget/widget.h
@@ -645,6 +645,10 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
// with it. TYPE_CONTROL and TYPE_TOOLTIP is not considered top level.
bool is_top_level() const { return is_top_level_; }
+ // True when window movement via mouse interaction with the frame is disabled.
+ bool movement_disabled() const { return movement_disabled_; }
+ void set_movement_disabled(bool disabled) { movement_disabled_ = disabled; }
+
// Returns the work area bounds of the screen the Widget belongs to.
gfx::Rect GetWorkAreaBoundsInScreen() const;
@@ -836,6 +840,10 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
// Is |root_layers_| out of date?
bool root_layers_dirty_;
+ // True when window movement via mouse interaction with the frame should be
+ // disabled.
+ bool movement_disabled_;
+
DISALLOW_COPY_AND_ASSIGN(Widget);
};