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

Side by Side Diff: chrome/browser/extensions/api/media_galleries_private/gallery_watch_state_tracker.cc

Issue 204703002: Rename NOTIFICATION_EXTENSION_UNLOADED to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: maybe upload wont do something bizarre this time Created 6 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 | Annotate | Revision Log
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 // GalleryWatchStateTracker implementation. 5 // GalleryWatchStateTracker implementation.
6 6
7 #include "chrome/browser/extensions/api/media_galleries_private/gallery_watch_st ate_tracker.h" 7 #include "chrome/browser/extensions/api/media_galleries_private/gallery_watch_st ate_tracker.h"
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 72 }
73 73
74 } // namespace 74 } // namespace
75 75
76 GalleryWatchStateTracker::GalleryWatchStateTracker(Profile* profile) 76 GalleryWatchStateTracker::GalleryWatchStateTracker(Profile* profile)
77 : profile_(profile) { 77 : profile_(profile) {
78 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 78 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
79 DCHECK(profile_); 79 DCHECK(profile_);
80 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, 80 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
81 content::Source<Profile>(profile_)); 81 content::Source<Profile>(profile_));
82 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, 82 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
83 content::Source<Profile>(profile_)); 83 content::Source<Profile>(profile_));
84 MediaGalleriesPreferences* preferences = 84 MediaGalleriesPreferences* preferences =
85 g_browser_process->media_file_system_registry()->GetPreferences(profile); 85 g_browser_process->media_file_system_registry()->GetPreferences(profile);
86 preferences->AddGalleryChangeObserver(this); 86 preferences->AddGalleryChangeObserver(this);
87 } 87 }
88 88
89 GalleryWatchStateTracker::~GalleryWatchStateTracker() { 89 GalleryWatchStateTracker::~GalleryWatchStateTracker() {
90 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 90 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
91 MediaGalleriesPreferences* preferences = 91 MediaGalleriesPreferences* preferences =
92 g_browser_process->media_file_system_registry()->GetPreferences(profile_); 92 g_browser_process->media_file_system_registry()->GetPreferences(profile_);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 if (!storage) 208 if (!storage)
209 return; 209 return;
210 storage->GetExtensionValue( 210 storage->GetExtensionValue(
211 extension->id(), 211 extension->id(),
212 kRegisteredGalleryWatchers, 212 kRegisteredGalleryWatchers,
213 base::Bind(&GalleryWatchStateTracker::ReadFromStorage, 213 base::Bind(&GalleryWatchStateTracker::ReadFromStorage,
214 AsWeakPtr(), 214 AsWeakPtr(),
215 extension->id())); 215 extension->id()));
216 break; 216 break;
217 } 217 }
218 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { 218 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: {
219 Extension* extension = const_cast<Extension*>( 219 Extension* extension = const_cast<Extension*>(
220 content::Details<extensions::UnloadedExtensionInfo>( 220 content::Details<extensions::UnloadedExtensionInfo>(
221 details)->extension); 221 details)->extension);
222 DCHECK(extension); 222 DCHECK(extension);
223 if (!ContainsKey(watched_extensions_map_, extension->id())) 223 if (!ContainsKey(watched_extensions_map_, extension->id()))
224 return; 224 return;
225 content::BrowserThread::PostTask( 225 content::BrowserThread::PostTask(
226 content::BrowserThread::FILE, FROM_HERE, 226 content::BrowserThread::FILE, FROM_HERE,
227 base::Bind(&GalleryWatchManager::OnExtensionUnloaded, 227 base::Bind(&GalleryWatchManager::OnExtensionUnloaded,
228 profile_, 228 profile_,
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 const std::string& extension_id, 346 const std::string& extension_id,
347 MediaGalleryPrefId gallery_id) { 347 MediaGalleryPrefId gallery_id) {
348 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 348 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
349 if (HasGalleryWatchInfo(extension_id, gallery_id, true)) 349 if (HasGalleryWatchInfo(extension_id, gallery_id, true))
350 return false; 350 return false;
351 watched_extensions_map_[extension_id][gallery_id] = true; 351 watched_extensions_map_[extension_id][gallery_id] = true;
352 return true; 352 return true;
353 } 353 }
354 354
355 } // namespace extensions 355 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698