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_WEBSITE_SETTINGS_CHOOSER_BUBBLE_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBSITE_SETTINGS_CHOOSER_BUBBLE_DELEGATE_H_ |
6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_CHOOSER_BUBBLE_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_CHOOSER_BUBBLE_DELEGATE_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "components/bubble/bubble_delegate.h" | 9 #include "components/bubble/bubble_delegate.h" |
10 | 10 |
11 class Browser; | 11 class Browser; |
12 class ChooserController; | 12 class ChooserController; |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 class RenderFrameHost; | 15 class RenderFrameHost; |
16 } | 16 } |
17 | 17 |
18 // ChooserBubbleDelegate overrides GetName() to identify the bubble | 18 // ChooserBubbleDelegate overrides GetName() to identify the bubble |
19 // you define for collecting metrics. Create an instance of this | 19 // you define for collecting metrics. Create an instance of this |
20 // class and pass it to BubbleManager::ShowBubble() to show the bubble. | 20 // class and pass it to BubbleManager::ShowBubble() to show the bubble. |
21 class ChooserBubbleDelegate : public BubbleDelegate { | 21 class ChooserBubbleDelegate : public BubbleDelegate { |
22 public: | 22 public: |
23 explicit ChooserBubbleDelegate( | 23 explicit ChooserBubbleDelegate( |
msw
2016/06/22 18:23:17
nit: remove explicit
juncai
2016/06/22 22:41:20
Done.
| |
24 content::RenderFrameHost* owner, | 24 content::RenderFrameHost* owner, |
25 std::unique_ptr<ChooserController> chooser_controller); | 25 std::unique_ptr<ChooserController> chooser_controller); |
26 ~ChooserBubbleDelegate() override; | 26 ~ChooserBubbleDelegate() override; |
27 | 27 |
28 // BubbleDelegate: | 28 // BubbleDelegate: |
29 std::string GetName() const override; | 29 std::string GetName() const override; |
30 std::unique_ptr<BubbleUi> BuildBubbleUi() override; | 30 std::unique_ptr<BubbleUi> BuildBubbleUi() override; |
31 const content::RenderFrameHost* OwningFrame() const override; | 31 const content::RenderFrameHost* OwningFrame() const override; |
32 | 32 |
33 ChooserController* chooser_controller() const { | |
34 return chooser_controller_.get(); | |
35 } | |
36 | |
37 private: | 33 private: |
38 const content::RenderFrameHost* const owning_frame_; | 34 const content::RenderFrameHost* const owning_frame_; |
39 Browser* browser_; | 35 Browser* browser_; |
36 // |chooser_controller_| is not owned by this class, it is owned by | |
37 // ChooserContentView(non-Mac)/ChooserContentViewCocoa(Mac). | |
msw
2016/06/22 18:23:17
optional nit: update all the comments to instead s
juncai
2016/06/22 22:41:20
Done.
| |
38 // This field only temporarily owns the ChooserController. It is moved | |
39 // into the ChooserContentView/ChooserContentViewCocoa when | |
40 // BuildBubbleUi() is called and the bubble is shown. | |
msw
2016/06/22 18:23:17
aside: Once again, I really wish the bubble manage
juncai
2016/06/22 22:41:20
Acknowledged.
| |
40 std::unique_ptr<ChooserController> chooser_controller_; | 41 std::unique_ptr<ChooserController> chooser_controller_; |
41 | 42 |
42 DISALLOW_COPY_AND_ASSIGN(ChooserBubbleDelegate); | 43 DISALLOW_COPY_AND_ASSIGN(ChooserBubbleDelegate); |
43 }; | 44 }; |
44 | 45 |
45 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_CHOOSER_BUBBLE_DELEGATE_H_ | 46 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_CHOOSER_BUBBLE_DELEGATE_H_ |
OLD | NEW |