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

Side by Side Diff: chrome/browser/ui/cocoa/website_settings/chooser_bubble_ui_cocoa.h

Issue 2086663003: Change ChooserController ownership model (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed temporary unique ptr at ChooserBubbleUiCocoa Created 4 years, 5 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_COCOA_WEBSITE_SETTINGS_CHOOSER_BUBBLE_UI_COCOA_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_WEBSITE_SETTINGS_CHOOSER_BUBBLE_UI_COCOA_H_
6 #define CHROME_BROWSER_UI_COCOA_WEBSITE_SETTINGS_CHOOSER_BUBBLE_UI_COCOA_H_ 6 #define CHROME_BROWSER_UI_COCOA_WEBSITE_SETTINGS_CHOOSER_BUBBLE_UI_COCOA_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include <memory>
11
10 #include "base/macros.h" 12 #include "base/macros.h"
11 #include "components/bubble/bubble_ui.h" 13 #include "components/bubble/bubble_ui.h"
12 #include "components/chooser_controller/chooser_controller.h"
13 14
14 class Browser; 15 class Browser;
15 @class ChooserBubbleUiController; 16 @class ChooserBubbleUiController;
17 class ChooserController;
16 18
17 // ChooserBubbleUiCocoa implements a chooser-based permission model. 19 // ChooserBubbleUiCocoa implements a chooser-based permission model.
18 // It uses |NSTableView| to show a list of options for user to grant 20 // It uses |NSTableView| to show a list of options for user to grant
19 // permission. It can be used by the WebUSB or WebBluetooth APIs. 21 // permission. It can be used by the WebUSB or WebBluetooth APIs.
20 // It is owned by the BubbleController, which is owned by the BubbleManager. 22 // It is owned by the BubbleController, which is owned by the BubbleManager.
21 class ChooserBubbleUiCocoa : public BubbleUi, 23 class ChooserBubbleUiCocoa : public BubbleUi {
22 public ChooserController::Observer {
23 public: 24 public:
24 ChooserBubbleUiCocoa(Browser* browser, ChooserController* chooser_controller); 25 ChooserBubbleUiCocoa(Browser* browser,
26 std::unique_ptr<ChooserController> chooser_controller);
25 ~ChooserBubbleUiCocoa() override; 27 ~ChooserBubbleUiCocoa() override;
26 28
27 // BubbleUi: 29 // BubbleUi:
28 void Show(BubbleReference bubble_reference) override; 30 void Show(BubbleReference bubble_reference) override;
29 void Close() override; 31 void Close() override;
30 void UpdateAnchorPosition() override; 32 void UpdateAnchorPosition() override;
31 33
32 // ChooserController::Observer:
33 void OnOptionsInitialized() override;
34 void OnOptionAdded(size_t index) override;
35 void OnOptionRemoved(size_t index) override;
36
37 // Called when |chooser_bubble_ui_controller_| is closing. 34 // Called when |chooser_bubble_ui_controller_| is closing.
38 void OnBubbleClosing(); 35 void OnBubbleClosing();
39 36
40 private: 37 private:
41 Browser* browser_; // Weak. 38 Browser* browser_; // Weak.
42 ChooserController* chooser_controller_; // Weak.
43 // Cocoa-side chooser bubble UI controller. Weak, as it will close itself. 39 // Cocoa-side chooser bubble UI controller. Weak, as it will close itself.
44 ChooserBubbleUiController* chooser_bubble_ui_controller_; 40 ChooserBubbleUiController* chooser_bubble_ui_controller_;
45 41
46 DISALLOW_COPY_AND_ASSIGN(ChooserBubbleUiCocoa); 42 DISALLOW_COPY_AND_ASSIGN(ChooserBubbleUiCocoa);
47 }; 43 };
48 44
49 #endif // CHROME_BROWSER_UI_COCOA_WEBSITE_SETTINGS_CHOOSER_BUBBLE_UI_COCOA_H_ 45 #endif // CHROME_BROWSER_UI_COCOA_WEBSITE_SETTINGS_CHOOSER_BUBBLE_UI_COCOA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698