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

Unified Diff: apps/saved_files_service.cc

Issue 2789253003: Add chrome/browser/apps/BUILD.gn and move Chrome-specific code there (Closed)
Patch Set: rebase Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « apps/saved_files_service.h ('k') | apps/saved_files_service_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apps/saved_files_service.cc
diff --git a/apps/saved_files_service.cc b/apps/saved_files_service.cc
index a11642be8f99a664a421df34676aea2ca964f381..344b2011df377d02ca2abee52c21623599fb7616 100644
--- a/apps/saved_files_service.cc
+++ b/apps/saved_files_service.cc
@@ -14,7 +14,6 @@
#include "apps/saved_files_service_factory.h"
#include "base/memory/ptr_util.h"
#include "base/value_conversions.h"
-#include "chrome/browser/chrome_notification_types.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/notification_service.h"
#include "extensions/browser/extension_host.h"
@@ -202,9 +201,6 @@ SavedFilesService::SavedFilesService(content::BrowserContext* context)
registrar_.Add(this,
extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED,
content::NotificationService::AllSources());
- registrar_.Add(this,
- chrome::NOTIFICATION_APP_TERMINATING,
- content::NotificationService::AllSources());
}
SavedFilesService::~SavedFilesService() {}
@@ -212,23 +208,12 @@ SavedFilesService::~SavedFilesService() {}
void SavedFilesService::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
- switch (type) {
- case extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED: {
- ExtensionHost* host = content::Details<ExtensionHost>(details).ptr();
- const Extension* extension = host->extension();
- if (extension) {
- ClearQueueIfNoRetainPermission(extension);
- Clear(extension->id());
- }
- break;
- }
-
- case chrome::NOTIFICATION_APP_TERMINATING: {
- // Stop listening to NOTIFICATION_EXTENSION_HOST_DESTROYED in particular
- // as all extension hosts will be destroyed as a result of shutdown.
- registrar_.RemoveAll();
- break;
- }
+ DCHECK_EQ(extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, type);
+ ExtensionHost* host = content::Details<ExtensionHost>(details).ptr();
+ const Extension* extension = host->extension();
+ if (extension) {
+ ClearQueueIfNoRetainPermission(extension);
+ Clear(extension->id());
}
}
@@ -276,6 +261,12 @@ void SavedFilesService::ClearQueue(const extensions::Extension* extension) {
Clear(extension->id());
}
+void SavedFilesService::OnApplicationTerminating() {
+ // Stop listening to NOTIFICATION_EXTENSION_HOST_DESTROYED in particular
+ // as all extension hosts will be destroyed as a result of shutdown.
+ registrar_.RemoveAll();
+}
+
SavedFilesService::SavedFiles* SavedFilesService::Get(
const std::string& extension_id) const {
auto it = extension_id_to_saved_files_.find(extension_id);
« no previous file with comments | « apps/saved_files_service.h ('k') | apps/saved_files_service_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698