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

Unified 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: changed some Cocoa function names to start with lowercase letter 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/website_settings/chooser_bubble_ui_cocoa.h
diff --git a/chrome/browser/ui/cocoa/website_settings/chooser_bubble_ui_cocoa.h b/chrome/browser/ui/cocoa/website_settings/chooser_bubble_ui_cocoa.h
index d5c9093c89369f37ad3d84de0ace426c9dea28c8..11d94637c4574c420441dfab29a74edc551a47d6 100644
--- a/chrome/browser/ui/cocoa/website_settings/chooser_bubble_ui_cocoa.h
+++ b/chrome/browser/ui/cocoa/website_settings/chooser_bubble_ui_cocoa.h
@@ -7,21 +7,23 @@
#import <Cocoa/Cocoa.h>
+#include <memory>
+
#include "base/macros.h"
#include "components/bubble/bubble_ui.h"
-#include "components/chooser_controller/chooser_controller.h"
class Browser;
@class ChooserBubbleUiController;
+class ChooserController;
// ChooserBubbleUiCocoa implements a chooser-based permission model.
// It uses |NSTableView| to show a list of options for user to grant
// permission. It can be used by the WebUSB or WebBluetooth APIs.
// It is owned by the BubbleController, which is owned by the BubbleManager.
-class ChooserBubbleUiCocoa : public BubbleUi,
- public ChooserController::Observer {
+class ChooserBubbleUiCocoa : public BubbleUi {
public:
- ChooserBubbleUiCocoa(Browser* browser, ChooserController* chooser_controller);
+ ChooserBubbleUiCocoa(Browser* browser,
+ std::unique_ptr<ChooserController> chooser_controller);
~ChooserBubbleUiCocoa() override;
// BubbleUi:
@@ -29,17 +31,17 @@ class ChooserBubbleUiCocoa : public BubbleUi,
void Close() override;
void UpdateAnchorPosition() override;
- // ChooserController::Observer:
- void OnOptionsInitialized() override;
- void OnOptionAdded(size_t index) override;
- void OnOptionRemoved(size_t index) override;
-
// Called when |chooser_bubble_ui_controller_| is closing.
void OnBubbleClosing();
private:
- Browser* browser_; // Weak.
- ChooserController* chooser_controller_; // Weak.
+ Browser* browser_; // Weak.
+ // |chooser_controller_| is not owned by this class, it is owned by
Robert Sesek 2016/06/22 21:46:30 This seems significantly more confusing than the c
juncai 2016/06/22 22:41:21 The current ownership model causes many places to
+ // ChooserContentViewCocoa.
+ // This field only temporarily owns the ChooserController. It is moved
+ // into the ChooserContentViewCocoa when BuildBubbleUi() is called and
+ // the bubble is shown.
+ std::unique_ptr<ChooserController> chooser_controller_;
// Cocoa-side chooser bubble UI controller. Weak, as it will close itself.
ChooserBubbleUiController* chooser_bubble_ui_controller_;

Powered by Google App Engine
This is Rietveld 408576698