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

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

Issue 2729020: Show Captcha dialog. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: remove debug line Created 10 years, 6 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_CAPTCHA_VIEW_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_CAPTCHA_VIEW_H_
7
8 #include <string>
9
10 #include "chrome/browser/chromeos/login/image_decoder.h"
11 #include "googleurl/src/gurl.h"
12 #include "views/controls/textfield/textfield.h"
13 #include "views/window/dialog_delegate.h"
14
15 namespace views {
16 class ImageView;
17 class View;
18 class Window;
19 } // namespace views
20
21 namespace chromeos {
22
23 // A dialog box that shows a CAPTCHA image and allows user to input response.
24 class CaptchaView : public views::View,
25 public views::DialogDelegate,
26 public views::Textfield::Controller,
27 public ImageDecoder::Delegate {
28 public:
29 class Delegate {
30 public:
31 // Called when CAPTCHA answer has been entered.
32 virtual void OnCaptchaEntered(const std::string& captcha) = 0;
33
34 protected:
35 virtual ~Delegate() {}
36 };
37
38 // |captcha_url| represents CAPTCHA image URL.
39 explicit CaptchaView(const GURL& captcha_url);
40 virtual ~CaptchaView() {}
41
42 // views::DialogDelegate overrides:
43 virtual bool Accept();
44
45 // views::WindowDelegate overrides:
46 virtual bool IsModal() const { return true; }
47 virtual views::View* GetContentsView() { return this; }
48
49 // views::View overrides:
50 virtual std::wstring GetWindowTitle() const;
51
52 // views::Textfield::Controller implementation:
53 virtual void ContentsChanged(views::Textfield* sender,
54 const string16& new_contents) {}
55 virtual bool HandleKeystroke(views::Textfield* sender,
56 const views::Textfield::Keystroke& keystroke);
57
58 // Overriden from ImageDownloader::Delegate:
59 virtual void OnImageDecoded(const SkBitmap& decoded_image);
60
61 void set_delegate(Delegate* delegate) {
62 delegate_ = delegate;
63 }
64
65 protected:
66 // views::View overrides:
67 virtual gfx::Size GetPreferredSize();
68 virtual void ViewHierarchyChanged(bool is_add,
69 views::View* parent,
70 views::View* child);
71
72 private:
73 // Initializes UI.
74 void Init();
75
76 Delegate* delegate_;
77 GURL captcha_url_;
78 views::ImageView* captcha_image_;
79 views::Textfield* captcha_textfield_;
80
81 DISALLOW_COPY_AND_ASSIGN(CaptchaView);
82 };
83
84 } // namespace chromeos
85
86 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_CAPTCHA_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/authenticator.h ('k') | chrome/browser/chromeos/login/captcha_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698