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

Side by Side Diff: chrome/browser/extensions/extension_service.cc

Issue 434493002: OAuth2 support for Webstore downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/extension_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <set> 9 #include <set>
10 10
(...skipping 18 matching lines...) Expand all
29 #include "chrome/browser/extensions/extension_sync_service.h" 29 #include "chrome/browser/extensions/extension_sync_service.h"
30 #include "chrome/browser/extensions/extension_util.h" 30 #include "chrome/browser/extensions/extension_util.h"
31 #include "chrome/browser/extensions/external_install_manager.h" 31 #include "chrome/browser/extensions/external_install_manager.h"
32 #include "chrome/browser/extensions/external_provider_impl.h" 32 #include "chrome/browser/extensions/external_provider_impl.h"
33 #include "chrome/browser/extensions/install_verifier.h" 33 #include "chrome/browser/extensions/install_verifier.h"
34 #include "chrome/browser/extensions/installed_loader.h" 34 #include "chrome/browser/extensions/installed_loader.h"
35 #include "chrome/browser/extensions/pending_extension_manager.h" 35 #include "chrome/browser/extensions/pending_extension_manager.h"
36 #include "chrome/browser/extensions/shared_module_service.h" 36 #include "chrome/browser/extensions/shared_module_service.h"
37 #include "chrome/browser/extensions/updater/extension_cache.h" 37 #include "chrome/browser/extensions/updater/extension_cache.h"
38 #include "chrome/browser/profiles/profile.h" 38 #include "chrome/browser/profiles/profile.h"
39 #include "chrome/browser/signin/profile_identity_provider.h"
40 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
41 #include "chrome/browser/signin/signin_manager_factory.h"
39 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" 42 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
40 #include "chrome/browser/ui/webui/favicon_source.h" 43 #include "chrome/browser/ui/webui/favicon_source.h"
41 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" 44 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h"
45 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
42 #include "chrome/browser/ui/webui/theme_source.h" 46 #include "chrome/browser/ui/webui/theme_source.h"
43 #include "chrome/common/chrome_switches.h" 47 #include "chrome/common/chrome_switches.h"
44 #include "chrome/common/crash_keys.h" 48 #include "chrome/common/crash_keys.h"
45 #include "chrome/common/extensions/extension_constants.h" 49 #include "chrome/common/extensions/extension_constants.h"
46 #include "chrome/common/extensions/features/feature_channel.h" 50 #include "chrome/common/extensions/features/feature_channel.h"
47 #include "chrome/common/extensions/manifest_url_handler.h" 51 #include "chrome/common/extensions/manifest_url_handler.h"
48 #include "chrome/common/pref_names.h" 52 #include "chrome/common/pref_names.h"
49 #include "chrome/common/url_constants.h" 53 #include "chrome/common/url_constants.h"
54 #include "components/signin/core/browser/signin_manager.h"
50 #include "components/startup_metric_utils/startup_metric_utils.h" 55 #include "components/startup_metric_utils/startup_metric_utils.h"
51 #include "content/public/browser/devtools_agent_host.h" 56 #include "content/public/browser/devtools_agent_host.h"
52 #include "content/public/browser/notification_service.h" 57 #include "content/public/browser/notification_service.h"
53 #include "content/public/browser/render_process_host.h" 58 #include "content/public/browser/render_process_host.h"
54 #include "content/public/browser/storage_partition.h" 59 #include "content/public/browser/storage_partition.h"
55 #include "extensions/browser/event_router.h" 60 #include "extensions/browser/event_router.h"
56 #include "extensions/browser/extension_host.h" 61 #include "extensions/browser/extension_host.h"
57 #include "extensions/browser/extension_prefs.h" 62 #include "extensions/browser/extension_prefs.h"
58 #include "extensions/browser/extension_registry.h" 63 #include "extensions/browser/extension_registry.h"
59 #include "extensions/browser/extension_system.h" 64 #include "extensions/browser/extension_system.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 using extensions::SharedModuleService; 111 using extensions::SharedModuleService;
107 using extensions::UnloadedExtensionInfo; 112 using extensions::UnloadedExtensionInfo;
108 113
109 namespace errors = extensions::manifest_errors; 114 namespace errors = extensions::manifest_errors;
110 115
111 namespace { 116 namespace {
112 117
113 // Wait this many seconds after an extensions becomes idle before updating it. 118 // Wait this many seconds after an extensions becomes idle before updating it.
114 const int kUpdateIdleDelay = 5; 119 const int kUpdateIdleDelay = 5;
115 120
121 #if defined(ENABLE_EXTENSIONS)
122 scoped_ptr<IdentityProvider> CreateWebstoreIdentityProvider(Profile* profile) {
123 return make_scoped_ptr<IdentityProvider>(new ProfileIdentityProvider(
124 SigninManagerFactory::GetForProfile(profile),
125 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
126 LoginUIServiceFactory::GetForProfile(profile)));
127 }
128 #endif // defined(ENABLE_EXTENSIONS)
129
116 } // namespace 130 } // namespace
117 131
118 // ExtensionService. 132 // ExtensionService.
119 133
120 void ExtensionService::CheckExternalUninstall(const std::string& id) { 134 void ExtensionService::CheckExternalUninstall(const std::string& id) {
121 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 135 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
122 136
123 // Check if the providers know about this extension. 137 // Check if the providers know about this extension.
124 extensions::ProviderCollection::const_iterator i; 138 extensions::ProviderCollection::const_iterator i;
125 for (i = external_extension_providers_.begin(); 139 for (i = external_extension_providers_.begin();
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 base::StringToInt(command_line->GetSwitchValueASCII( 319 base::StringToInt(command_line->GetSwitchValueASCII(
306 switches::kExtensionsUpdateFrequency), 320 switches::kExtensionsUpdateFrequency),
307 &update_frequency); 321 &update_frequency);
308 } 322 }
309 updater_.reset(new extensions::ExtensionUpdater( 323 updater_.reset(new extensions::ExtensionUpdater(
310 this, 324 this,
311 extension_prefs, 325 extension_prefs,
312 profile->GetPrefs(), 326 profile->GetPrefs(),
313 profile, 327 profile,
314 update_frequency, 328 update_frequency,
315 extensions::ExtensionCache::GetInstance())); 329 extensions::ExtensionCache::GetInstance(),
330 CreateWebstoreIdentityProvider(profile_)));
316 } 331 }
317 #endif 332 #endif
318 333
319 component_loader_.reset( 334 component_loader_.reset(
320 new extensions::ComponentLoader(this, 335 new extensions::ComponentLoader(this,
321 profile->GetPrefs(), 336 profile->GetPrefs(),
322 g_browser_process->local_state(), 337 g_browser_process->local_state(),
323 profile)); 338 profile));
324 339
325 if (extensions_enabled_) { 340 if (extensions_enabled_) {
(...skipping 2034 matching lines...) Expand 10 before | Expand all | Expand 10 after
2360 } 2375 }
2361 2376
2362 void ExtensionService::OnProfileDestructionStarted() { 2377 void ExtensionService::OnProfileDestructionStarted() {
2363 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); 2378 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs();
2364 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); 2379 for (ExtensionIdSet::iterator it = ids_to_unload.begin();
2365 it != ids_to_unload.end(); 2380 it != ids_to_unload.end();
2366 ++it) { 2381 ++it) {
2367 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); 2382 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN);
2368 } 2383 }
2369 } 2384 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698