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 // Returns the dialog window. | |
32 gfx::NativeWindow window() const { return window_; } | |
33 | |
34 private: | |
35 // HtmlDialogUIDelegate: | |
36 virtual ui::ModalType GetDialogModalType() const OVERRIDE; | |
37 virtual string16 GetDialogTitle() const OVERRIDE; | |
38 virtual GURL GetDialogContentURL() const OVERRIDE; | |
39 virtual void GetWebUIMessageHandlers( | |
40 std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE; | |
41 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; | |
42 virtual std::string GetDialogArgs() const OVERRIDE; | |
43 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; | |
44 virtual void OnCloseContents(content::WebContents* source, | |
45 bool* out_close_dialog) OVERRIDE; | |
46 virtual bool ShouldShowDialogTitle() const OVERRIDE; | |
47 virtual bool HandleContextMenu( | |
48 const content::ContextMenuParams& params) OVERRIDE; | |
49 virtual bool HandleOpenURLFromTab( | |
50 content::WebContents* source, | |
51 const content::OpenURLParams& params, | |
52 content::WebContents** out_new_contents) OVERRIDE; | |
53 virtual bool HandleAddNewContents(content::WebContents* source, | |
54 content::WebContents* new_contents, | |
55 WindowOpenDisposition disposition, | |
56 const gfx::Rect& initial_pos, | |
57 bool user_gesture) OVERRIDE; | |
58 | |
59 // Close this dialog. | |
60 void CloseDialog(); | |
61 | |
62 // The profile that should own the HTML dialog. | |
63 Profile* profile_; | |
64 // The browser spawned from the sync promo dialog (if any). | |
65 Browser* spawned_browser_; | |
66 // This is set to true if the sync promo was closed. | |
67 bool sync_promo_was_closed_; | |
68 // The URL to dispaly in the HTML dialog. | |
69 GURL url_; | |
70 // The dialog window. | |
71 gfx::NativeWindow window_; | |
72 | |
73 DISALLOW_COPY_AND_ASSIGN(SyncPromoDialog); | |
74 }; | |
75 | |
76 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_PROMO_SYNC_PROMO_DIALOG_H_ | |
OLD | NEW |