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

Side by Side Diff: chrome/browser/chromeos/password_dialog_view.cc

Issue 231014: Add wifi menu button in status bar. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2009 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 #include "chrome/browser/chromeos/password_dialog_view.h"
6
7 #include "app/l10n_util.h"
8 #include "grit/chromium_strings.h"
9 #include "grit/generated_resources.h"
10 #include "grit/locale_settings.h"
11 #include "views/controls/textfield/textfield.h"
12 #include "views/window/window.h"
13
14 PasswordDialogView::PasswordDialogView(PasswordDialogDelegate* delegate)
15 : delegate_(delegate),
16 password_textfield_(NULL) {
17 }
18
19 std::wstring PasswordDialogView::GetWindowTitle() const {
20 return l10n_util::GetString(IDS_OPTIONS_SETTINGS_SECTION_TITLE_PASSWORD);
21 }
22
23 bool PasswordDialogView::Cancel() {
24 return delegate_->OnPasswordDialogCancel();
25 }
26
27 bool PasswordDialogView::Accept() {
28 // TODO(chocobo): We should not need to call SyncText ourself here.
29 password_textfield_->SyncText();
30 return delegate_->OnPasswordDialogAccept(password_textfield_->text());
31 }
32
33 static const int kDialogPadding = 7;
34
35 void PasswordDialogView::Layout() {
36 gfx::Size sz = password_textfield_->GetPreferredSize();
37 password_textfield_->SetBounds(kDialogPadding, kDialogPadding,
38 width() - 2*kDialogPadding,
39 sz.height());
40 }
41
42 gfx::Size PasswordDialogView::GetPreferredSize() {
43 // TODO(chocobo): Create our own localized content size once the UI is done.
44 return gfx::Size(views::Window::GetLocalizedContentsSize(
45 IDS_IMPORTLOCK_DIALOG_WIDTH_CHARS,
46 IDS_IMPORTLOCK_DIALOG_HEIGHT_LINES));
47 }
48
49 void PasswordDialogView::ViewHierarchyChanged(bool is_add,
50 views::View* parent,
51 views::View* child) {
52 if (is_add && child == this)
53 Init();
54 }
55
56 void PasswordDialogView::Init() {
57 password_textfield_ = new views::Textfield(views::Textfield::STYLE_PASSWORD);
58 AddChildView(password_textfield_);
59 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/password_dialog_view.h ('k') | chrome/browser/chromeos/settings_contents_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698