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

Side by Side Diff: apps/app_load_service.cc

Issue 1016473002: Make LoadMonitoringExtensionHostQueue remove itself as an ExtensionHost observer at the correct tim… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another rename Created 5 years, 9 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 | « apps/app_lifetime_monitor.cc ('k') | chrome/browser/background/background_contents.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "apps/app_load_service.h" 5 #include "apps/app_load_service.h"
6 6
7 #include "apps/app_load_service_factory.h" 7 #include "apps/app_load_service_factory.h"
8 #include "apps/app_restore_service.h" 8 #include "apps/app_restore_service.h"
9 #include "apps/launcher.h" 9 #include "apps/launcher.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 17 matching lines...) Expand all
28 namespace apps { 28 namespace apps {
29 29
30 AppLoadService::PostReloadAction::PostReloadAction() 30 AppLoadService::PostReloadAction::PostReloadAction()
31 : action_type(LAUNCH_FOR_RELOAD), 31 : action_type(LAUNCH_FOR_RELOAD),
32 command_line(base::CommandLine::NO_PROGRAM) { 32 command_line(base::CommandLine::NO_PROGRAM) {
33 } 33 }
34 34
35 AppLoadService::AppLoadService(Profile* profile) 35 AppLoadService::AppLoadService(Profile* profile)
36 : profile_(profile) { 36 : profile_(profile) {
37 registrar_.Add(this, 37 registrar_.Add(this,
38 extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, 38 extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_FIRST_LOAD,
39 content::NotificationService::AllSources()); 39 content::NotificationService::AllSources());
40 extensions::ExtensionRegistry::Get(profile_)->AddObserver(this); 40 extensions::ExtensionRegistry::Get(profile_)->AddObserver(this);
41 } 41 }
42 42
43 AppLoadService::~AppLoadService() { 43 AppLoadService::~AppLoadService() {
44 extensions::ExtensionRegistry::Get(profile_)->RemoveObserver(this); 44 extensions::ExtensionRegistry::Get(profile_)->RemoveObserver(this);
45 } 45 }
46 46
47 void AppLoadService::RestartApplication(const std::string& extension_id) { 47 void AppLoadService::RestartApplication(const std::string& extension_id) {
48 post_reload_actions_[extension_id].action_type = RESTART; 48 post_reload_actions_[extension_id].action_type = RESTART;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } 86 }
87 87
88 // static 88 // static
89 AppLoadService* AppLoadService::Get(Profile* profile) { 89 AppLoadService* AppLoadService::Get(Profile* profile) {
90 return apps::AppLoadServiceFactory::GetForProfile(profile); 90 return apps::AppLoadServiceFactory::GetForProfile(profile);
91 } 91 }
92 92
93 void AppLoadService::Observe(int type, 93 void AppLoadService::Observe(int type,
94 const content::NotificationSource& source, 94 const content::NotificationSource& source,
95 const content::NotificationDetails& details) { 95 const content::NotificationDetails& details) {
96 DCHECK_EQ(type, extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING); 96 DCHECK_EQ(type, extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_FIRST_LOAD);
97 extensions::ExtensionHost* host = 97 extensions::ExtensionHost* host =
98 content::Details<extensions::ExtensionHost>(details).ptr(); 98 content::Details<extensions::ExtensionHost>(details).ptr();
99 const Extension* extension = host->extension(); 99 const Extension* extension = host->extension();
100 // It is possible for an extension to be unloaded before it stops loading. 100 // It is possible for an extension to be unloaded before it stops loading.
101 if (!extension) 101 if (!extension)
102 return; 102 return;
103 std::map<std::string, PostReloadAction>::iterator it = 103 std::map<std::string, PostReloadAction>::iterator it =
104 post_reload_actions_.find(extension->id()); 104 post_reload_actions_.find(extension->id());
105 if (it == post_reload_actions_.end()) 105 if (it == post_reload_actions_.end())
106 return; 106 return;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 Extension::DISABLE_RELOAD) != 0; 151 Extension::DISABLE_RELOAD) != 0;
152 } 152 }
153 return false; 153 return false;
154 } 154 }
155 155
156 bool AppLoadService::HasPostReloadAction(const std::string& extension_id) { 156 bool AppLoadService::HasPostReloadAction(const std::string& extension_id) {
157 return post_reload_actions_.find(extension_id) != post_reload_actions_.end(); 157 return post_reload_actions_.find(extension_id) != post_reload_actions_.end();
158 } 158 }
159 159
160 } // namespace apps 160 } // namespace apps
OLDNEW
« no previous file with comments | « apps/app_lifetime_monitor.cc ('k') | chrome/browser/background/background_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698