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

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

Issue 2623273011: Move Chrome terminating notification out of //apps (Closed)
Patch Set: remove DEPS rule Created 3 years, 11 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
« no previous file with comments | « chrome/browser/extensions/extension_system_impl.h ('k') | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_system_impl.h" 5 #include "chrome/browser/extensions/extension_system_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "apps/app_restore_service.h"
10 #include "apps/app_restore_service_factory.h"
9 #include "base/base_switches.h" 11 #include "base/base_switches.h"
10 #include "base/bind.h" 12 #include "base/bind.h"
11 #include "base/command_line.h" 13 #include "base/command_line.h"
12 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
13 #include "base/files/file_util.h" 15 #include "base/files/file_util.h"
14 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
15 #include "base/strings/string_tokenizer.h" 17 #include "base/strings/string_tokenizer.h"
16 #include "base/trace_event/trace_event.h" 18 #include "base/trace_event/trace_event.h"
17 #include "build/build_config.h" 19 #include "build/build_config.h"
18 #include "chrome/browser/browser_process.h" 20 #include "chrome/browser/browser_process.h"
21 #include "chrome/browser/chrome_notification_types.h"
19 #include "chrome/browser/extensions/chrome_app_sorting.h" 22 #include "chrome/browser/extensions/chrome_app_sorting.h"
20 #include "chrome/browser/extensions/chrome_content_verifier_delegate.h" 23 #include "chrome/browser/extensions/chrome_content_verifier_delegate.h"
21 #include "chrome/browser/extensions/component_loader.h" 24 #include "chrome/browser/extensions/component_loader.h"
22 #include "chrome/browser/extensions/extension_error_reporter.h" 25 #include "chrome/browser/extensions/extension_error_reporter.h"
23 #include "chrome/browser/extensions/extension_garbage_collector.h" 26 #include "chrome/browser/extensions/extension_garbage_collector.h"
24 #include "chrome/browser/extensions/extension_management.h" 27 #include "chrome/browser/extensions/extension_management.h"
25 #include "chrome/browser/extensions/extension_service.h" 28 #include "chrome/browser/extensions/extension_service.h"
26 #include "chrome/browser/extensions/extension_sync_service.h" 29 #include "chrome/browser/extensions/extension_sync_service.h"
27 #include "chrome/browser/extensions/extension_system_factory.h" 30 #include "chrome/browser/extensions/extension_system_factory.h"
28 #include "chrome/browser/extensions/extension_util.h" 31 #include "chrome/browser/extensions/extension_util.h"
29 #include "chrome/browser/extensions/install_verifier.h" 32 #include "chrome/browser/extensions/install_verifier.h"
30 #include "chrome/browser/extensions/navigation_observer.h" 33 #include "chrome/browser/extensions/navigation_observer.h"
31 #include "chrome/browser/extensions/shared_module_service.h" 34 #include "chrome/browser/extensions/shared_module_service.h"
32 #include "chrome/browser/extensions/shared_user_script_master.h" 35 #include "chrome/browser/extensions/shared_user_script_master.h"
33 #include "chrome/browser/extensions/state_store_notification_observer.h" 36 #include "chrome/browser/extensions/state_store_notification_observer.h"
34 #include "chrome/browser/extensions/unpacked_installer.h" 37 #include "chrome/browser/extensions/unpacked_installer.h"
35 #include "chrome/browser/extensions/update_install_gate.h" 38 #include "chrome/browser/extensions/update_install_gate.h"
36 #include "chrome/browser/notifications/notifier_state_tracker.h" 39 #include "chrome/browser/notifications/notifier_state_tracker.h"
37 #include "chrome/browser/notifications/notifier_state_tracker_factory.h" 40 #include "chrome/browser/notifications/notifier_state_tracker_factory.h"
38 #include "chrome/browser/profiles/profile.h" 41 #include "chrome/browser/profiles/profile.h"
39 #include "chrome/browser/profiles/profile_manager.h" 42 #include "chrome/browser/profiles/profile_manager.h"
40 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" 43 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
41 #include "chrome/common/chrome_switches.h" 44 #include "chrome/common/chrome_switches.h"
42 #include "content/public/browser/browser_thread.h" 45 #include "content/public/browser/browser_thread.h"
46 #include "content/public/browser/notification_service.h"
43 #include "content/public/browser/url_data_source.h" 47 #include "content/public/browser/url_data_source.h"
44 #include "extensions/browser/content_verifier.h" 48 #include "extensions/browser/content_verifier.h"
45 #include "extensions/browser/extension_pref_store.h" 49 #include "extensions/browser/extension_pref_store.h"
46 #include "extensions/browser/extension_pref_value_map.h" 50 #include "extensions/browser/extension_pref_value_map.h"
47 #include "extensions/browser/extension_pref_value_map_factory.h" 51 #include "extensions/browser/extension_pref_value_map_factory.h"
48 #include "extensions/browser/extension_prefs.h" 52 #include "extensions/browser/extension_prefs.h"
49 #include "extensions/browser/extension_registry.h" 53 #include "extensions/browser/extension_registry.h"
50 #include "extensions/browser/info_map.h" 54 #include "extensions/browser/info_map.h"
51 #include "extensions/browser/quota_service.h" 55 #include "extensions/browser/quota_service.h"
52 #include "extensions/browser/runtime_data.h" 56 #include "extensions/browser/runtime_data.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 94 }
91 95
92 } // namespace 96 } // namespace
93 97
94 // 98 //
95 // ExtensionSystemImpl::Shared 99 // ExtensionSystemImpl::Shared
96 // 100 //
97 101
98 ExtensionSystemImpl::Shared::Shared(Profile* profile) 102 ExtensionSystemImpl::Shared::Shared(Profile* profile)
99 : profile_(profile) { 103 : profile_(profile) {
104 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING,
105 content::NotificationService::AllSources());
100 } 106 }
101 107
102 ExtensionSystemImpl::Shared::~Shared() { 108 ExtensionSystemImpl::Shared::~Shared() {
103 } 109 }
104 110
105 void ExtensionSystemImpl::Shared::InitPrefs() { 111 void ExtensionSystemImpl::Shared::InitPrefs() {
106 store_factory_ = new ValueStoreFactoryImpl(profile_->GetPath()); 112 store_factory_ = new ValueStoreFactoryImpl(profile_->GetPath());
107 113
108 // Two state stores. The latter, which contains declarative rules, must be 114 // Two state stores. The latter, which contains declarative rules, must be
109 // loaded immediately so that the rules are ready before we issue network 115 // loaded immediately so that the rules are ready before we issue network
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 } 323 }
318 324
319 AppSorting* ExtensionSystemImpl::Shared::app_sorting() { 325 AppSorting* ExtensionSystemImpl::Shared::app_sorting() {
320 return app_sorting_.get(); 326 return app_sorting_.get();
321 } 327 }
322 328
323 ContentVerifier* ExtensionSystemImpl::Shared::content_verifier() { 329 ContentVerifier* ExtensionSystemImpl::Shared::content_verifier() {
324 return content_verifier_.get(); 330 return content_verifier_.get();
325 } 331 }
326 332
333 void ExtensionSystemImpl::Shared::Observe(
334 int type,
335 const content::NotificationSource& source,
336 const content::NotificationDetails& details) {
337 DCHECK_EQ(chrome::NOTIFICATION_APP_TERMINATING, type);
338 CHECK(apps::AppRestoreServiceFactory::GetForProfile(profile_));
339 apps::AppRestoreServiceFactory::GetForProfile(profile_)
340 ->OnApplicationTerminating();
341 }
342
327 // 343 //
328 // ExtensionSystemImpl 344 // ExtensionSystemImpl
329 // 345 //
330 346
331 ExtensionSystemImpl::ExtensionSystemImpl(Profile* profile) 347 ExtensionSystemImpl::ExtensionSystemImpl(Profile* profile)
332 : profile_(profile) { 348 : profile_(profile) {
333 shared_ = ExtensionSystemSharedFactory::GetForBrowserContext(profile); 349 shared_ = ExtensionSystemSharedFactory::GetForBrowserContext(profile);
334 350
335 if (!profile->IsOffTheRecord()) { 351 if (!profile->IsOffTheRecord()) {
336 shared_->InitPrefs(); 352 shared_->InitPrefs();
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( 463 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts(
448 const std::string& extension_id, 464 const std::string& extension_id,
449 const UnloadedExtensionInfo::Reason reason) { 465 const UnloadedExtensionInfo::Reason reason) {
450 BrowserThread::PostTask( 466 BrowserThread::PostTask(
451 BrowserThread::IO, 467 BrowserThread::IO,
452 FROM_HERE, 468 FROM_HERE,
453 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); 469 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason));
454 } 470 }
455 471
456 } // namespace extensions 472 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_system_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698