OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_CHOOSER_DIALOG_COCOA_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_CHOOSER_DIALOG_COCOA_H_ |
| 7 |
| 8 #import <Cocoa/Cocoa.h> |
| 9 |
| 10 #include "base/mac/scoped_nsobject.h" |
| 11 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" |
| 12 #include "components/chooser_controller/chooser_controller.h" |
| 13 |
| 14 namespace content { |
| 15 class WebContents; |
| 16 } |
| 17 |
| 18 @class ChooserDialogCocoaController; |
| 19 |
| 20 // Displays a chooser dialog as a modal sheet constrained |
| 21 // to the window/tab displaying the given web contents. |
| 22 class ChooserDialogCocoa : public ConstrainedWindowMacDelegate, |
| 23 public ChooserController::Observer { |
| 24 public: |
| 25 ChooserDialogCocoa(content::WebContents* web_contents, |
| 26 ChooserController* chooser_controller); |
| 27 ~ChooserDialogCocoa() override; |
| 28 |
| 29 // ConstrainedWindowMacDelegate: |
| 30 void OnConstrainedWindowClosed(ConstrainedWindowMac* window) override; |
| 31 |
| 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. |
| 38 void ShowDialog(); |
| 39 |
| 40 // Call this to close the chooser dialog. |
| 41 void Dismissed(); |
| 42 |
| 43 content::WebContents* web_contents() const { return web_contents_; } |
| 44 |
| 45 private: |
| 46 friend class ChooserDialogCocoaControllerTest; |
| 47 base::scoped_nsobject<ChooserDialogCocoaController> |
| 48 chooser_dialog_cocoa_controller_ = nullptr; |
| 49 std::unique_ptr<ConstrainedWindowMac> constrained_window_ = nullptr; |
| 50 content::WebContents* web_contents_; // Weak. |
| 51 ChooserController* chooser_controller_; // Weak. |
| 52 }; |
| 53 |
| 54 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_CHOOSER_DIALOG_COCOA_H_ |
OLD | NEW |