| Index: chrome/browser/cocoa/constrained_window_mac.h
|
| diff --git a/chrome/browser/cocoa/constrained_window_mac.h b/chrome/browser/cocoa/constrained_window_mac.h
|
| index 83331c7e4bd8e3c73913ce5b6e2d1164fa2a07e9..dad7a3a36397011e2c9e0f1a75700619d974585f 100644
|
| --- a/chrome/browser/cocoa/constrained_window_mac.h
|
| +++ b/chrome/browser/cocoa/constrained_window_mac.h
|
| @@ -31,10 +31,20 @@ class ConstrainedWindowMacDelegate {
|
| // in this method.
|
| virtual void DeleteDelegate() = 0;
|
|
|
| + // Responds to things done by the parent tab. Called by
|
| + // |ConstrainedWindowMac::ParentWillDo()|. Returns |true| if it did something
|
| + // in response, |false| if it did not and if
|
| + // |ConstrainedWindowMac::ParentWillDo()| should run its default handler. The
|
| + // default implementation just returns |false|.
|
| + virtual bool ParentWillDo(ConstrainedWindow::Event event) { return false; }
|
| +
|
| // Called by the tab controller, you do not need to do anything yourself
|
| // with this method.
|
| virtual void RunSheet(GTMWindowSheetController* sheetController,
|
| - NSView* view) = 0;
|
| + NSView* view,
|
| + SEL frameSelector,
|
| + SEL positionSelector) = 0;
|
| +
|
| protected:
|
| // Returns true if this delegate's sheet is currently showing.
|
| bool is_sheet_open() { return is_sheet_open_; }
|
| @@ -46,23 +56,47 @@ class ConstrainedWindowMacDelegate {
|
| };
|
|
|
| // Subclass this for a dialog delegate that displays a system sheet such as
|
| -// an NSAlert, an open or save file panel, etc.
|
| -class ConstrainedWindowMacDelegateSystemSheet
|
| +// an NSSavePanel, NSOpenPanel, etc. This can handle any system sheet that GTM
|
| +// supports (if in a somewhat ugly way).
|
| +class ConstrainedWindowMacDelegateSystemSheetParams
|
| : public ConstrainedWindowMacDelegate {
|
| public:
|
| - ConstrainedWindowMacDelegateSystemSheet(id delegate, SEL didEndSelector)
|
| + // See third_party/GTM/AppKit/GTMWindowSheetController.h for the format of
|
| + // |params|.
|
| + explicit ConstrainedWindowMacDelegateSystemSheetParams(NSArray* params)
|
| : systemSheet_(nil),
|
| - delegate_([delegate retain]),
|
| - didEndSelector_(didEndSelector) { }
|
| + params_([params retain]) { }
|
|
|
| protected:
|
| void set_sheet(id sheet) { systemSheet_.reset([sheet retain]); }
|
| id sheet() { return systemSheet_; }
|
| + void set_params(NSArray* params) { params_.reset([params retain]); }
|
| + NSArray* params() { return static_cast<NSArray*>(params_); }
|
| + virtual void RunSheet(GTMWindowSheetController* sheetController,
|
| + NSView* view,
|
| + SEL frameSelector,
|
| + SEL positionSelector);
|
|
|
| private:
|
| - virtual void RunSheet(GTMWindowSheetController* sheetController,
|
| - NSView* view);
|
| scoped_nsobject<id> systemSheet_;
|
| + scoped_nsobject<id> params_;
|
| +};
|
| +
|
| +// Subclass this for a dialog delegate that displays a system sheet such as
|
| +// an NSAlert or other simple panel.
|
| +class ConstrainedWindowMacDelegateSystemSheet
|
| + : public ConstrainedWindowMacDelegateSystemSheetParams {
|
| + public:
|
| + ConstrainedWindowMacDelegateSystemSheet(id delegate, SEL didEndSelector)
|
| + : ConstrainedWindowMacDelegateSystemSheetParams(nil),
|
| + delegate_([delegate retain]),
|
| + didEndSelector_(didEndSelector) { }
|
| +
|
| + private:
|
| + virtual void RunSheet(GTMWindowSheetController* sheetController,
|
| + NSView* view,
|
| + SEL frameSelector,
|
| + SEL positionSelector);
|
| scoped_nsobject<id> delegate_;
|
| SEL didEndSelector_;
|
| };
|
| @@ -98,7 +132,9 @@ class ConstrainedWindowMacDelegateCustomSheet
|
|
|
| private:
|
| virtual void RunSheet(GTMWindowSheetController* sheetController,
|
| - NSView* view);
|
| + NSView* view,
|
| + SEL frameSelector,
|
| + SEL positionSelector);
|
| scoped_nsobject<NSWindow> customSheet_;
|
| scoped_nsobject<id> delegate_;
|
| SEL didEndSelector_;
|
| @@ -118,6 +154,7 @@ class ConstrainedWindowMac : public ConstrainedWindow {
|
|
|
| // Overridden from ConstrainedWindow:
|
| virtual void CloseConstrainedWindow();
|
| + virtual bool ParentWillDo(ConstrainedWindow::Event event);
|
|
|
| // Returns the TabContents that constrains this Constrained Window.
|
| TabContents* owner() const { return owner_; }
|
| @@ -150,4 +187,3 @@ class ConstrainedWindowMac : public ConstrainedWindow {
|
| };
|
|
|
| #endif // CHROME_BROWSER_COCOA_CONSTRAINED_WINDOW_MAC_H_
|
| -
|
|
|