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" |
11 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
12 #include "content/public/browser/notification_registrar.h" | 12 #include "content/public/browser/notification_registrar.h" |
13 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
14 #include "ui/gfx/size.h" | 14 #include "ui/gfx/size.h" |
15 #include "ui/web_dialogs/web_dialog_delegate.h" | 15 #include "ui/web_dialogs/web_dialog_delegate.h" |
16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
17 | 17 |
18 class Profile; | 18 namespace content { |
| 19 class BrowserContext; |
| 20 } |
19 | 21 |
20 namespace chromeos { | 22 namespace chromeos { |
21 | 23 |
22 class BubbleFrameView; | 24 class BubbleFrameView; |
23 | 25 |
24 // Launches web dialog during OOBE/Login with specified URL and title. | 26 // Launches web dialog during OOBE/Login with specified URL and title. |
25 class LoginWebDialog : public ui::WebDialogDelegate, | 27 class LoginWebDialog : public ui::WebDialogDelegate, |
26 public content::NotificationObserver { | 28 public content::NotificationObserver { |
27 public: | 29 public: |
28 // Delegate class to get notifications from the dialog. | 30 // Delegate class to get notifications from the dialog. |
29 class Delegate { | 31 class Delegate { |
30 public: | 32 public: |
31 // Called when dialog has been closed. | 33 // Called when dialog has been closed. |
32 virtual void OnDialogClosed(); | 34 virtual void OnDialogClosed(); |
33 | 35 |
34 protected: | 36 protected: |
35 virtual ~Delegate() {} | 37 virtual ~Delegate() {} |
36 }; | 38 }; |
37 | 39 |
38 enum Style { | 40 enum Style { |
39 STYLE_GENERIC, // Use generic CreateChromeWindow as a host. | 41 STYLE_GENERIC, // Use generic CreateChromeWindow as a host. |
40 STYLE_BUBBLE // Use chromeos::BubbleWindow as a host. | 42 STYLE_BUBBLE // Use chromeos::BubbleWindow as a host. |
41 }; | 43 }; |
42 | 44 |
43 LoginWebDialog(Profile* profile, | 45 LoginWebDialog(content::BrowserContext* browser_context, |
44 Delegate* delegate, | 46 Delegate* delegate, |
45 gfx::NativeWindow parent_window, | 47 gfx::NativeWindow parent_window, |
46 const base::string16& title, | 48 const base::string16& title, |
47 const GURL& url, | 49 const GURL& url, |
48 Style style); | 50 Style style); |
49 virtual ~LoginWebDialog(); | 51 virtual ~LoginWebDialog(); |
50 | 52 |
51 void Show(); | 53 void Show(); |
52 | 54 |
53 // Overrides default width/height for dialog. | 55 // Overrides default width/height for dialog. |
(...skipping 28 matching lines...) Expand all Loading... |
82 virtual bool ShouldShowDialogTitle() const OVERRIDE; | 84 virtual bool ShouldShowDialogTitle() const OVERRIDE; |
83 virtual bool HandleContextMenu( | 85 virtual bool HandleContextMenu( |
84 const content::ContextMenuParams& params) OVERRIDE; | 86 const content::ContextMenuParams& params) OVERRIDE; |
85 | 87 |
86 // content::NotificationObserver implementation. | 88 // content::NotificationObserver implementation. |
87 virtual void Observe(int type, | 89 virtual void Observe(int type, |
88 const content::NotificationSource& source, | 90 const content::NotificationSource& source, |
89 const content::NotificationDetails& details) OVERRIDE; | 91 const content::NotificationDetails& details) OVERRIDE; |
90 | 92 |
91 private: | 93 private: |
92 Profile* profile_; | 94 content::BrowserContext* browser_context_; |
93 gfx::NativeWindow parent_window_; | 95 gfx::NativeWindow parent_window_; |
94 // Notifications receiver. | 96 // Notifications receiver. |
95 Delegate* delegate_; | 97 Delegate* delegate_; |
96 | 98 |
97 base::string16 title_; | 99 base::string16 title_; |
98 GURL url_; | 100 GURL url_; |
99 Style style_; | 101 Style style_; |
100 content::NotificationRegistrar notification_registrar_; | 102 content::NotificationRegistrar notification_registrar_; |
101 bool is_open_; | 103 bool is_open_; |
102 | 104 |
103 // Dialog display size. | 105 // Dialog display size. |
104 int width_; | 106 int width_; |
105 int height_; | 107 int height_; |
106 | 108 |
107 DISALLOW_COPY_AND_ASSIGN(LoginWebDialog); | 109 DISALLOW_COPY_AND_ASSIGN(LoginWebDialog); |
108 }; | 110 }; |
109 | 111 |
110 } // namespace chromeos | 112 } // namespace chromeos |
111 | 113 |
112 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOGIN_WEB_DIALOG_H_ | 114 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_UI_LOGIN_WEB_DIALOG_H_ |
OLD | NEW |