| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOGIN_WEB_DIALOG_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOGIN_WEB_DIALOG_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOGIN_WEB_DIALOG_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOGIN_WEB_DIALOG_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 enum Style { | 40 enum Style { |
| 41 STYLE_GENERIC, // Use generic CreateChromeWindow as a host. | 41 STYLE_GENERIC, // Use generic CreateChromeWindow as a host. |
| 42 STYLE_BUBBLE // Use chromeos::BubbleWindow as a host. | 42 STYLE_BUBBLE // Use chromeos::BubbleWindow as a host. |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 LoginWebDialog(content::BrowserContext* browser_context, | 45 LoginWebDialog(content::BrowserContext* browser_context, |
| 46 Delegate* delegate, | 46 Delegate* delegate, |
| 47 gfx::NativeWindow parent_window, | 47 gfx::NativeWindow parent_window, |
| 48 const base::string16& title, | 48 const base::string16& title, |
| 49 const GURL& url); | 49 const GURL& url); |
| 50 virtual ~LoginWebDialog(); | 50 ~LoginWebDialog() override; |
| 51 | 51 |
| 52 void Show(); | 52 void Show(); |
| 53 | 53 |
| 54 // Overrides default width/height for dialog. | 54 // Overrides default width/height for dialog. |
| 55 void SetDialogSize(int width, int height); | 55 void SetDialogSize(int width, int height); |
| 56 | 56 |
| 57 // Overrides dialog title. | 57 // Overrides dialog title. |
| 58 void SetDialogTitle(const base::string16& title); | 58 void SetDialogTitle(const base::string16& title); |
| 59 | 59 |
| 60 void set_url(const GURL& url) { url_ = url; } | 60 void set_url(const GURL& url) { url_ = url; } |
| 61 | 61 |
| 62 bool is_open() const { return is_open_; } | 62 bool is_open() const { return is_open_; } |
| 63 | 63 |
| 64 static content::WebContents* GetCurrentWebContents(); | 64 static content::WebContents* GetCurrentWebContents(); |
| 65 | 65 |
| 66 protected: | 66 protected: |
| 67 // ui::WebDialogDelegate implementation. | 67 // ui::WebDialogDelegate implementation. |
| 68 virtual ui::ModalType GetDialogModalType() const override; | 68 ui::ModalType GetDialogModalType() const override; |
| 69 virtual base::string16 GetDialogTitle() const override; | 69 base::string16 GetDialogTitle() const override; |
| 70 virtual GURL GetDialogContentURL() const override; | 70 GURL GetDialogContentURL() const override; |
| 71 virtual void GetWebUIMessageHandlers( | 71 void GetWebUIMessageHandlers( |
| 72 std::vector<content::WebUIMessageHandler*>* handlers) const override; | 72 std::vector<content::WebUIMessageHandler*>* handlers) const override; |
| 73 virtual void GetDialogSize(gfx::Size* size) const override; | 73 void GetDialogSize(gfx::Size* size) const override; |
| 74 virtual void GetMinimumDialogSize(gfx::Size* size) const override; | 74 void GetMinimumDialogSize(gfx::Size* size) const override; |
| 75 virtual std::string GetDialogArgs() const override; | 75 std::string GetDialogArgs() const override; |
| 76 virtual void OnDialogShown( | 76 void OnDialogShown(content::WebUI* webui, |
| 77 content::WebUI* webui, | 77 content::RenderViewHost* render_view_host) override; |
| 78 content::RenderViewHost* render_view_host) override; | |
| 79 // NOTE: This function deletes this object at the end. | 78 // NOTE: This function deletes this object at the end. |
| 80 virtual void OnDialogClosed(const std::string& json_retval) override; | 79 void OnDialogClosed(const std::string& json_retval) override; |
| 81 virtual void OnCloseContents( | 80 void OnCloseContents(content::WebContents* source, |
| 82 content::WebContents* source, bool* out_close_dialog) override; | 81 bool* out_close_dialog) override; |
| 83 virtual bool ShouldShowDialogTitle() const override; | 82 bool ShouldShowDialogTitle() const override; |
| 84 virtual bool HandleContextMenu( | 83 bool HandleContextMenu(const content::ContextMenuParams& params) override; |
| 85 const content::ContextMenuParams& params) override; | |
| 86 | 84 |
| 87 // content::NotificationObserver implementation. | 85 // content::NotificationObserver implementation. |
| 88 virtual void Observe(int type, | 86 void Observe(int type, |
| 89 const content::NotificationSource& source, | 87 const content::NotificationSource& source, |
| 90 const content::NotificationDetails& details) override; | 88 const content::NotificationDetails& details) override; |
| 91 | 89 |
| 92 private: | 90 private: |
| 93 content::BrowserContext* browser_context_; | 91 content::BrowserContext* browser_context_; |
| 94 gfx::NativeWindow parent_window_; | 92 gfx::NativeWindow parent_window_; |
| 95 // Notifications receiver. | 93 // Notifications receiver. |
| 96 Delegate* delegate_; | 94 Delegate* delegate_; |
| 97 | 95 |
| 98 base::string16 title_; | 96 base::string16 title_; |
| 99 GURL url_; | 97 GURL url_; |
| 100 content::NotificationRegistrar notification_registrar_; | 98 content::NotificationRegistrar notification_registrar_; |
| 101 bool is_open_; | 99 bool is_open_; |
| 102 | 100 |
| 103 // Dialog display size. | 101 // Dialog display size. |
| 104 int width_; | 102 int width_; |
| 105 int height_; | 103 int height_; |
| 106 | 104 |
| 107 DISALLOW_COPY_AND_ASSIGN(LoginWebDialog); | 105 DISALLOW_COPY_AND_ASSIGN(LoginWebDialog); |
| 108 }; | 106 }; |
| 109 | 107 |
| 110 } // namespace chromeos | 108 } // namespace chromeos |
| 111 | 109 |
| 112 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOGIN_WEB_DIALOG_H_ | 110 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOGIN_WEB_DIALOG_H_ |
| OLD | NEW |