diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-19 20:46:15 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-19 20:46:15 +0000 |
commit | 2775cce1a62be565e13d85b49d5fa110c02f0e78 (patch) | |
tree | b8e262b1c511ec858dd328c599472d89fba2b6df /chrome | |
parent | 71bb33c3c9d8846f228ec840aecd4d32a2ecaba3 (diff) | |
download | chromium_src-2775cce1a62be565e13d85b49d5fa110c02f0e78.zip chromium_src-2775cce1a62be565e13d85b49d5fa110c02f0e78.tar.gz chromium_src-2775cce1a62be565e13d85b49d5fa110c02f0e78.tar.bz2 |
Moved HtmlDialogWindowDelegateBridge into html_dialog_window_controller.mm.
BUG=
TEST=trybots,manually compiled
Review URL: http://codereview.chromium.org/402075
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32537 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/cocoa/html_dialog_window_controller.h | 69 | ||||
-rw-r--r-- | chrome/browser/cocoa/html_dialog_window_controller.mm | 62 |
2 files changed, 65 insertions, 66 deletions
diff --git a/chrome/browser/cocoa/html_dialog_window_controller.h b/chrome/browser/cocoa/html_dialog_window_controller.h index 194eb12..f18b3f8 100644 --- a/chrome/browser/cocoa/html_dialog_window_controller.h +++ b/chrome/browser/cocoa/html_dialog_window_controller.h @@ -14,74 +14,11 @@ #include "base/basictypes.h" #include "base/scoped_ptr.h" #include "chrome/browser/dom_ui/html_dialog_ui.h" -#include "chrome/browser/tab_contents/tab_contents_delegate.h" -#include "googleurl/src/gurl.h" class Browser; - -// Thin bridge that routes notifications to -// HtmlDialogWindowController's member variables. -// -// TODO(akalin): This doesn't need to be in the .h file; move it to the -// .mm file. -class HtmlDialogWindowDelegateBridge : public HtmlDialogUIDelegate, - public TabContentsDelegate { - public: - // All parameters must be non-NULL/non-nil. - HtmlDialogWindowDelegateBridge(NSWindowController* controller, - HtmlDialogUIDelegate* delegate, - Browser* browser); - - virtual ~HtmlDialogWindowDelegateBridge(); - - // Called when the window is directly closed, e.g. from the close - // button or from an accelerator. - void WindowControllerClosed(); - - // HtmlDialogUIDelegate declarations. - virtual bool IsDialogModal() const; - virtual std::wstring GetDialogTitle() const; - virtual GURL GetDialogContentURL() const; - virtual void GetDOMMessageHandlers( - std::vector<DOMMessageHandler*>* handlers) const; - virtual void GetDialogSize(gfx::Size* size) const; - virtual std::string GetDialogArgs() const; - virtual void OnDialogClosed(const std::string& json_retval); - - // TabContentsDelegate declarations. - virtual void OpenURLFromTab(TabContents* source, - const GURL& url, const GURL& referrer, - WindowOpenDisposition disposition, - PageTransition::Type transition); - virtual void NavigationStateChanged(const TabContents* source, - unsigned changed_flags); - virtual void AddNewContents(TabContents* source, - TabContents* new_contents, - WindowOpenDisposition disposition, - const gfx::Rect& initial_pos, - bool user_gesture); - virtual void ActivateContents(TabContents* contents); - virtual void LoadingStateChanged(TabContents* source); - virtual void CloseContents(TabContents* source); - virtual void MoveContents(TabContents* source, const gfx::Rect& pos); - virtual bool IsPopup(TabContents* source); - virtual void ToolbarSizeChanged(TabContents* source, bool is_animating); - virtual void URLStarredChanged(TabContents* source, bool starred); - virtual void UpdateTargetURL(TabContents* source, const GURL& url); - - private: - NSWindowController* controller_; // weak - HtmlDialogUIDelegate* delegate_; // weak, owned by controller_ - Browser* browser_; // weak, owned by controller_ - - // Calls delegate_'s OnDialogClosed() exactly once, nulling it out - // afterwards so that no other HtmlDialogUIDelegate calls are sent - // to it. Returns whether or not the OnDialogClosed() was actually - // called on the delegate. - bool DelegateOnDialogClosed(const std::string& json_retval); - - DISALLOW_COPY_AND_ASSIGN(HtmlDialogWindowDelegateBridge); -}; +class HtmlDialogWindowDelegateBridge; +class Profile; +class TabContents; // This controller manages a dialog box with properties and HTML content taken // from a HTMLDialogUIDelegate object. diff --git a/chrome/browser/cocoa/html_dialog_window_controller.mm b/chrome/browser/cocoa/html_dialog_window_controller.mm index acfe19f..15ad812 100644 --- a/chrome/browser/cocoa/html_dialog_window_controller.mm +++ b/chrome/browser/cocoa/html_dialog_window_controller.mm @@ -13,8 +13,70 @@ #import "chrome/browser/cocoa/chrome_event_processing_window.h" #include "chrome/browser/dom_ui/html_dialog_ui.h" #include "chrome/browser/tab_contents/tab_contents.h" +#include "chrome/browser/tab_contents/tab_contents_delegate.h" #include "googleurl/src/gurl.h" +// Thin bridge that routes notifications to +// HtmlDialogWindowController's member variables. +class HtmlDialogWindowDelegateBridge : public HtmlDialogUIDelegate, + public TabContentsDelegate { +public: + // All parameters must be non-NULL/non-nil. + HtmlDialogWindowDelegateBridge(NSWindowController* controller, + HtmlDialogUIDelegate* delegate, + Browser* browser); + + virtual ~HtmlDialogWindowDelegateBridge(); + + // Called when the window is directly closed, e.g. from the close + // button or from an accelerator. + void WindowControllerClosed(); + + // HtmlDialogUIDelegate declarations. + virtual bool IsDialogModal() const; + virtual std::wstring GetDialogTitle() const; + virtual GURL GetDialogContentURL() const; + virtual void GetDOMMessageHandlers( + std::vector<DOMMessageHandler*>* handlers) const; + virtual void GetDialogSize(gfx::Size* size) const; + virtual std::string GetDialogArgs() const; + virtual void OnDialogClosed(const std::string& json_retval); + + // TabContentsDelegate declarations. + virtual void OpenURLFromTab(TabContents* source, + const GURL& url, const GURL& referrer, + WindowOpenDisposition disposition, + PageTransition::Type transition); + virtual void NavigationStateChanged(const TabContents* source, + unsigned changed_flags); + virtual void AddNewContents(TabContents* source, + TabContents* new_contents, + WindowOpenDisposition disposition, + const gfx::Rect& initial_pos, + bool user_gesture); + virtual void ActivateContents(TabContents* contents); + virtual void LoadingStateChanged(TabContents* source); + virtual void CloseContents(TabContents* source); + virtual void MoveContents(TabContents* source, const gfx::Rect& pos); + virtual bool IsPopup(TabContents* source); + virtual void ToolbarSizeChanged(TabContents* source, bool is_animating); + virtual void URLStarredChanged(TabContents* source, bool starred); + virtual void UpdateTargetURL(TabContents* source, const GURL& url); + +private: + NSWindowController* controller_; // weak + HtmlDialogUIDelegate* delegate_; // weak, owned by controller_ + Browser* browser_; // weak, owned by controller_ + + // Calls delegate_'s OnDialogClosed() exactly once, nulling it out + // afterwards so that no other HtmlDialogUIDelegate calls are sent + // to it. Returns whether or not the OnDialogClosed() was actually + // called on the delegate. + bool DelegateOnDialogClosed(const std::string& json_retval); + + DISALLOW_COPY_AND_ASSIGN(HtmlDialogWindowDelegateBridge); +}; + // ChromeEventProcessingWindow expects its controller to implement the // BrowserCommandExecutor protocol. @interface HtmlDialogWindowController (InternalAPI) <BrowserCommandExecutor> |