OLD | NEW |
1 // Copyright (c) 2011 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_CAPTCHA_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_CAPTCHA_VIEW_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_CAPTCHA_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_CAPTCHA_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
| 11 #include "base/compiler_specific.h" |
11 #include "chrome/browser/image_decoder.h" | 12 #include "chrome/browser/image_decoder.h" |
12 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
13 #include "ui/views/window/dialog_delegate.h" | 14 #include "ui/views/window/dialog_delegate.h" |
14 #include "views/controls/button/button.h" | 15 #include "views/controls/button/button.h" |
15 #include "views/controls/textfield/textfield_controller.h" | 16 #include "views/controls/textfield/textfield_controller.h" |
16 | 17 |
17 namespace views { | 18 namespace views { |
18 class ImageView; | 19 class ImageView; |
19 class TextButton; | 20 class TextButton; |
20 class View; | 21 class View; |
(...skipping 22 matching lines...) Expand all Loading... |
43 virtual ~CaptchaView() {} | 44 virtual ~CaptchaView() {} |
44 | 45 |
45 // views::DialogDelegate: | 46 // views::DialogDelegate: |
46 virtual bool Accept() OVERRIDE; | 47 virtual bool Accept() OVERRIDE; |
47 virtual bool IsModal() const OVERRIDE; | 48 virtual bool IsModal() const OVERRIDE; |
48 virtual views::View* GetContentsView() OVERRIDE; | 49 virtual views::View* GetContentsView() OVERRIDE; |
49 virtual string16 GetWindowTitle() const OVERRIDE; | 50 virtual string16 GetWindowTitle() const OVERRIDE; |
50 | 51 |
51 // views::TextfieldController: | 52 // views::TextfieldController: |
52 virtual void ContentsChanged(views::Textfield* sender, | 53 virtual void ContentsChanged(views::Textfield* sender, |
53 const string16& new_contents) {} | 54 const string16& new_contents) OVERRIDE {} |
54 virtual bool HandleKeyEvent(views::Textfield* sender, | 55 virtual bool HandleKeyEvent(views::Textfield* sender, |
55 const views::KeyEvent& key_event); | 56 const views::KeyEvent& key_event) OVERRIDE; |
56 | 57 |
57 // ImageDownloader::Delegate: | 58 // ImageDownloader::Delegate: |
58 virtual void OnImageDecoded(const ImageDecoder* decoder, | 59 virtual void OnImageDecoded(const ImageDecoder* decoder, |
59 const SkBitmap& decoded_image); | 60 const SkBitmap& decoded_image) OVERRIDE; |
60 | 61 |
61 // views::ButtonListener: | 62 // views::ButtonListener: |
62 virtual void ButtonPressed(views::Button* sender, const views::Event& event); | 63 virtual void ButtonPressed(views::Button* sender, |
| 64 const views::Event& event) OVERRIDE; |
63 | 65 |
64 // Initializes UI. | 66 // Initializes UI. |
65 void Init(); | 67 void Init(); |
66 | 68 |
67 void set_delegate(Delegate* delegate) { | 69 void set_delegate(Delegate* delegate) { |
68 delegate_ = delegate; | 70 delegate_ = delegate; |
69 } | 71 } |
70 | 72 |
71 // Instructs to download and display another captcha image. | 73 // Instructs to download and display another captcha image. |
72 // Is used when same CaptchaView is reused. | 74 // Is used when same CaptchaView is reused. |
73 void SetCaptchaURL(const GURL& captcha_url); | 75 void SetCaptchaURL(const GURL& captcha_url); |
74 | 76 |
75 protected: | 77 protected: |
76 // views::View: | 78 // views::View: |
77 virtual gfx::Size GetPreferredSize(); | 79 virtual gfx::Size GetPreferredSize() OVERRIDE; |
78 virtual void ViewHierarchyChanged(bool is_add, | 80 virtual void ViewHierarchyChanged(bool is_add, |
79 views::View* parent, | 81 views::View* parent, |
80 views::View* child); | 82 views::View* child) OVERRIDE; |
81 | 83 |
82 private: | 84 private: |
83 Delegate* delegate_; | 85 Delegate* delegate_; |
84 GURL captcha_url_; | 86 GURL captcha_url_; |
85 views::ImageView* captcha_image_; | 87 views::ImageView* captcha_image_; |
86 views::Textfield* captcha_textfield_; | 88 views::Textfield* captcha_textfield_; |
87 | 89 |
88 // True when view is not hosted inside dialog, | 90 // True when view is not hosted inside dialog, |
89 // thus should draw OK button/background. | 91 // thus should draw OK button/background. |
90 bool is_standalone_; | 92 bool is_standalone_; |
91 | 93 |
92 // Used in standalone mode. | 94 // Used in standalone mode. |
93 views::TextButton* ok_button_; | 95 views::TextButton* ok_button_; |
94 | 96 |
95 DISALLOW_COPY_AND_ASSIGN(CaptchaView); | 97 DISALLOW_COPY_AND_ASSIGN(CaptchaView); |
96 }; | 98 }; |
97 | 99 |
98 } // namespace chromeos | 100 } // namespace chromeos |
99 | 101 |
100 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_CAPTCHA_VIEW_H_ | 102 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_CAPTCHA_VIEW_H_ |
OLD | NEW |