OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/api/identity/identity_api.h" | 5 #include "chrome/browser/extensions/api/identity/identity_api.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 void IdentityAPI::Shutdown() { | 723 void IdentityAPI::Shutdown() { |
724 account_tracker_.RemoveObserver(this); | 724 account_tracker_.RemoveObserver(this); |
725 account_tracker_.Shutdown(); | 725 account_tracker_.Shutdown(); |
726 } | 726 } |
727 | 727 |
728 static base::LazyInstance<ProfileKeyedAPIFactory<IdentityAPI> > | 728 static base::LazyInstance<ProfileKeyedAPIFactory<IdentityAPI> > |
729 g_factory = LAZY_INSTANCE_INITIALIZER; | 729 g_factory = LAZY_INSTANCE_INITIALIZER; |
730 | 730 |
731 // static | 731 // static |
732 ProfileKeyedAPIFactory<IdentityAPI>* IdentityAPI::GetFactoryInstance() { | 732 ProfileKeyedAPIFactory<IdentityAPI>* IdentityAPI::GetFactoryInstance() { |
733 return &g_factory.Get(); | 733 return g_factory.Pointer(); |
734 } | 734 } |
735 | 735 |
736 void IdentityAPI::OnAccountAdded(const AccountIds& ids) {} | 736 void IdentityAPI::OnAccountAdded(const AccountIds& ids) {} |
737 | 737 |
738 void IdentityAPI::OnAccountRemoved(const AccountIds& ids) {} | 738 void IdentityAPI::OnAccountRemoved(const AccountIds& ids) {} |
739 | 739 |
740 void IdentityAPI::OnAccountSignInChanged(const AccountIds& ids, | 740 void IdentityAPI::OnAccountSignInChanged(const AccountIds& ids, |
741 bool is_signed_in) { | 741 bool is_signed_in) { |
742 api::identity::AccountInfo account_info; | 742 api::identity::AccountInfo account_info; |
743 account_info.id = ids.gaia; | 743 account_info.id = ids.gaia; |
744 | 744 |
745 scoped_ptr<base::ListValue> args = | 745 scoped_ptr<base::ListValue> args = |
746 api::identity::OnSignInChanged::Create(account_info, is_signed_in); | 746 api::identity::OnSignInChanged::Create(account_info, is_signed_in); |
747 scoped_ptr<Event> event(new Event( | 747 scoped_ptr<Event> event(new Event( |
748 api::identity::OnSignInChanged::kEventName, args.Pass(), profile_)); | 748 api::identity::OnSignInChanged::kEventName, args.Pass(), profile_)); |
749 | 749 |
750 ExtensionSystem::Get(profile_)->event_router()->BroadcastEvent(event.Pass()); | 750 ExtensionSystem::Get(profile_)->event_router()->BroadcastEvent(event.Pass()); |
751 } | 751 } |
752 | 752 |
753 template <> | 753 template <> |
754 void ProfileKeyedAPIFactory<IdentityAPI>::DeclareFactoryDependencies() { | 754 void ProfileKeyedAPIFactory<IdentityAPI>::DeclareFactoryDependencies() { |
755 DependsOn(ExtensionSystemFactory::GetInstance()); | 755 DependsOn(ExtensionSystemFactory::GetInstance()); |
756 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); | 756 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); |
757 } | 757 } |
758 | 758 |
759 } // namespace extensions | 759 } // namespace extensions |
OLD | NEW |