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

Side by Side Diff: chrome/browser/chromeos/options/take_photo_dialog.h

Issue 7523063: Add a hook for capturing a user profile photo and saving it to file and local state. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Rebased Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
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_OPTIONS_TAKE_PHOTO_DIALOG_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_OPTIONS_TAKE_PHOTO_DIALOG_H_
6 #define CHROME_BROWSER_CHROMEOS_OPTIONS_TAKE_PHOTO_DIALOG_H_ 6 #define CHROME_BROWSER_CHROMEOS_OPTIONS_TAKE_PHOTO_DIALOG_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/observer_list.h"
10 #include "chrome/browser/chromeos/login/camera_controller.h" 11 #include "chrome/browser/chromeos/login/camera_controller.h"
11 #include "chrome/browser/chromeos/login/take_photo_view.h" 12 #include "chrome/browser/chromeos/login/take_photo_view.h"
12 #include "content/common/notification_observer.h" 13 #include "content/common/notification_observer.h"
13 #include "content/common/notification_registrar.h" 14 #include "content/common/notification_registrar.h"
14 #include "views/window/dialog_delegate.h" 15 #include "views/window/dialog_delegate.h"
15 16
16 namespace views { 17 namespace views {
17 class View; 18 class View;
18 } 19 }
19 20
(...skipping 30 matching lines...) Expand all
50 virtual void GetAccessibleState(ui::AccessibleViewState* state); 51 virtual void GetAccessibleState(ui::AccessibleViewState* state);
51 52
52 // TakePhotoView::Delegate overrides. 53 // TakePhotoView::Delegate overrides.
53 virtual void OnCapturingStarted(); 54 virtual void OnCapturingStarted();
54 virtual void OnCapturingStopped(); 55 virtual void OnCapturingStopped();
55 56
56 // CameraController::Delegate implementation: 57 // CameraController::Delegate implementation:
57 virtual void OnCaptureSuccess(); 58 virtual void OnCaptureSuccess();
58 virtual void OnCaptureFailure(); 59 virtual void OnCaptureFailure();
59 60
61 // Interface that observers of this dialog must implement in order
62 // to receive notification for capture success/failure.
63 class Observer {
64 public:
65 // Called when image is captured and is displayed
66 virtual void OnCaptureSuccess(
67 TakePhotoDialog* dialog,
68 TakePhotoView* view) = 0;
69 // Called when capture fails and error image is displayed
70 virtual void OnCaptureFailure(
71 TakePhotoDialog* dialog,
72 TakePhotoView* view) = 0;
73 // Called when capture is stopped and image is not being updated
74 virtual void OnCapturingStopped(
75 TakePhotoDialog* dialog,
76 TakePhotoView* view) = 0;
77
78 protected:
79 virtual ~Observer() {}
80 };
81
82 void AddObserver(Observer* obs);
83 void RemoveObserver(Observer* obs);
84
85 void NotifyOnCaptureSuccess();
86 void NotifyOnCaptureFailure();
87 void NotifyOnCapturingStopped();
88
60 // NotificationObserver implementation: 89 // NotificationObserver implementation:
61 virtual void Observe(int type, 90 virtual void Observe(int type,
62 const NotificationSource& source, 91 const NotificationSource& source,
63 const NotificationDetails& details); 92 const NotificationDetails& details);
64 93
65 protected: 94 protected:
66 // views::View overrides: 95 // views::View overrides:
67 virtual void Layout(); 96 virtual void Layout();
68 virtual gfx::Size GetPreferredSize(); 97 virtual gfx::Size GetPreferredSize();
69 98
70 private: 99 private:
71 // Starts initializing the camera and shows the appropriate status on the 100 // Starts initializing the camera and shows the appropriate status on the
72 // screen. 101 // screen.
73 void InitCamera(); 102 void InitCamera();
74 103
75 TakePhotoView* take_photo_view_; 104 TakePhotoView* take_photo_view_;
76 105
77 CameraController camera_controller_; 106 CameraController camera_controller_;
78 107
79 NotificationRegistrar registrar_; 108 NotificationRegistrar registrar_;
80 109
81 Delegate* delegate_; 110 Delegate* delegate_;
82 111
112 ObserverList<Observer> observer_list_;
113
83 DISALLOW_COPY_AND_ASSIGN(TakePhotoDialog); 114 DISALLOW_COPY_AND_ASSIGN(TakePhotoDialog);
84 }; 115 };
85 116
86 } // namespace chromeos 117 } // namespace chromeos
87 118
88 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_TAKE_PHOTO_DIALOG_H_ 119 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_TAKE_PHOTO_DIALOG_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_manager.cc ('k') | chrome/browser/chromeos/options/take_photo_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698