| 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 #include "chrome/browser/automation/automation_provider_observers.h" | 5 #include "chrome/browser/automation/automation_provider_observers.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/browser/automation/automation_provider.h" | 8 #include "chrome/browser/automation/automation_provider.h" |
| 9 #include "chrome/browser/chromeos/cros/cros_library.h" | 9 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 10 #include "chrome/browser/chromeos/login/authentication_notification_details.h" | 10 #include "chrome/browser/chromeos/login/authentication_notification_details.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 NetworkManagerInitObserver::NetworkManagerInitObserver( | 22 NetworkManagerInitObserver::NetworkManagerInitObserver( |
| 23 AutomationProvider* automation) | 23 AutomationProvider* automation) |
| 24 : automation_(automation->AsWeakPtr()) {} | 24 : automation_(automation->AsWeakPtr()) {} |
| 25 | 25 |
| 26 NetworkManagerInitObserver::~NetworkManagerInitObserver() { | 26 NetworkManagerInitObserver::~NetworkManagerInitObserver() { |
| 27 CrosLibrary::Get()->GetNetworkLibrary()->RemoveNetworkManagerObserver(this); | 27 CrosLibrary::Get()->GetNetworkLibrary()->RemoveNetworkManagerObserver(this); |
| 28 } | 28 } |
| 29 | 29 |
| 30 bool NetworkManagerInitObserver::Init() { | 30 bool NetworkManagerInitObserver::Init() { |
| 31 if (!CrosLibrary::Get()->EnsureLoaded()) { | 31 if (!CrosLibrary::Get()->libcros_loaded()) { |
| 32 // If cros library fails to load, don't wait for the network | 32 // If cros library fails to load, don't wait for the network |
| 33 // library to finish initializing, because it'll wait forever. | 33 // library to finish initializing, because it'll wait forever. |
| 34 automation_->OnNetworkLibraryInit(); | 34 automation_->OnNetworkLibraryInit(); |
| 35 return false; | 35 return false; |
| 36 } | 36 } |
| 37 | 37 |
| 38 CrosLibrary::Get()->GetNetworkLibrary()->AddNetworkManagerObserver(this); | 38 CrosLibrary::Get()->GetNetworkLibrary()->AddNetworkManagerObserver(this); |
| 39 return true; | 39 return true; |
| 40 } | 40 } |
| 41 | 41 |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 user_manager->AddObserver(this); | 476 user_manager->AddObserver(this); |
| 477 user_manager->SaveUserImage(user.email(), photo); | 477 user_manager->SaveUserImage(user.email(), photo); |
| 478 } | 478 } |
| 479 | 479 |
| 480 void PhotoCaptureObserver::LocalStateChanged( | 480 void PhotoCaptureObserver::LocalStateChanged( |
| 481 chromeos::UserManager* user_manager) { | 481 chromeos::UserManager* user_manager) { |
| 482 user_manager->RemoveObserver(this); | 482 user_manager->RemoveObserver(this); |
| 483 AutomationJSONReply(automation_, reply_message_.release()).SendSuccess(NULL); | 483 AutomationJSONReply(automation_, reply_message_.release()).SendSuccess(NULL); |
| 484 delete this; | 484 delete this; |
| 485 } | 485 } |
| OLD | NEW |