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

Side by Side Diff: chrome/browser/extensions/api/identity/identity_api.cc

Issue 346913003: Fix chrome.identity.onSignInChanged regression for sign-outs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698