diff options
author | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-17 22:27:43 +0000 |
---|---|---|
committer | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-17 22:27:43 +0000 |
commit | 50ff938086c1529a955330a5bfc361fcf113956e (patch) | |
tree | 9af4e2ed6ad081d0ba6fb59aa3a7ab6ddb46155e /ui | |
parent | b11afaf2c35bca16adae6595bda8999b8d0bcf60 (diff) | |
download | chromium_src-50ff938086c1529a955330a5bfc361fcf113956e.zip chromium_src-50ff938086c1529a955330a5bfc361fcf113956e.tar.gz chromium_src-50ff938086c1529a955330a5bfc361fcf113956e.tar.bz2 |
Revert 137059 - Better fix for closing uber tray when clicking on Desktop
Bug=None
Test=Manual
Review URL: https://chromiumcodereview.appspot.com/9877015
TBR=pkotwicz@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10383236
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137752 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/views/bubble/bubble_delegate.cc | 7 | ||||
-rw-r--r-- | ui/views/bubble/bubble_delegate.h | 1 | ||||
-rw-r--r-- | ui/views/widget/widget.cc | 25 | ||||
-rw-r--r-- | ui/views/widget/widget.h | 9 |
4 files changed, 9 insertions, 33 deletions
diff --git a/ui/views/bubble/bubble_delegate.cc b/ui/views/bubble/bubble_delegate.cc index 072f355..92645a8 100644 --- a/ui/views/bubble/bubble_delegate.cc +++ b/ui/views/bubble/bubble_delegate.cc @@ -25,7 +25,6 @@ Widget* CreateBubbleWidget(BubbleDelegateView* bubble) { Widget::InitParams bubble_params(Widget::InitParams::TYPE_BUBBLE); bubble_params.delegate = bubble; bubble_params.transparent = true; - bubble_params.close_on_deactivate = bubble->close_on_deactivate(); if (bubble->parent_window()) bubble_params.parent = bubble->parent_window(); else @@ -213,6 +212,12 @@ void BubbleDelegateView::OnWidgetVisibilityChanged(Widget* widget, } } +void BubbleDelegateView::OnWidgetActivationChanged(Widget* widget, + bool active) { + if (close_on_deactivate() && widget == GetWidget() && !active) + GetWidget()->Close(); +} + void BubbleDelegateView::OnWidgetMoved(Widget* widget) { if (move_with_anchor() && anchor_widget() == widget) SizeToContents(); diff --git a/ui/views/bubble/bubble_delegate.h b/ui/views/bubble/bubble_delegate.h index 25d13f8..be66f80 100644 --- a/ui/views/bubble/bubble_delegate.h +++ b/ui/views/bubble/bubble_delegate.h @@ -50,6 +50,7 @@ class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView, // Widget::Observer overrides: virtual void OnWidgetClosing(Widget* widget) OVERRIDE; virtual void OnWidgetVisibilityChanged(Widget* widget, bool visible) OVERRIDE; + virtual void OnWidgetActivationChanged(Widget* widget, bool active) OVERRIDE; virtual void OnWidgetMoved(Widget* widget) OVERRIDE; bool close_on_esc() const { return close_on_esc_; } diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc index e5f3072..e238c67 100644 --- a/ui/views/widget/widget.cc +++ b/ui/views/widget/widget.cc @@ -4,7 +4,6 @@ #include "ui/views/widget/widget.h" -#include "base/bind.h" #include "base/logging.h" #include "base/message_loop.h" #include "base/utf_string_conversions.h" @@ -108,7 +107,6 @@ Widget::InitParams::InitParams() ViewsDelegate::views_delegate->UseTransparentWindows()), accept_events(true), can_activate(true), - close_on_deactivate(false), keep_on_top(false), ownership(NATIVE_WIDGET_OWNS_WIDGET), mirror_origin_in_rtl(false), @@ -133,7 +131,6 @@ Widget::InitParams::InitParams(Type type) ViewsDelegate::views_delegate->UseTransparentWindows()), accept_events(true), can_activate(type != TYPE_POPUP && type != TYPE_MENU), - close_on_deactivate(false), keep_on_top(type == TYPE_MENU), ownership(NATIVE_WIDGET_OWNS_WIDGET), mirror_origin_in_rtl(false), @@ -156,8 +153,7 @@ gfx::NativeView Widget::InitParams::GetParent() const { // Widget, public: Widget::Widget() - : ALLOW_THIS_IN_INITIALIZER_LIST(set_capture_factory_(this)), - native_widget_(NULL), + : native_widget_(NULL), widget_delegate_(NULL), non_client_view_(NULL), dragged_view_(NULL), @@ -169,7 +165,6 @@ Widget::Widget() widget_closed_(false), saved_show_state_(ui::SHOW_STATE_DEFAULT), focus_on_creation_(true), - close_on_deactivate_(false), is_top_level_(false), native_widget_initialized_(false), native_widget_destroyed_(false), @@ -321,7 +316,6 @@ void Widget::Init(const InitParams& params) { SetContentsView(params.delegate->GetContentsView()); SetInitialBoundsForFramelessWindow(params.bounds); } - close_on_deactivate_ = params.close_on_deactivate; native_widget_initialized_ = true; } @@ -517,14 +511,6 @@ void Widget::Show() { } else { native_widget_->Show(); } - - if (CanActivate() && close_on_deactivate_) { - // Set mouse capture on timeout in case this is called from a - // mouse pressed handler. - MessageLoopForUI::current()->PostTask(FROM_HERE, base::Bind( - &Widget::SetMouseCapture, set_capture_factory_.GetWeakPtr(), - static_cast<View*>(NULL))); - } } void Widget::Hide() { @@ -1064,8 +1050,6 @@ bool Widget::OnMouseEvent(const MouseEvent& event) { native_widget_->SetCapture(); return true; } - if (close_on_deactivate_ && !GetRootView()->HitTest(event.location())) - Close(); return false; case ui::ET_MOUSE_RELEASED: last_mouse_event_was_move_ = false; @@ -1106,11 +1090,6 @@ void Widget::OnMouseCaptureLost() { if (is_mouse_button_pressed_) GetRootView()->OnMouseCaptureLost(); is_mouse_button_pressed_ = false; - - // Without mouse capture, the widget doesn't process all events so can miss - // the user clicking outside the root view's bounds. - if (close_on_deactivate_) - Close(); } ui::TouchStatus Widget::OnTouchEvent(const TouchEvent& event) { @@ -1178,7 +1157,7 @@ void Widget::DestroyRootView() { // Widget, private: bool Widget::ShouldReleaseCaptureOnMouseReleased() const { - return !close_on_deactivate_; + return true; } void Widget::SetInactiveRenderingDisabled(bool value) { diff --git a/ui/views/widget/widget.h b/ui/views/widget/widget.h index 82ab276..c754e95 100644 --- a/ui/views/widget/widget.h +++ b/ui/views/widget/widget.h @@ -11,7 +11,6 @@ #include "base/gtest_prod_util.h" #include "base/memory/scoped_ptr.h" -#include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "ui/base/accessibility/accessibility_types.h" #include "ui/base/ui_base_types.h" @@ -164,7 +163,6 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, bool transparent; bool accept_events; bool can_activate; - bool close_on_deactivate; bool keep_on_top; Ownership ownership; bool mirror_origin_in_rtl; @@ -695,8 +693,6 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, // It's only for testing purpose. void ReplaceInputMethod(InputMethod* input_method); - base::WeakPtrFactory<Widget> set_capture_factory_; - internal::NativeWidgetPrivate* native_widget_; ObserverList<Observer> observers_; @@ -762,11 +758,6 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, // initial focus for the widget. bool focus_on_creation_; - // If true, the widget is closed when the user clicks outside the root view's - // bounds. This intentionally encompasses some situations where deactivation - // does not happen. - bool close_on_deactivate_; - scoped_ptr<InputMethod> input_method_; // See |is_top_level()| accessor. |