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_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. | 39 // |chooser_controller_| is not owned by this class. |
40 // It is owned by ChooserContentViewCocoa. | |
41 std::unique_ptr<ChooserController> chooser_controller_; | |
Reilly Grant (use Gerrit)
2016/06/22 00:01:32
The comment is confusing because it seems to be di
juncai
2016/06/22 01:17:45
Done.
| |
43 // Cocoa-side chooser bubble UI controller. Weak, as it will close itself. | 42 // Cocoa-side chooser bubble UI controller. Weak, as it will close itself. |
44 ChooserBubbleUiController* chooser_bubble_ui_controller_; | 43 ChooserBubbleUiController* chooser_bubble_ui_controller_; |
45 | 44 |
46 DISALLOW_COPY_AND_ASSIGN(ChooserBubbleUiCocoa); | 45 DISALLOW_COPY_AND_ASSIGN(ChooserBubbleUiCocoa); |
47 }; | 46 }; |
48 | 47 |
49 #endif // CHROME_BROWSER_UI_COCOA_WEBSITE_SETTINGS_CHOOSER_BUBBLE_UI_COCOA_H_ | 48 #endif // CHROME_BROWSER_UI_COCOA_WEBSITE_SETTINGS_CHOOSER_BUBBLE_UI_COCOA_H_ |
OLD | NEW |