OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_TOOLBAR_ACTIONS_BAR_BUBBLE_VIEWS_PRES
ENTER_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_TOOLBAR_ACTIONS_BAR_BUBBLE_VIEWS_PRES
ENTER_H_ |
| 7 |
| 8 #import <Foundation/Foundation.h> |
| 9 |
| 10 #include <memory> |
| 11 |
| 12 #include "base/macros.h" |
| 13 #include "ui/views/widget/widget_observer.h" |
| 14 |
| 15 @class NSWindow; |
| 16 |
| 17 namespace test { |
| 18 class ToolbarActionsBarBubbleViewsPresenterTestApi; |
| 19 } |
| 20 |
| 21 @class BrowserActionsController; |
| 22 class ToolbarActionsBarBubbleDelegate; |
| 23 class ToolbarActionsBarBubbleViews; |
| 24 |
| 25 // Helper class for showing a toolkit-views toolbar action bubble on a Cocoa |
| 26 // browser. |
| 27 class ToolbarActionsBarBubbleViewsPresenter : public views::WidgetObserver { |
| 28 public: |
| 29 explicit ToolbarActionsBarBubbleViewsPresenter( |
| 30 BrowserActionsController* owner); |
| 31 ~ToolbarActionsBarBubbleViewsPresenter() override; |
| 32 |
| 33 // Presents |bubble| attached to the provided browser |parent_window| at |
| 34 // |point_in_screen|. |anchored_to_action_view| indicates that the anchor is |
| 35 // a specific browser action view, rather than something more general. |
| 36 void PresentAt(std::unique_ptr<ToolbarActionsBarBubbleDelegate> bubble, |
| 37 NSWindow* parent_window, |
| 38 NSPoint point_in_screen, |
| 39 bool anchored_to_action_view); |
| 40 |
| 41 private: |
| 42 friend class test::ToolbarActionsBarBubbleViewsPresenterTestApi; |
| 43 |
| 44 // WidgetObserver: |
| 45 void OnWidgetClosing(views::Widget* widget) override; |
| 46 void OnWidgetDestroying(views::Widget* widget) override; |
| 47 |
| 48 BrowserActionsController* owner_; // Weak. Owns |this|. |
| 49 |
| 50 // Weak. Owns by its Widget (observed by |this|). |
| 51 ToolbarActionsBarBubbleViews* active_bubble_; |
| 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(ToolbarActionsBarBubbleViewsPresenter); |
| 54 }; |
| 55 |
| 56 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_TOOLBAR_ACTIONS_BAR_BUBBLE_VIEWS_P
RESENTER_H_ |
OLD | NEW |