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

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

Issue 1456213002: Revert of [Extensions] Don't count bubble dismissal from focus loss as acknowledgment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 #ifndef UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ 5 #ifndef UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_
6 #define UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ 6 #define UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_
7 7
8 #include "base/gtest_prod_util.h" 8 #include "base/gtest_prod_util.h"
9 #include "ui/views/bubble/bubble_border.h" 9 #include "ui/views/bubble/bubble_border.h"
10 #include "ui/views/widget/widget.h" 10 #include "ui/views/widget/widget.h"
(...skipping 10 matching lines...) Expand all
21 class BubbleFrameView; 21 class BubbleFrameView;
22 22
23 // BubbleDelegateView creates frame and client views for bubble Widgets. 23 // BubbleDelegateView creates frame and client views for bubble Widgets.
24 // BubbleDelegateView itself is the client's contents view. 24 // BubbleDelegateView itself is the client's contents view.
25 class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView, 25 class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView,
26 public WidgetObserver { 26 public WidgetObserver {
27 public: 27 public:
28 // Internal class name. 28 // Internal class name.
29 static const char kViewClassName[]; 29 static const char kViewClassName[];
30 30
31 enum class CloseReason {
32 DEACTIVATION,
33 ESCAPE,
34 CLOSE_BUTTON,
35 UNKNOWN,
36 };
37
38 BubbleDelegateView(); 31 BubbleDelegateView();
39 BubbleDelegateView(View* anchor_view, BubbleBorder::Arrow arrow); 32 BubbleDelegateView(View* anchor_view, BubbleBorder::Arrow arrow);
40 ~BubbleDelegateView() override; 33 ~BubbleDelegateView() override;
41 34
42 // Create and initialize the bubble Widget(s) with proper bounds. 35 // Create and initialize the bubble Widget(s) with proper bounds.
43 static Widget* CreateBubble(BubbleDelegateView* bubble_delegate); 36 static Widget* CreateBubble(BubbleDelegateView* bubble_delegate);
44 37
45 // WidgetDelegateView overrides: 38 // WidgetDelegateView overrides:
46 BubbleDelegateView* AsBubbleDelegate() override; 39 BubbleDelegateView* AsBubbleDelegate() override;
47 bool ShouldShowCloseButton() const override; 40 bool ShouldShowCloseButton() const override;
48 View* GetContentsView() override; 41 View* GetContentsView() override;
49 NonClientFrameView* CreateNonClientFrameView(Widget* widget) override; 42 NonClientFrameView* CreateNonClientFrameView(Widget* widget) override;
50 void GetAccessibleState(ui::AXViewState* state) override; 43 void GetAccessibleState(ui::AXViewState* state) override;
51 const char* GetClassName() const override; 44 const char* GetClassName() const override;
52 45
53 // WidgetObserver overrides: 46 // WidgetObserver overrides:
54 void OnWidgetClosing(Widget* widget) override;
55 void OnWidgetDestroying(Widget* widget) override; 47 void OnWidgetDestroying(Widget* widget) override;
56 void OnWidgetVisibilityChanging(Widget* widget, bool visible) override; 48 void OnWidgetVisibilityChanging(Widget* widget, bool visible) override;
57 void OnWidgetVisibilityChanged(Widget* widget, bool visible) override; 49 void OnWidgetVisibilityChanged(Widget* widget, bool visible) override;
58 void OnWidgetActivationChanged(Widget* widget, bool active) override; 50 void OnWidgetActivationChanged(Widget* widget, bool active) override;
59 void OnWidgetBoundsChanged(Widget* widget, 51 void OnWidgetBoundsChanged(Widget* widget,
60 const gfx::Rect& new_bounds) override; 52 const gfx::Rect& new_bounds) override;
61 53
62 bool close_on_esc() const { return close_on_esc_; } 54 bool close_on_esc() const { return close_on_esc_; }
63 void set_close_on_esc(bool close_on_esc) { close_on_esc_ = close_on_esc; } 55 void set_close_on_esc(bool close_on_esc) { close_on_esc_ = close_on_esc; }
64 56
(...skipping 29 matching lines...) Expand all
94 86
95 bool accept_events() const { return accept_events_; } 87 bool accept_events() const { return accept_events_; }
96 void set_accept_events(bool accept_events) { accept_events_ = accept_events; } 88 void set_accept_events(bool accept_events) { accept_events_ = accept_events; }
97 89
98 bool border_accepts_events() const { return border_accepts_events_; } 90 bool border_accepts_events() const { return border_accepts_events_; }
99 void set_border_accepts_events(bool event) { border_accepts_events_ = event; } 91 void set_border_accepts_events(bool event) { border_accepts_events_ = event; }
100 92
101 bool adjust_if_offscreen() const { return adjust_if_offscreen_; } 93 bool adjust_if_offscreen() const { return adjust_if_offscreen_; }
102 void set_adjust_if_offscreen(bool adjust) { adjust_if_offscreen_ = adjust; } 94 void set_adjust_if_offscreen(bool adjust) { adjust_if_offscreen_ = adjust; }
103 95
104 CloseReason close_reason() const { return close_reason_; }
105
106 // Get the arrow's anchor rect in screen space. 96 // Get the arrow's anchor rect in screen space.
107 virtual gfx::Rect GetAnchorRect() const; 97 virtual gfx::Rect GetAnchorRect() const;
108 98
109 // Allows delegates to provide custom parameters before widget initialization. 99 // Allows delegates to provide custom parameters before widget initialization.
110 virtual void OnBeforeBubbleWidgetInit(Widget::InitParams* params, 100 virtual void OnBeforeBubbleWidgetInit(Widget::InitParams* params,
111 Widget* widget) const; 101 Widget* widget) const;
112 102
113 // Sets the bubble alignment relative to the anchor. This may only be called 103 // Sets the bubble alignment relative to the anchor. This may only be called
114 // after calling CreateBubble. 104 // after calling CreateBubble.
115 void SetAlignment(BubbleBorder::BubbleAlignment alignment); 105 void SetAlignment(BubbleBorder::BubbleAlignment alignment);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 bool accept_events_; 185 bool accept_events_;
196 bool border_accepts_events_; 186 bool border_accepts_events_;
197 187
198 // If true (defaults to true), the arrow may be mirrored and moved to fit the 188 // If true (defaults to true), the arrow may be mirrored and moved to fit the
199 // bubble on screen better. It would be a no-op if the bubble has no arrow. 189 // bubble on screen better. It would be a no-op if the bubble has no arrow.
200 bool adjust_if_offscreen_; 190 bool adjust_if_offscreen_;
201 191
202 // Parent native window of the bubble. 192 // Parent native window of the bubble.
203 gfx::NativeView parent_window_; 193 gfx::NativeView parent_window_;
204 194
205 CloseReason close_reason_;
206
207 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); 195 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView);
208 }; 196 };
209 197
210 } // namespace views 198 } // namespace views
211 199
212 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ 200 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698