Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(510)

Side by Side Diff: ui/views/bubble/bubble_delegate.cc

Issue 1637383003: MacViews: Fix views_unittests BubbleDelegateTest.CloseReasons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix type of params.child (bool, not ptr). Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/bubble/bubble_delegate.h" 5 #include "ui/views/bubble/bubble_delegate.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "ui/accessibility/ax_view_state.h" 8 #include "ui/accessibility/ax_view_state.h"
9 #include "ui/base/default_style.h" 9 #include "ui/base/default_style.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
(...skipping 20 matching lines...) Expand all
31 Widget::InitParams bubble_params(Widget::InitParams::TYPE_BUBBLE); 31 Widget::InitParams bubble_params(Widget::InitParams::TYPE_BUBBLE);
32 bubble_params.delegate = bubble; 32 bubble_params.delegate = bubble;
33 bubble_params.opacity = Widget::InitParams::TRANSLUCENT_WINDOW; 33 bubble_params.opacity = Widget::InitParams::TRANSLUCENT_WINDOW;
34 bubble_params.accept_events = bubble->accept_events(); 34 bubble_params.accept_events = bubble->accept_events();
35 if (bubble->parent_window()) 35 if (bubble->parent_window())
36 bubble_params.parent = bubble->parent_window(); 36 bubble_params.parent = bubble->parent_window();
37 else if (bubble->anchor_widget()) 37 else if (bubble->anchor_widget())
38 bubble_params.parent = bubble->anchor_widget()->GetNativeView(); 38 bubble_params.parent = bubble->anchor_widget()->GetNativeView();
39 bubble_params.activatable = bubble->CanActivate() ? 39 bubble_params.activatable = bubble->CanActivate() ?
40 Widget::InitParams::ACTIVATABLE_YES : Widget::InitParams::ACTIVATABLE_NO; 40 Widget::InitParams::ACTIVATABLE_YES : Widget::InitParams::ACTIVATABLE_NO;
41 bubble_params.child = true;
41 bubble->OnBeforeBubbleWidgetInit(&bubble_params, bubble_widget); 42 bubble->OnBeforeBubbleWidgetInit(&bubble_params, bubble_widget);
42 bubble_widget->Init(bubble_params); 43 bubble_widget->Init(bubble_params);
43 if (bubble_params.parent) 44 if (bubble_params.parent)
44 bubble_widget->StackAbove(bubble_params.parent); 45 bubble_widget->StackAbove(bubble_params.parent);
45 return bubble_widget; 46 return bubble_widget;
46 } 47 }
47 48
48 } // namespace 49 } // namespace
49 50
50 // static 51 // static
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 171
171 void BubbleDelegateView::OnWidgetVisibilityChanged(Widget* widget, 172 void BubbleDelegateView::OnWidgetVisibilityChanged(Widget* widget,
172 bool visible) { 173 bool visible) {
173 #if !defined(OS_WIN) 174 #if !defined(OS_WIN)
174 HandleVisibilityChanged(widget, visible); 175 HandleVisibilityChanged(widget, visible);
175 #endif 176 #endif
176 } 177 }
177 178
178 void BubbleDelegateView::OnWidgetActivationChanged(Widget* widget, 179 void BubbleDelegateView::OnWidgetActivationChanged(Widget* widget,
179 bool active) { 180 bool active) {
180 if (close_on_deactivate() && widget == GetWidget() && !active) { 181 // Only close the widget if it's been shown in the first place.
tapted 2016/03/01 02:42:39 Was this necessary to get the test to pass? Otherw
Patti Lor 2016/03/01 06:54:48 Have reverted this. The child = true change preven
182 if (close_on_deactivate() && widget == GetWidget() && !active &&
183 GetWidget()->IsActive()) {
181 if (close_reason_ == CloseReason::UNKNOWN) 184 if (close_reason_ == CloseReason::UNKNOWN)
182 close_reason_ = CloseReason::DEACTIVATION; 185 close_reason_ = CloseReason::DEACTIVATION;
183 GetWidget()->Close(); 186 GetWidget()->Close();
184 } 187 }
185 } 188 }
186 189
187 void BubbleDelegateView::OnWidgetBoundsChanged(Widget* widget, 190 void BubbleDelegateView::OnWidgetBoundsChanged(Widget* widget,
188 const gfx::Rect& new_bounds) { 191 const gfx::Rect& new_bounds) {
189 if (GetBubbleFrameView() && anchor_widget() == widget) 192 if (GetBubbleFrameView() && anchor_widget() == widget)
190 SizeToContents(); 193 SizeToContents();
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 // http://crbug.com/474622 for details. 332 // http://crbug.com/474622 for details.
330 if (widget == GetWidget() && visible) { 333 if (widget == GetWidget() && visible) {
331 ui::AXViewState state; 334 ui::AXViewState state;
332 GetAccessibleState(&state); 335 GetAccessibleState(&state);
333 if (state.role == ui::AX_ROLE_ALERT_DIALOG) 336 if (state.role == ui::AX_ROLE_ALERT_DIALOG)
334 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); 337 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true);
335 } 338 }
336 } 339 }
337 340
338 } // namespace views 341 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/bubble/bubble_delegate_unittest.cc » ('j') | ui/views/bubble/bubble_delegate_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698