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

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

Issue 6628037: views: Moves TextfieldController/TextRange into their own headers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 9 years, 9 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
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_NEW_USER_VIEW_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_NEW_USER_VIEW_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_NEW_USER_VIEW_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_NEW_USER_VIEW_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/task.h" 11 #include "base/task.h"
12 #include "chrome/browser/chromeos/login/helper.h" 12 #include "chrome/browser/chromeos/login/helper.h"
13 #include "chrome/browser/chromeos/login/language_switch_menu.h" 13 #include "chrome/browser/chromeos/login/language_switch_menu.h"
14 #include "chrome/browser/chromeos/login/user_input.h" 14 #include "chrome/browser/chromeos/login/user_input.h"
15 #include "views/accelerator.h" 15 #include "views/accelerator.h"
16 #include "views/controls/button/button.h" 16 #include "views/controls/button/button.h"
17 #include "views/controls/link.h" 17 #include "views/controls/link.h"
18 #include "views/controls/textfield/textfield.h" 18 #include "views/controls/textfield/textfield_controller.h"
19 #include "views/view.h" 19 #include "views/view.h"
20 20
21 namespace views { 21 namespace views {
22 class Label; 22 class Label;
23 class MenuButton; 23 class MenuButton;
24 class NativeButton; 24 class NativeButton;
25 } // namespace views 25 } // namespace views
26 26
27 namespace chromeos { 27 namespace chromeos {
28 28
29 // View that is used for new user login. It asks for username and password, 29 // View that is used for new user login. It asks for username and password,
30 // allows to specify language preferences or initiate new account creation. 30 // allows to specify language preferences or initiate new account creation.
31 class NewUserView : public ThrobberHostView, 31 class NewUserView : public ThrobberHostView,
32 public UserInput, 32 public UserInput,
33 public views::Textfield::Controller, 33 public views::TextfieldController,
34 public views::LinkController, 34 public views::LinkController,
35 public views::ButtonListener { 35 public views::ButtonListener {
36 public: 36 public:
37 // Delegate class to get notifications from the view. 37 // Delegate class to get notifications from the view.
38 class Delegate { 38 class Delegate {
39 public: 39 public:
40 virtual ~Delegate() {} 40 virtual ~Delegate() {}
41 41
42 // User provided |username|, |password| and initiated login. 42 // User provided |username|, |password| and initiated login.
43 virtual void OnLogin(const std::string& username, 43 virtual void OnLogin(const std::string& username,
(...skipping 24 matching lines...) Expand all
68 68
69 // Update strings from the resources. Executed on language change. 69 // Update strings from the resources. Executed on language change.
70 void UpdateLocalizedStrings(); 70 void UpdateLocalizedStrings();
71 71
72 // Returns bounds of password field in screen coordinates. 72 // Returns bounds of password field in screen coordinates.
73 gfx::Rect GetPasswordBounds() const; 73 gfx::Rect GetPasswordBounds() const;
74 74
75 // Returns bounds of username field in screen coordinates. 75 // Returns bounds of username field in screen coordinates.
76 gfx::Rect GetUsernameBounds() const; 76 gfx::Rect GetUsernameBounds() const;
77 77
78 // Overridden from views::View: 78 // views::View:
79 virtual gfx::Size GetPreferredSize(); 79 virtual gfx::Size GetPreferredSize();
80 virtual void Layout(); 80 virtual void Layout();
81 virtual void RequestFocus(); 81 virtual void RequestFocus();
82 82
83 // Setters for textfields. 83 // Setters for textfields.
84 void SetUsername(const std::string& username); 84 void SetUsername(const std::string& username);
85 void SetPassword(const std::string& password); 85 void SetPassword(const std::string& password);
86 86
87 // Attempt to login with the current field values. 87 // Attempt to login with the current field values.
88 void Login(); 88 void Login();
89 89
90 // Overridden from views::Textfield::Controller 90 // views::TextfieldController:
91 // Not thread-safe, by virtue of using SetupSession(). 91 // Not thread-safe, by virtue of using SetupSession().
92 virtual bool HandleKeyEvent(views::Textfield* sender, 92 virtual bool HandleKeyEvent(views::Textfield* sender,
93 const views::KeyEvent& keystroke); 93 const views::KeyEvent& keystroke);
94 virtual void ContentsChanged(views::Textfield* sender, 94 virtual void ContentsChanged(views::Textfield* sender,
95 const string16& new_contents); 95 const string16& new_contents);
96 96
97 // Overridden from views::ButtonListener. 97 // views::ButtonListener:
98 virtual void ButtonPressed(views::Button* sender, const views::Event& event); 98 virtual void ButtonPressed(views::Button* sender, const views::Event& event);
99 99
100 // Overridden from views::LinkController. 100 // views::LinkController:
101 virtual void LinkActivated(views::Link* source, int event_flags); 101 virtual void LinkActivated(views::Link* source, int event_flags);
102 virtual bool AcceleratorPressed(const views::Accelerator& accelerator); 102 virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
103 103
104 // Overridden from ThrobberHostView: 104 // ThrobberHostView:
105 virtual gfx::Rect CalculateThrobberBounds(views::Throbber* throbber); 105 virtual gfx::Rect CalculateThrobberBounds(views::Throbber* throbber);
106 106
107 // Overridden from UserInput: 107 // UserInput:
108 virtual void EnableInputControls(bool enabled); 108 virtual void EnableInputControls(bool enabled);
109 virtual void ClearAndFocusControls(); 109 virtual void ClearAndFocusControls();
110 virtual void ClearAndFocusPassword(); 110 virtual void ClearAndFocusPassword();
111 virtual gfx::Rect GetMainInputScreenBounds() const; 111 virtual gfx::Rect GetMainInputScreenBounds() const;
112 112
113 // Navigates "away" to other user pods if allowed. 113 // Navigates "away" to other user pods if allowed.
114 // Returns true if event has been processed. 114 // Returns true if event has been processed.
115 bool NavigateAway(); 115 bool NavigateAway();
116 116
117 protected: 117 protected:
118 // views::View overrides: 118 // views::View:
119 virtual void ViewHierarchyChanged(bool is_add, 119 virtual void ViewHierarchyChanged(bool is_add,
120 views::View *parent, 120 views::View *parent,
121 views::View *child); 121 views::View *child);
122 virtual void OnLocaleChanged(); 122 virtual void OnLocaleChanged();
123 void AddChildView(View* view); 123 void AddChildView(View* view);
124 124
125 private: 125 private:
126 // Creates Link control and adds it as a child. 126 // Creates Link control and adds it as a child.
127 void InitLink(views::Link** link); 127 void InitLink(views::Link** link);
128 128
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // Ordinal position of controls inside view layout. 183 // Ordinal position of controls inside view layout.
184 int languages_menubutton_order_; 184 int languages_menubutton_order_;
185 int sign_in_button_order_; 185 int sign_in_button_order_;
186 186
187 DISALLOW_COPY_AND_ASSIGN(NewUserView); 187 DISALLOW_COPY_AND_ASSIGN(NewUserView);
188 }; 188 };
189 189
190 } // namespace chromeos 190 } // namespace chromeos
191 191
192 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_NEW_USER_VIEW_H_ 192 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_NEW_USER_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/existing_user_view.cc ('k') | chrome/browser/chromeos/login/new_user_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698