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

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

Issue 2086663003: Change ChooserController ownership model (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address reillyg@'s comments Created 4 years, 6 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 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>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "components/bubble/bubble_ui.h" 11 #include "components/bubble/bubble_ui.h"
10 #include "ui/views/bubble/bubble_border.h" 12 #include "ui/views/bubble/bubble_border.h"
11 13
12 namespace views { 14 namespace views {
13 class View; 15 class View;
14 } 16 }
15 17
16 class Browser; 18 class Browser;
17 class ChooserController; 19 class ChooserController;
18 class ChooserBubbleUiViewDelegate; 20 class ChooserBubbleUiViewDelegate;
19 21
20 // ChooserBubbleUiView implements a chooser-based permission model, 22 // ChooserBubbleUiView implements a chooser-based permission model,
21 // 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.)
22 // 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
23 // 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
24 // BubbleManager. 26 // BubbleManager.
25 class ChooserBubbleUiView : public BubbleUi { 27 class ChooserBubbleUiView : public BubbleUi {
26 public: 28 public:
27 ChooserBubbleUiView(Browser* browser, ChooserController* chooser_controller); 29 ChooserBubbleUiView(Browser* browser,
30 std::unique_ptr<ChooserController> chooser_controller);
28 ~ChooserBubbleUiView() override; 31 ~ChooserBubbleUiView() override;
29 32
30 // BubbleUi: 33 // BubbleUi:
31 void Show(BubbleReference bubble_reference) override; 34 void Show(BubbleReference bubble_reference) override;
32 void Close() override; 35 void Close() override;
33 void UpdateAnchorPosition() override; 36 void UpdateAnchorPosition() override;
34 37
35 private: 38 private:
36 friend class ChooserBubbleUiViewDelegate; 39 friend class ChooserBubbleUiViewDelegate;
37 views::View* GetAnchorView(); 40 views::View* GetAnchorView();
38 views::BubbleBorder::Arrow GetAnchorArrow(); 41 views::BubbleBorder::Arrow GetAnchorArrow();
39 42
40 Browser* browser_; // Weak. 43 Browser* browser_; // Weak.
41 // Weak, owned by ChooserBubbleDelegate.
42 ChooserController* chooser_controller_;
43 // Weak. Owned by its parent view. 44 // Weak. Owned by its parent view.
44 ChooserBubbleUiViewDelegate* chooser_bubble_ui_view_delegate_; 45 ChooserBubbleUiViewDelegate* chooser_bubble_ui_view_delegate_;
45 46
46 DISALLOW_COPY_AND_ASSIGN(ChooserBubbleUiView); 47 DISALLOW_COPY_AND_ASSIGN(ChooserBubbleUiView);
47 }; 48 };
48 49
49 #endif // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_CHOOSER_BUBBLE_UI_VIEW_H_ 50 #endif // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_CHOOSER_BUBBLE_UI_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698