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

Side by Side Diff: chrome/browser/ui/cocoa/extensions/chooser_dialog_cocoa.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_EXTENSIONS_CHOOSER_DIALOG_COCOA_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_CHOOSER_DIALOG_COCOA_H_
6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_CHOOSER_DIALOG_COCOA_H_ 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_CHOOSER_DIALOG_COCOA_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include <memory>
11
10 #include "base/mac/scoped_nsobject.h" 12 #include "base/mac/scoped_nsobject.h"
11 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" 13 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h"
12 #include "components/chooser_controller/chooser_controller.h" 14
15 class ChooserController;
16 @class ChooserDialogCocoaController;
13 17
14 namespace content { 18 namespace content {
15 class WebContents; 19 class WebContents;
16 } 20 }
17 21
18 @class ChooserDialogCocoaController;
19
20 // Displays a chooser dialog as a modal sheet constrained 22 // Displays a chooser dialog as a modal sheet constrained
21 // to the window/tab displaying the given web contents. 23 // to the window/tab displaying the given web contents.
22 class ChooserDialogCocoa : public ConstrainedWindowMacDelegate, 24 class ChooserDialogCocoa : public ConstrainedWindowMacDelegate {
23 public ChooserController::Observer {
24 public: 25 public:
25 ChooserDialogCocoa(content::WebContents* web_contents, 26 ChooserDialogCocoa(content::WebContents* web_contents,
26 ChooserController* chooser_controller); 27 std::unique_ptr<ChooserController> chooser_controller);
27 ~ChooserDialogCocoa() override; 28 virtual ~ChooserDialogCocoa();
28 29
29 // ConstrainedWindowMacDelegate: 30 // ConstrainedWindowMacDelegate:
30 void OnConstrainedWindowClosed(ConstrainedWindowMac* window) override; 31 void OnConstrainedWindowClosed(ConstrainedWindowMac* window) override;
31 32
32 // ChooserController::Observer:
33 void OnOptionsInitialized() override;
34 void OnOptionAdded(size_t index) override;
35 void OnOptionRemoved(size_t index) override;
36
37 // Create and show the modal dialog. 33 // Create and show the modal dialog.
38 void ShowDialog(); 34 void ShowDialog();
39 35
40 // Call this to close the chooser dialog. 36 // Call this to close the chooser dialog.
41 void Dismissed(); 37 void Dismissed();
42 38
43 content::WebContents* web_contents() const { return web_contents_; } 39 content::WebContents* web_contents() const { return web_contents_; }
44 40
45 private: 41 private:
46 friend class ChooserDialogCocoaControllerTest; 42 friend class ChooserDialogCocoaControllerTest;
47 base::scoped_nsobject<ChooserDialogCocoaController> 43 base::scoped_nsobject<ChooserDialogCocoaController>
48 chooser_dialog_cocoa_controller_; 44 chooser_dialog_cocoa_controller_;
49 std::unique_ptr<ConstrainedWindowMac> constrained_window_; 45 std::unique_ptr<ConstrainedWindowMac> constrained_window_;
50 content::WebContents* web_contents_; // Weak. 46 content::WebContents* web_contents_; // Weak.
51 ChooserController* chooser_controller_; // Weak.
52 }; 47 };
53 48
54 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_CHOOSER_DIALOG_COCOA_H_ 49 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_CHOOSER_DIALOG_COCOA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698