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

Side by Side Diff: chrome/browser/ui/views/website_settings/chooser_bubble_ui_view.h

Issue 2724903008: Force chooser bubbles to close synchronously. (Closed)
Patch Set: Address msw@'s nits. Created 3 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/website_settings/chooser_bubble_ui_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
13 14
14 namespace views { 15 namespace views {
15 class View; 16 class View;
16 } 17 }
17 18
18 class Browser; 19 class Browser;
19 class ChooserController; 20 class ChooserController;
20 class ChooserBubbleUiViewDelegate; 21 class ChooserBubbleUiViewDelegate;
21 22
22 // ChooserBubbleUiView implements a chooser-based permission model, 23 // ChooserBubbleUiView implements a chooser-based permission model,
23 // it uses table view to show a list of items (such as usb devices, etc.) 24 // it uses table view to show a list of items (such as usb devices, etc.)
24 // for user to grant permission. It can be used by the WebUSB or WebBluetooth 25 // for user to grant permission. It can be used by the WebUSB or WebBluetooth
25 // APIs. It is owned by the BubbleController, which is owned by the 26 // APIs. It is owned by the BubbleController, which is owned by the
26 // BubbleManager. 27 // BubbleManager.
27 class ChooserBubbleUiView : public BubbleUi { 28 class ChooserBubbleUiView : public BubbleUi, public views::WidgetObserver {
28 public: 29 public:
29 ChooserBubbleUiView(Browser* browser, 30 ChooserBubbleUiView(Browser* browser,
30 std::unique_ptr<ChooserController> chooser_controller); 31 std::unique_ptr<ChooserController> chooser_controller);
31 ~ChooserBubbleUiView() override; 32 ~ChooserBubbleUiView() override;
32 33
33 // BubbleUi: 34 // BubbleUi:
34 void Show(BubbleReference bubble_reference) override; 35 void Show(BubbleReference bubble_reference) override;
35 void Close() override; 36 void Close() override;
36 void UpdateAnchorPosition() override; 37 void UpdateAnchorPosition() override;
37 38
39 // views::WidgetObserver:
40 void OnWidgetClosing(views::Widget* widget) override;
41
38 private: 42 private:
39 views::View* GetAnchorView(); 43 views::View* GetAnchorView();
40 views::BubbleBorder::Arrow GetAnchorArrow(); 44 views::BubbleBorder::Arrow GetAnchorArrow();
41 45
42 Browser* browser_; // Weak. 46 Browser* browser_; // Weak.
43 // Weak. Owned by its parent view. 47 // Weak. Owned by its parent view.
44 ChooserBubbleUiViewDelegate* chooser_bubble_ui_view_delegate_; 48 ChooserBubbleUiViewDelegate* bubble_view_ = nullptr;
45 49
46 DISALLOW_COPY_AND_ASSIGN(ChooserBubbleUiView); 50 DISALLOW_COPY_AND_ASSIGN(ChooserBubbleUiView);
47 }; 51 };
48 52
49 #endif // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_CHOOSER_BUBBLE_UI_VIEW_H_ 53 #endif // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_CHOOSER_BUBBLE_UI_VIEW_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/website_settings/chooser_bubble_ui_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698