Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: chrome/browser/chromeos/login/login_web_dialog.h

Issue 286933002: [cros login] Split login related classes into subfolders. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix includes in new tests Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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_CHROMEOS_LOGIN_LOGIN_WEB_DIALOG_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_WEB_DIALOG_H_
7
8 #include <string>
9
10 #include "base/compiler_specific.h"
11 #include "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_registrar.h"
13 #include "ui/gfx/native_widget_types.h"
14 #include "ui/gfx/size.h"
15 #include "ui/web_dialogs/web_dialog_delegate.h"
16 #include "url/gurl.h"
17
18 class Profile;
19
20 namespace chromeos {
21
22 class BubbleFrameView;
23
24 // Launches web dialog during OOBE/Login with specified URL and title.
25 class LoginWebDialog : public ui::WebDialogDelegate,
26 public content::NotificationObserver {
27 public:
28 // Delegate class to get notifications from the dialog.
29 class Delegate {
30 public:
31 // Called when dialog has been closed.
32 virtual void OnDialogClosed();
33
34 protected:
35 virtual ~Delegate() {}
36 };
37
38 enum Style {
39 STYLE_GENERIC, // Use generic CreateChromeWindow as a host.
40 STYLE_BUBBLE // Use chromeos::BubbleWindow as a host.
41 };
42
43 LoginWebDialog(Profile* profile,
44 Delegate* delegate,
45 gfx::NativeWindow parent_window,
46 const base::string16& title,
47 const GURL& url,
48 Style style);
49 virtual ~LoginWebDialog();
50
51 void Show();
52
53 // Overrides default width/height for dialog.
54 void SetDialogSize(int width, int height);
55
56 // Overrides dialog title.
57 void SetDialogTitle(const base::string16& title);
58
59 void set_url(const GURL& url) { url_ = url; }
60
61 bool is_open() const { return is_open_; }
62
63 static content::WebContents* GetCurrentWebContents();
64
65 protected:
66 // ui::WebDialogDelegate implementation.
67 virtual ui::ModalType GetDialogModalType() const OVERRIDE;
68 virtual base::string16 GetDialogTitle() const OVERRIDE;
69 virtual GURL GetDialogContentURL() const OVERRIDE;
70 virtual void GetWebUIMessageHandlers(
71 std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE;
72 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE;
73 virtual void GetMinimumDialogSize(gfx::Size* size) const OVERRIDE;
74 virtual std::string GetDialogArgs() const OVERRIDE;
75 virtual void OnDialogShown(
76 content::WebUI* webui,
77 content::RenderViewHost* render_view_host) OVERRIDE;
78 // NOTE: This function deletes this object at the end.
79 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE;
80 virtual void OnCloseContents(
81 content::WebContents* source, bool* out_close_dialog) OVERRIDE;
82 virtual bool ShouldShowDialogTitle() const OVERRIDE;
83 virtual bool HandleContextMenu(
84 const content::ContextMenuParams& params) OVERRIDE;
85
86 // content::NotificationObserver implementation.
87 virtual void Observe(int type,
88 const content::NotificationSource& source,
89 const content::NotificationDetails& details) OVERRIDE;
90
91 private:
92 Profile* profile_;
93 gfx::NativeWindow parent_window_;
94 // Notifications receiver.
95 Delegate* delegate_;
96
97 base::string16 title_;
98 GURL url_;
99 Style style_;
100 content::NotificationRegistrar notification_registrar_;
101 bool is_open_;
102
103 // Dialog display size.
104 int width_;
105 int height_;
106
107 DISALLOW_COPY_AND_ASSIGN(LoginWebDialog);
108 };
109
110 } // namespace chromeos
111
112 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_WEB_DIALOG_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/login_utils_browsertest.cc ('k') | chrome/browser/chromeos/login/login_web_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698