• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_OPTIONS_TAKE_PHOTO_DIALOG_H_
6 #define CHROME_BROWSER_CHROMEOS_OPTIONS_TAKE_PHOTO_DIALOG_H_
7 #pragma once
8 
9 #include "base/scoped_ptr.h"
10 #include "chrome/browser/chromeos/login/camera_controller.h"
11 #include "chrome/browser/chromeos/login/take_photo_view.h"
12 #include "content/common/notification_observer.h"
13 #include "content/common/notification_registrar.h"
14 #include "views/window/dialog_delegate.h"
15 
16 namespace views {
17 class View;
18 class Window;
19 }
20 
21 namespace chromeos {
22 
23 // A dialog box for taking new user picture.
24 class TakePhotoDialog : public views::View,
25                         public views::DialogDelegate,
26                         public TakePhotoView::Delegate,
27                         public CameraController::Delegate,
28                         public NotificationObserver {
29  public:
30   TakePhotoDialog();
31 
32   // views::DialogDelegate overrides.
33   virtual bool IsDialogButtonEnabled(
34       MessageBoxFlags::DialogButton button) const;
35   virtual bool Cancel();
36   virtual bool Accept();
37 
38   // views::WindowDelegate overrides.
IsModal()39   virtual bool IsModal() const { return true; }
40   virtual views::View* GetContentsView();
41 
42   // views::View overrides.
43   virtual void GetAccessibleState(ui::AccessibleViewState* state);
44 
45   // TakePhotoView::Delegate overrides.
46   virtual void OnCapturingStarted();
47   virtual void OnCapturingStopped();
48 
49   // CameraController::Delegate implementation:
50   virtual void OnCaptureSuccess();
51   virtual void OnCaptureFailure();
52 
53   // NotificationObserver implementation:
54   virtual void Observe(NotificationType type,
55                        const NotificationSource& source,
56                        const NotificationDetails& details);
57 
58  protected:
59   // views::View overrides:
60   virtual void Layout();
61   virtual gfx::Size GetPreferredSize();
62 
63  private:
64   // Starts initializing the camera and shows the appropriate status on the
65   // screen.
66   void InitCamera();
67 
68   TakePhotoView* take_photo_view_;
69 
70   CameraController camera_controller_;
71 
72   NotificationRegistrar registrar_;
73 
74   DISALLOW_COPY_AND_ASSIGN(TakePhotoDialog);
75 };
76 
77 }  // namespace chromeos
78 
79 #endif  // CHROME_BROWSER_CHROMEOS_OPTIONS_TAKE_PHOTO_DIALOG_H_
80