summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/options/take_photo_dialog.h
blob: 9cecd71e7e29f497fce6f64442c3092c51b22d57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_CHROMEOS_OPTIONS_TAKE_PHOTO_DIALOG_H_
#define CHROME_BROWSER_CHROMEOS_OPTIONS_TAKE_PHOTO_DIALOG_H_
#pragma once

#include "base/memory/scoped_ptr.h"
#include "chrome/browser/chromeos/login/camera_controller.h"
#include "chrome/browser/chromeos/login/take_photo_view.h"
#include "content/common/notification_observer.h"
#include "content/common/notification_registrar.h"
#include "views/window/dialog_delegate.h"

namespace views {
class View;
}

namespace chromeos {

// A dialog box for taking new user picture.
class TakePhotoDialog : public views::DialogDelegateView,
                        public TakePhotoView::Delegate,
                        public CameraController::Delegate,
                        public NotificationObserver {
 public:
  TakePhotoDialog();

  // views::DialogDelegate overrides.
  virtual bool IsDialogButtonEnabled(
      MessageBoxFlags::DialogButton button) const;
  virtual bool Cancel();
  virtual bool Accept();

  // views::WindowDelegate overrides.
  virtual bool IsModal() const;
  virtual views::View* GetContentsView();

  // views::View overrides.
  virtual void GetAccessibleState(ui::AccessibleViewState* state);

  // TakePhotoView::Delegate overrides.
  virtual void OnCapturingStarted();
  virtual void OnCapturingStopped();

  // CameraController::Delegate implementation:
  virtual void OnCaptureSuccess();
  virtual void OnCaptureFailure();

  // NotificationObserver implementation:
  virtual void Observe(int type,
                       const NotificationSource& source,
                       const NotificationDetails& details);

 protected:
  // views::View overrides:
  virtual void Layout();
  virtual gfx::Size GetPreferredSize();

 private:
  // Starts initializing the camera and shows the appropriate status on the
  // screen.
  void InitCamera();

  TakePhotoView* take_photo_view_;

  CameraController camera_controller_;

  NotificationRegistrar registrar_;

  DISALLOW_COPY_AND_ASSIGN(TakePhotoDialog);
};

}  // namespace chromeos

#endif  // CHROME_BROWSER_CHROMEOS_OPTIONS_TAKE_PHOTO_DIALOG_H_