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

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

Issue 238633009: cleanup: Use EventRouter instead of ExtensionSystem::Get->event_router() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile error for chromeos build. Created 6 years, 8 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
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 12 matching lines...) Expand all
23 #include "chrome/browser/signin/signin_global_error.h" 23 #include "chrome/browser/signin/signin_global_error.h"
24 #include "chrome/browser/signin/signin_manager_factory.h" 24 #include "chrome/browser/signin/signin_manager_factory.h"
25 #include "chrome/common/extensions/api/identity.h" 25 #include "chrome/common/extensions/api/identity.h"
26 #include "chrome/common/extensions/api/identity/oauth2_manifest_handler.h" 26 #include "chrome/common/extensions/api/identity/oauth2_manifest_handler.h"
27 #include "chrome/common/pref_names.h" 27 #include "chrome/common/pref_names.h"
28 #include "chrome/common/url_constants.h" 28 #include "chrome/common/url_constants.h"
29 #include "components/signin/core/browser/profile_oauth2_token_service.h" 29 #include "components/signin/core/browser/profile_oauth2_token_service.h"
30 #include "components/signin/core/browser/signin_manager.h" 30 #include "components/signin/core/browser/signin_manager.h"
31 #include "extensions/browser/event_router.h" 31 #include "extensions/browser/event_router.h"
32 #include "extensions/browser/extension_function_dispatcher.h" 32 #include "extensions/browser/extension_function_dispatcher.h"
33 #include "extensions/browser/extension_system.h"
34 #include "extensions/common/extension.h" 33 #include "extensions/common/extension.h"
35 #include "google_apis/gaia/gaia_urls.h" 34 #include "google_apis/gaia/gaia_urls.h"
36 #include "url/gurl.h" 35 #include "url/gurl.h"
37 36
38 #if defined(OS_CHROMEOS) 37 #if defined(OS_CHROMEOS)
39 #include "chrome/browser/chromeos/login/user_manager.h" 38 #include "chrome/browser/chromeos/login/user_manager.h"
40 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 39 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
41 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" 40 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h"
42 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h " 41 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h "
43 #include "google_apis/gaia/gaia_constants.h" 42 #include "google_apis/gaia/gaia_constants.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 bool is_signed_in) { 199 bool is_signed_in) {
201 api::identity::AccountInfo account_info; 200 api::identity::AccountInfo account_info;
202 account_info.id = ids.gaia; 201 account_info.id = ids.gaia;
203 202
204 scoped_ptr<base::ListValue> args = 203 scoped_ptr<base::ListValue> args =
205 api::identity::OnSignInChanged::Create(account_info, is_signed_in); 204 api::identity::OnSignInChanged::Create(account_info, is_signed_in);
206 scoped_ptr<Event> event(new Event(api::identity::OnSignInChanged::kEventName, 205 scoped_ptr<Event> event(new Event(api::identity::OnSignInChanged::kEventName,
207 args.Pass(), 206 args.Pass(),
208 browser_context_)); 207 browser_context_));
209 208
210 ExtensionSystem::Get(browser_context_)->event_router()->BroadcastEvent( 209 EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass());
211 event.Pass());
212 } 210 }
213 211
214 void IdentityAPI::AddShutdownObserver(ShutdownObserver* observer) { 212 void IdentityAPI::AddShutdownObserver(ShutdownObserver* observer) {
215 shutdown_observer_list_.AddObserver(observer); 213 shutdown_observer_list_.AddObserver(observer);
216 } 214 }
217 215
218 void IdentityAPI::RemoveShutdownObserver(ShutdownObserver* observer) { 216 void IdentityAPI::RemoveShutdownObserver(ShutdownObserver* observer) {
219 shutdown_observer_list_.RemoveObserver(observer); 217 shutdown_observer_list_.RemoveObserver(observer);
220 } 218 }
221 219
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 void IdentityLaunchWebAuthFlowFunction::OnAuthFlowURLChange( 773 void IdentityLaunchWebAuthFlowFunction::OnAuthFlowURLChange(
776 const GURL& redirect_url) { 774 const GURL& redirect_url) {
777 if (redirect_url.GetWithEmptyPath() == final_url_prefix_) { 775 if (redirect_url.GetWithEmptyPath() == final_url_prefix_) {
778 SetResult(new base::StringValue(redirect_url.spec())); 776 SetResult(new base::StringValue(redirect_url.spec()));
779 SendResponse(true); 777 SendResponse(true);
780 Release(); // Balanced in RunImpl. 778 Release(); // Balanced in RunImpl.
781 } 779 }
782 } 780 }
783 781
784 } // namespace extensions 782 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698