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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 BrowserContextKeyedAPIFactory<IdentityAPI>* IdentityAPI::GetFactoryInstance() { | 212 BrowserContextKeyedAPIFactory<IdentityAPI>* IdentityAPI::GetFactoryInstance() { |
213 return g_factory.Pointer(); | 213 return g_factory.Pointer(); |
214 } | 214 } |
215 | 215 |
216 void IdentityAPI::OnAccountAdded(const AccountIds& ids) {} | 216 void IdentityAPI::OnAccountAdded(const AccountIds& ids) {} |
217 | 217 |
218 void IdentityAPI::OnAccountRemoved(const AccountIds& ids) {} | 218 void IdentityAPI::OnAccountRemoved(const AccountIds& ids) {} |
219 | 219 |
220 void IdentityAPI::OnAccountSignInChanged(const AccountIds& ids, | 220 void IdentityAPI::OnAccountSignInChanged(const AccountIds& ids, |
221 bool is_signed_in) { | 221 bool is_signed_in) { |
222 const std::string primary_account_id = GetPrimaryAccountId(browser_context_); | |
223 if (primary_account_id != ids.account_key && | |
224 !switches::IsExtensionsMultiAccount()) { | |
225 return; | |
226 } | |
227 | |
228 api::identity::AccountInfo account_info; | 222 api::identity::AccountInfo account_info; |
229 account_info.id = ids.gaia; | 223 account_info.id = ids.gaia; |
230 | 224 |
231 scoped_ptr<base::ListValue> args = | 225 scoped_ptr<base::ListValue> args = |
232 api::identity::OnSignInChanged::Create(account_info, is_signed_in); | 226 api::identity::OnSignInChanged::Create(account_info, is_signed_in); |
233 scoped_ptr<Event> event(new Event(api::identity::OnSignInChanged::kEventName, | 227 scoped_ptr<Event> event(new Event(api::identity::OnSignInChanged::kEventName, |
234 args.Pass(), | 228 args.Pass(), |
235 browser_context_)); | 229 browser_context_)); |
236 | 230 |
237 EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass()); | 231 EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass()); |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 void IdentityLaunchWebAuthFlowFunction::OnAuthFlowURLChange( | 867 void IdentityLaunchWebAuthFlowFunction::OnAuthFlowURLChange( |
874 const GURL& redirect_url) { | 868 const GURL& redirect_url) { |
875 if (redirect_url.GetWithEmptyPath() == final_url_prefix_) { | 869 if (redirect_url.GetWithEmptyPath() == final_url_prefix_) { |
876 SetResult(new base::StringValue(redirect_url.spec())); | 870 SetResult(new base::StringValue(redirect_url.spec())); |
877 SendResponse(true); | 871 SendResponse(true); |
878 Release(); // Balanced in RunAsync. | 872 Release(); // Balanced in RunAsync. |
879 } | 873 } |
880 } | 874 } |
881 | 875 |
882 } // namespace extensions | 876 } // namespace extensions |
OLD | NEW |