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 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 void Show(); | 46 void Show(); |
47 | 47 |
48 // Overrides default width/height for dialog. | 48 // Overrides default width/height for dialog. |
49 void SetDialogSize(int width, int height); | 49 void SetDialogSize(int width, int height); |
50 | 50 |
51 // Overrides dialog title. | 51 // Overrides dialog title. |
52 void SetDialogTitle(const base::string16& title); | 52 void SetDialogTitle(const base::string16& title); |
53 | 53 |
54 static content::WebContents* GetCurrentWebContents(); | 54 static content::WebContents* GetCurrentWebContents(); |
55 | 55 |
| 56 // Returns |dialog_window_| instance for test, can be NULL if dialog is not |
| 57 // shown or closed. |
| 58 gfx::NativeWindow get_dialog_window_for_test() const { |
| 59 return dialog_window_; |
| 60 } |
| 61 |
56 protected: | 62 protected: |
57 // ui::WebDialogDelegate implementation. | 63 // ui::WebDialogDelegate implementation. |
58 ui::ModalType GetDialogModalType() const override; | 64 ui::ModalType GetDialogModalType() const override; |
59 base::string16 GetDialogTitle() const override; | 65 base::string16 GetDialogTitle() const override; |
60 GURL GetDialogContentURL() const override; | 66 GURL GetDialogContentURL() const override; |
61 void GetWebUIMessageHandlers( | 67 void GetWebUIMessageHandlers( |
62 std::vector<content::WebUIMessageHandler*>* handlers) const override; | 68 std::vector<content::WebUIMessageHandler*>* handlers) const override; |
63 void GetDialogSize(gfx::Size* size) const override; | 69 void GetDialogSize(gfx::Size* size) const override; |
64 void GetMinimumDialogSize(gfx::Size* size) const override; | 70 void GetMinimumDialogSize(gfx::Size* size) const override; |
65 std::string GetDialogArgs() const override; | 71 std::string GetDialogArgs() const override; |
66 void OnDialogShown(content::WebUI* webui, | 72 void OnDialogShown(content::WebUI* webui, |
67 content::RenderViewHost* render_view_host) override; | 73 content::RenderViewHost* render_view_host) override; |
68 // NOTE: This function deletes this object at the end. | 74 // NOTE: This function deletes this object at the end. |
69 void OnDialogClosed(const std::string& json_retval) override; | 75 void OnDialogClosed(const std::string& json_retval) override; |
70 void OnCloseContents(content::WebContents* source, | 76 void OnCloseContents(content::WebContents* source, |
71 bool* out_close_dialog) override; | 77 bool* out_close_dialog) override; |
72 bool ShouldShowDialogTitle() const override; | 78 bool ShouldShowDialogTitle() const override; |
73 bool HandleContextMenu(const content::ContextMenuParams& params) override; | 79 bool HandleContextMenu(const content::ContextMenuParams& params) override; |
74 bool HandleOpenURLFromTab(content::WebContents* source, | 80 bool HandleOpenURLFromTab(content::WebContents* source, |
75 const content::OpenURLParams& params, | 81 const content::OpenURLParams& params, |
76 content::WebContents** out_new_contents) override; | 82 content::WebContents** out_new_contents) override; |
77 bool HandleShouldCreateWebContents() override; | 83 bool HandleShouldCreateWebContents() override; |
| 84 std::vector<ui::Accelerator> GetAccelerators() override; |
| 85 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; |
78 | 86 |
79 private: | 87 private: |
80 content::BrowserContext* const browser_context_; | 88 content::BrowserContext* const browser_context_; |
81 gfx::NativeWindow parent_window_; | 89 gfx::NativeWindow parent_window_; |
| 90 gfx::NativeWindow dialog_window_; |
82 // Notifications receiver. | 91 // Notifications receiver. |
83 Delegate* const delegate_; | 92 Delegate* const delegate_; |
84 | 93 |
85 base::string16 title_; | 94 base::string16 title_; |
86 const GURL url_; | 95 const GURL url_; |
87 bool is_open_; | |
88 | 96 |
89 // Dialog display size. | 97 // Dialog display size. |
90 int width_; | 98 int width_; |
91 int height_; | 99 int height_; |
92 | 100 |
93 DISALLOW_COPY_AND_ASSIGN(LoginWebDialog); | 101 DISALLOW_COPY_AND_ASSIGN(LoginWebDialog); |
94 }; | 102 }; |
95 | 103 |
96 } // namespace chromeos | 104 } // namespace chromeos |
97 | 105 |
98 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOGIN_WEB_DIALOG_H_ | 106 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOGIN_WEB_DIALOG_H_ |
OLD | NEW |