license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame^] | 1 | // Copyright (c) 2006-2008 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. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 4 | |
| 5 | #ifndef CHROME_BROWSER_MODAL_HTML_DIALOG_DELEGATE_H__ |
| 6 | #define CHROME_BROWSER_MODAL_HTML_DIALOG_DELEGATE_H__ |
| 7 | |
| 8 | #include <vector> |
| 9 | |
| 10 | #include "chrome/browser/dom_ui/html_dialog_contents.h" |
| 11 | #include "chrome/common/notification_service.h" |
| 12 | |
| 13 | // This class can only be used on the UI thread. |
| 14 | class ModalHtmlDialogDelegate |
| 15 | : public HtmlDialogContentsDelegate, |
| 16 | public NotificationObserver { |
| 17 | public: |
| 18 | ModalHtmlDialogDelegate(const GURL& url, |
| 19 | int width, int height, |
| 20 | const std::string& json_arguments, |
| 21 | IPC::Message* sync_result, |
| 22 | WebContents* contents); |
| 23 | ~ModalHtmlDialogDelegate(); |
| 24 | |
| 25 | // Notification service callback. |
| 26 | virtual void Observe(NotificationType type, |
| 27 | const NotificationSource& source, |
| 28 | const NotificationDetails& details); |
| 29 | |
| 30 | // ChromeViews::WindowDelegate implementation: |
| 31 | virtual bool IsModal() const; |
| 32 | |
| 33 | // ModalHtmlDialogContents::ModalHTMLDialogContentsDelegate implementation: |
| 34 | virtual GURL GetDialogContentURL() const; |
| 35 | virtual void GetDialogSize(CSize* size) const; |
| 36 | virtual std::string GetDialogArgs() const; |
| 37 | virtual void OnDialogClosed(const std::string& json_retval); |
| 38 | |
| 39 | private: |
| 40 | // The WebContents that opened the dialog. |
| 41 | WebContents* contents_; |
| 42 | |
| 43 | // The parameters needed to display a modal HTML dialog. |
| 44 | HtmlDialogContents::HtmlDialogParams params_; |
| 45 | |
| 46 | // Once we get our reply in OnModalDialogResponse we'll need to respond to the |
| 47 | // plugin using this |sync_result| pointer so we store it between calls. |
| 48 | IPC::Message* sync_response_; |
| 49 | |
| 50 | DISALLOW_EVIL_CONSTRUCTORS(ModalHtmlDialogDelegate); |
| 51 | }; |
| 52 | |
| 53 | #endif // CHROME_BROWSER_MODAL_HTML_DIALOG_DELEGATE_H__ |
license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame^] | 54 | |