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

Unified Diff: chrome/browser/chromeos/options/take_photo_dialog.cc

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: Addressed all the comments Created 9 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/options/take_photo_dialog.cc
diff --git a/chrome/browser/chromeos/options/take_photo_dialog.cc b/chrome/browser/chromeos/options/take_photo_dialog.cc
index 4c8cd1ac58b0e40657463aea21629fe82744744c..c83327102af9b129efd6efc4a23a4006ed2cfb18 100644
--- a/chrome/browser/chromeos/options/take_photo_dialog.cc
+++ b/chrome/browser/chromeos/options/take_photo_dialog.cc
@@ -92,17 +92,50 @@ void TakePhotoDialog::OnCapturingStarted() {
void TakePhotoDialog::OnCapturingStopped() {
GetDialogClientView()->ok_button()->SetEnabled(true);
GetDialogClientView()->ok_button()->RequestFocus();
+ NotifyOnCapturingStopped();
}
void TakePhotoDialog::OnCaptureSuccess() {
SkBitmap frame;
camera_controller_.GetFrame(&frame);
- if (!frame.isNull())
+ if (!frame.isNull()) {
take_photo_view_->UpdateVideoFrame(frame);
+ NotifyOnCaptureSuccess();
+ }
}
void TakePhotoDialog::OnCaptureFailure() {
take_photo_view_->ShowCameraError();
+ NotifyOnCaptureFailure();
+}
+
+void TakePhotoDialog::AddObserver(Observer* obs) {
+ observer_list_.AddObserver(obs);
+}
+
+void TakePhotoDialog::RemoveObserver(Observer* obs) {
+ observer_list_.RemoveObserver(obs);
+}
+
+void TakePhotoDialog::NotifyOnCaptureSuccess() {
+ FOR_EACH_OBSERVER(
+ Observer,
+ observer_list_,
+ OnCaptureSuccess(this, take_photo_view_));
+}
+
+void TakePhotoDialog::NotifyOnCaptureFailure() {
+ FOR_EACH_OBSERVER(
+ Observer,
+ observer_list_,
+ OnCaptureFailure(this, take_photo_view_));
+}
+
+void TakePhotoDialog::NotifyOnCapturingStopped() {
+ FOR_EACH_OBSERVER(
+ Observer,
+ observer_list_,
+ OnCapturingStopped(this, take_photo_view_));
}
void TakePhotoDialog::Observe(int type,

Powered by Google App Engine
This is Rietveld 408576698