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

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

Issue 8436002: [cros] Remove Views implementation for login/OOBE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 years, 1 month 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_VIEW_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_VIEW_H_
7 #pragma once
8
9 #include "chrome/browser/chromeos/login/default_images_view.h"
10 #include "chrome/browser/chromeos/login/take_photo_view.h"
11 #include "views/controls/button/button.h"
12 #include "views/view.h"
13
14 class SkBitmap;
15
16 namespace views {
17 class Label;
18 class NativeTextButton;
19 } // namespace views
20
21 namespace chromeos {
22
23 // View used for selecting user image on OOBE screen.
24 class UserImageView : public views::View,
25 public views::ButtonListener,
26 public TakePhotoView::Delegate,
27 public DefaultImagesView::Delegate {
28 public:
29 // Delegate class to get notifications from the view.
30 class Delegate {
31 public:
32 virtual ~Delegate() {}
33
34 // Initializes camera if needed and starts capturing.
35 virtual void StartCamera() = 0;
36
37 // Stops capturing from camera.
38 virtual void StopCamera() = 0;
39
40 // Called if user accepts the taken photo. The image is passed as a
41 // parameter.
42 virtual void OnPhotoTaken(const SkBitmap& image) = 0;
43
44 // Called if user accepts the chosen default image. The image index is
45 // passed as a parameter.
46 virtual void OnDefaultImageSelected(int index) = 0;
47 };
48
49 explicit UserImageView(Delegate* delegate);
50 virtual ~UserImageView();
51
52 // Initializes this view, its children and layout.
53 void Init();
54
55 // Updates image from camera.
56 void UpdateVideoFrame(const SkBitmap& frame);
57
58 // If in capturing mode, shows that camera is initializing by running
59 // throbber above the picture. Disables snapshot button until frame is
60 // received.
61 void ShowCameraInitializing();
62
63 // If in capturing mode, shows that camera is broken instead of video
64 // frame and disables snapshot button until new frame is received.
65 void ShowCameraError();
66
67 // Returns true if video capture is the current state of the view.
68 bool IsCapturing() const;
69
70 // Overridden from views::View:
71 virtual gfx::Size GetPreferredSize();
72 virtual bool AcceleratorPressed(const views::Accelerator& accel);
73
74 // Overridden from views::ButtonListener.
75 virtual void ButtonPressed(views::Button* sender, const views::Event& event);
76
77 // Overridden from TakePhotoView::Delegate.
78 virtual void OnCapturingStarted();
79 virtual void OnCapturingStopped();
80
81 // Overridden from DefaultImagesView::Delegate.
82 virtual void OnCaptureButtonClicked();
83 virtual void OnImageSelected(int image_index);
84
85 private:
86 // Initializes layout manager for this view.
87 void InitLayout();
88
89 // Calls the appropriate delegate's method to return the selected image to
90 // it.
91 void NotifyDelegateOfImageSelected();
92
93 views::Label* title_label_;
94 DefaultImagesView* default_images_view_;
95 TakePhotoView* take_photo_view_;
96 views::View* splitter_;
97 views::NativeTextButton* ok_button_;
98
99 views::Accelerator accel_ok_;
100 views::Accelerator accel_up_;
101 views::Accelerator accel_down_;
102 views::Accelerator accel_left_;
103 views::Accelerator accel_right_;
104
105 // Notifications receiver.
106 Delegate* delegate_;
107
108 DISALLOW_COPY_AND_ASSIGN(UserImageView);
109 };
110
111 } // namespace chromeos
112
113 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_controller_unittest.cc ('k') | chrome/browser/chromeos/login/user_image_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698