OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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_WEBUI_SYNC_PROMO_SYNC_PROMO_DIALOG_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_DIALOG_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "chrome/browser/ui/webui/html_dialog_ui.h" |
| 10 |
| 11 class Profile; |
| 12 class Browser; |
| 13 |
| 14 // Shows the sync promo in an HTML dialog. |
| 15 class SyncPromoDialog : public HtmlDialogUIDelegate { |
| 16 public: |
| 17 // |profile| is the profile that should own the HTML dialog. |url| is the |
| 18 // URL to display inside the dialog. |
| 19 SyncPromoDialog(Profile* profile, GURL url); |
| 20 virtual ~SyncPromoDialog(); |
| 21 |
| 22 // Shows the dialog and blocks until the dialog is dismissed. |
| 23 void ShowDialog(); |
| 24 |
| 25 // Returns the browser spawned from the sync promo dialog (if any). |
| 26 Browser* spawned_browser() const { return spawned_browser_; } |
| 27 |
| 28 // Returns true if the sync promo was closed. |
| 29 bool sync_promo_was_closed() const { return sync_promo_was_closed_; } |
| 30 |
| 31 private: |
| 32 // HtmlDialogUIDelegate: |
| 33 virtual ui::ModalType GetDialogModalType() const OVERRIDE; |
| 34 virtual string16 GetDialogTitle() const OVERRIDE; |
| 35 virtual GURL GetDialogContentURL() const OVERRIDE; |
| 36 virtual void GetWebUIMessageHandlers( |
| 37 std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE; |
| 38 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; |
| 39 virtual std::string GetDialogArgs() const OVERRIDE; |
| 40 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; |
| 41 virtual void OnCloseContents(content::WebContents* source, |
| 42 bool* out_close_dialog) OVERRIDE; |
| 43 virtual bool ShouldShowDialogTitle() const OVERRIDE; |
| 44 virtual bool HandleContextMenu(const ContextMenuParams& params) OVERRIDE; |
| 45 virtual bool HandleOpenURLFromTab( |
| 46 content::WebContents* source, |
| 47 const content::OpenURLParams& params, |
| 48 content::WebContents** out_new_contents) OVERRIDE; |
| 49 virtual bool HandleAddNewContents(content::WebContents* source, |
| 50 content::WebContents* new_contents, |
| 51 WindowOpenDisposition disposition, |
| 52 const gfx::Rect& initial_pos, |
| 53 bool user_gesture) OVERRIDE; |
| 54 |
| 55 // The profile that should own the HTML dialog. |
| 56 Profile* profile_; |
| 57 // The browser spawned from the sync promo dialog (if any). |
| 58 Browser* spawned_browser_; |
| 59 // This is set to true if the sync promo was closed. |
| 60 bool sync_promo_was_closed_; |
| 61 // The URL to dispaly in the HTML dialog. |
| 62 GURL url_; |
| 63 // The dialog window. |
| 64 gfx::NativeWindow window_; |
| 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(SyncPromoDialog); |
| 67 }; |
| 68 |
| 69 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_DIALOG_H_ |
OLD | NEW |