Chromium Code Reviews| Index: chrome/browser/automation/automation_provider_observers_chromeos.cc |
| diff --git a/chrome/browser/automation/automation_provider_observers_chromeos.cc b/chrome/browser/automation/automation_provider_observers_chromeos.cc |
| index 940bd5a32281cedef4a8c05a8c8665aa0e9efca8..d89f9204adc5ea229b4bb3d52bba2a5a5b81405e 100644 |
| --- a/chrome/browser/automation/automation_provider_observers_chromeos.cc |
| +++ b/chrome/browser/automation/automation_provider_observers_chromeos.cc |
| @@ -11,6 +11,7 @@ |
| #include "chrome/browser/chromeos/login/enterprise_enrollment_screen_actor.h" |
| #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| #include "chrome/browser/chromeos/login/screen_locker.h" |
| +#include "chrome/browser/chromeos/login/user_manager.h" |
| #include "chrome/browser/chromeos/login/wizard_controller.h" |
| #include "chrome/common/chrome_notification_types.h" |
| #include "content/common/notification_service.h" |
| @@ -352,3 +353,46 @@ const chromeos::WifiNetwork* SSIDConnectObserver::GetWifiNetwork( |
| } |
| return NULL; |
| } |
| + |
| +PhotoCaptureObserver::PhotoCaptureObserver( |
| + AutomationProvider* automation, |
| + IPC::Message* reply_message) |
| + : automation_(automation->AsWeakPtr()), |
| + reply_message_(reply_message) { |
| +} |
| + |
| +PhotoCaptureObserver::~PhotoCaptureObserver() { |
| + //TODO(frankf): Currently, we do not destroy TakePhotoDialog |
|
dennis_jeffrey
2011/07/29 20:10:06
nit: add space after the '//', and add a period at
frankf
2011/07/29 21:50:40
Done.
|
| + // or any of its children |
| +} |
| + |
| +void PhotoCaptureObserver::OnCaptureSuccess( |
| + chromeos::TakePhotoDialog* take_photo_dialog, |
| + chromeos::TakePhotoView* take_photo_view) { |
| + take_photo_view->ButtonPressed(); |
| +} |
| + |
| +void PhotoCaptureObserver::OnCaptureFailure( |
| + chromeos::TakePhotoDialog* take_photo_dialog, |
| + chromeos::TakePhotoView* take_photo_view) { |
| + AutomationJSONReply(automation_, reply_message_.release()).SendError("Capture failure"); |
|
dennis_jeffrey
2011/07/29 20:10:06
line too long; 80 chars max
frankf
2011/07/29 21:50:40
Done.
|
| + delete this; |
| +} |
| + |
| +void PhotoCaptureObserver::OnCapturingStopped( |
| + chromeos::TakePhotoDialog* take_photo_dialog, |
| + chromeos::TakePhotoView* take_photo_view) { |
| + take_photo_dialog->Accept(); |
| + const SkBitmap& photo = take_photo_view->GetImage(); |
| + chromeos::UserManager* user_manager = chromeos::UserManager::Get(); |
| + DCHECK(user_manager); |
|
dennis_jeffrey
2011/07/29 20:10:06
instead of a DCHECK, maybe we could send an inform
frankf
2011/07/29 21:50:40
Done.
|
| + |
| + const chromeos::UserManager::User& user = user_manager->logged_in_user(); |
| + DCHECK(!user.email().empty()); |
| + |
| + user_manager->SetLoggedInUserImage(photo); |
| + user_manager->SaveUserImage(user.email(), photo); |
| + |
| + AutomationJSONReply(automation_, reply_message_.release()).SendSuccess(NULL); |
|
dennis_jeffrey
2011/07/29 20:10:06
Rather than returning success here, shouldn't we w
frankf
2011/07/29 21:50:40
We reach this point only when we execute PhotoCapt
|
| + delete this; |
| +} |