Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 | |
|
dennis_jeffrey
2011/07/29 20:10:06
nit: add period at end of sentence
frankf
2011/07/29 21:50:40
Done.
| |
| 63 class Observer { | |
| 64 public: | |
| 65 virtual void OnCaptureSuccess( | |
| 66 TakePhotoDialog* dialog, | |
| 67 TakePhotoView* view) = 0; | |
| 68 virtual void OnCaptureFailure( | |
| 69 TakePhotoDialog* dialog, | |
| 70 TakePhotoView* view) = 0; | |
| 71 virtual void OnCapturingStopped( | |
| 72 TakePhotoDialog* dialog, | |
| 73 TakePhotoView* view) = 0; | |
| 74 | |
| 75 protected: | |
| 76 virtual ~Observer() {} | |
| 77 }; | |
| 78 | |
| 79 void AddObserver(Observer* obs); | |
| 80 void RemoveObserver(Observer* obs); | |
| 81 | |
| 82 void NotifyOnCaptureSuccess(); | |
| 83 void NotifyOnCaptureFailure(); | |
| 84 void NotifyOnCapturingStopped(); | |
| 85 | |
| 60 // NotificationObserver implementation: | 86 // NotificationObserver implementation: |
| 61 virtual void Observe(int type, | 87 virtual void Observe(int type, |
| 62 const NotificationSource& source, | 88 const NotificationSource& source, |
| 63 const NotificationDetails& details); | 89 const NotificationDetails& details); |
| 64 | 90 |
| 65 protected: | 91 protected: |
| 66 // views::View overrides: | 92 // views::View overrides: |
| 67 virtual void Layout(); | 93 virtual void Layout(); |
| 68 virtual gfx::Size GetPreferredSize(); | 94 virtual gfx::Size GetPreferredSize(); |
| 69 | 95 |
| 70 private: | 96 private: |
| 71 // Starts initializing the camera and shows the appropriate status on the | 97 // Starts initializing the camera and shows the appropriate status on the |
| 72 // screen. | 98 // screen. |
| 73 void InitCamera(); | 99 void InitCamera(); |
| 74 | 100 |
| 75 TakePhotoView* take_photo_view_; | 101 TakePhotoView* take_photo_view_; |
| 76 | 102 |
| 77 CameraController camera_controller_; | 103 CameraController camera_controller_; |
| 78 | 104 |
| 79 NotificationRegistrar registrar_; | 105 NotificationRegistrar registrar_; |
| 80 | 106 |
| 81 Delegate* delegate_; | 107 Delegate* delegate_; |
| 82 | 108 |
| 109 ObserverList<Observer> observer_list_; | |
| 110 | |
| 83 DISALLOW_COPY_AND_ASSIGN(TakePhotoDialog); | 111 DISALLOW_COPY_AND_ASSIGN(TakePhotoDialog); |
| 84 }; | 112 }; |
| 85 | 113 |
| 86 } // namespace chromeos | 114 } // namespace chromeos |
| 87 | 115 |
| 88 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_TAKE_PHOTO_DIALOG_H_ | 116 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_TAKE_PHOTO_DIALOG_H_ |
| OLD | NEW |