OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/browser/chromeos/login/captcha_view.h" | 5 #include "chrome/browser/chromeos/login/captcha_view.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/chromeos/login/helper.h" | 10 #include "chrome/browser/chromeos/login/helper.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 } | 113 } |
114 | 114 |
115 void CaptchaView::ViewHierarchyChanged(bool is_add, | 115 void CaptchaView::ViewHierarchyChanged(bool is_add, |
116 views::View* parent, | 116 views::View* parent, |
117 views::View* child) { | 117 views::View* child) { |
118 // Can't focus before we're inserted into a Container. | 118 // Can't focus before we're inserted into a Container. |
119 if (is_add && child == this) | 119 if (is_add && child == this) |
120 captcha_textfield_->RequestFocus(); | 120 captcha_textfield_->RequestFocus(); |
121 } | 121 } |
122 | 122 |
123 bool CaptchaView::HandleKeystroke(views::Textfield* sender, | 123 bool CaptchaView::HandleKeyEvent(views::Textfield* sender, |
124 const views::Textfield::Keystroke& keystroke) { | 124 const views::KeyEvent& key_event) { |
125 if (sender == captcha_textfield_ && | 125 if (sender == captcha_textfield_ && |
126 keystroke.GetKeyboardCode() == app::VKEY_RETURN) { | 126 key_event.GetKeyCode() == app::VKEY_RETURN) { |
127 if (is_standalone_) { | 127 if (is_standalone_) { |
128 Accept(); | 128 Accept(); |
129 } else { | 129 } else { |
130 GetDialogClientView()->AcceptWindow(); | 130 GetDialogClientView()->AcceptWindow(); |
131 } | 131 } |
132 } | 132 } |
133 return false; | 133 return false; |
134 } | 134 } |
135 | 135 |
136 void CaptchaView::OnImageDecoded(const SkBitmap& decoded_image) { | 136 void CaptchaView::OnImageDecoded(const SkBitmap& decoded_image) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 layout->AddView(ok_button_, 1, 1, | 201 layout->AddView(ok_button_, 1, 1, |
202 views::GridLayout::CENTER, views::GridLayout::CENTER); | 202 views::GridLayout::CENTER, views::GridLayout::CENTER); |
203 } | 203 } |
204 | 204 |
205 // ImageDownloader will delete itself once URL is fetched. | 205 // ImageDownloader will delete itself once URL is fetched. |
206 // TODO(nkostylev): Make sure that it works after view is deleted. | 206 // TODO(nkostylev): Make sure that it works after view is deleted. |
207 new ImageDownloader(this, GURL(captcha_url_), std::string()); | 207 new ImageDownloader(this, GURL(captcha_url_), std::string()); |
208 } | 208 } |
209 | 209 |
210 } // namespace chromeos | 210 } // namespace chromeos |
OLD | NEW |