| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_CHOOSER_BUBBLE_UI_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_CHOOSER_BUBBLE_UI_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_CHOOSER_BUBBLE_UI_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_CHOOSER_BUBBLE_UI_VIEW_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "components/bubble/bubble_ui.h" | 11 #include "components/bubble/bubble_ui.h" |
| 12 #include "ui/views/bubble/bubble_border.h" | 12 #include "ui/views/bubble/bubble_border.h" |
| 13 #include "ui/views/widget/widget_observer.h" | |
| 14 | 13 |
| 15 namespace views { | 14 namespace views { |
| 16 class View; | 15 class View; |
| 17 } | 16 } |
| 18 | 17 |
| 19 class Browser; | 18 class Browser; |
| 20 class ChooserController; | 19 class ChooserController; |
| 21 class ChooserBubbleUiViewDelegate; | 20 class ChooserBubbleUiViewDelegate; |
| 22 | 21 |
| 23 // ChooserBubbleUiView implements a chooser-based permission model, | 22 // ChooserBubbleUiView implements a chooser-based permission model, |
| 24 // it uses table view to show a list of items (such as usb devices, etc.) | 23 // it uses table view to show a list of items (such as usb devices, etc.) |
| 25 // for user to grant permission. It can be used by the WebUSB or WebBluetooth | 24 // for user to grant permission. It can be used by the WebUSB or WebBluetooth |
| 26 // APIs. It is owned by the BubbleController, which is owned by the | 25 // APIs. It is owned by the BubbleController, which is owned by the |
| 27 // BubbleManager. | 26 // BubbleManager. |
| 28 class ChooserBubbleUiView : public BubbleUi, public views::WidgetObserver { | 27 class ChooserBubbleUiView : public BubbleUi { |
| 29 public: | 28 public: |
| 30 ChooserBubbleUiView(Browser* browser, | 29 ChooserBubbleUiView(Browser* browser, |
| 31 std::unique_ptr<ChooserController> chooser_controller); | 30 std::unique_ptr<ChooserController> chooser_controller); |
| 32 ~ChooserBubbleUiView() override; | 31 ~ChooserBubbleUiView() override; |
| 33 | 32 |
| 34 // BubbleUi: | 33 // BubbleUi: |
| 35 void Show(BubbleReference bubble_reference) override; | 34 void Show(BubbleReference bubble_reference) override; |
| 36 void Close() override; | 35 void Close() override; |
| 37 void UpdateAnchorPosition() override; | 36 void UpdateAnchorPosition() override; |
| 38 | 37 |
| 39 // views::WidgetObserver: | |
| 40 void OnWidgetClosing(views::Widget* widget) override; | |
| 41 | |
| 42 private: | 38 private: |
| 43 views::View* GetAnchorView(); | 39 views::View* GetAnchorView(); |
| 44 views::BubbleBorder::Arrow GetAnchorArrow(); | 40 views::BubbleBorder::Arrow GetAnchorArrow(); |
| 45 | 41 |
| 46 Browser* browser_; // Weak. | 42 Browser* browser_; // Weak. |
| 47 // Weak. Owned by its parent view. | 43 // Weak. Owned by its parent view. |
| 48 ChooserBubbleUiViewDelegate* bubble_view_ = nullptr; | 44 ChooserBubbleUiViewDelegate* chooser_bubble_ui_view_delegate_; |
| 49 | 45 |
| 50 DISALLOW_COPY_AND_ASSIGN(ChooserBubbleUiView); | 46 DISALLOW_COPY_AND_ASSIGN(ChooserBubbleUiView); |
| 51 }; | 47 }; |
| 52 | 48 |
| 53 #endif // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_CHOOSER_BUBBLE_UI_VIEW_H_ | 49 #endif // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_CHOOSER_BUBBLE_UI_VIEW_H_ |
| OLD | NEW |