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

Side by Side Diff: chrome/browser/media_galleries/media_file_system_registry.cc

Issue 185393012: Change media galleries to external file system type to add toURL support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: checkpoint 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 #include "chrome/browser/media_galleries/media_file_system_registry.h" 5 #include "chrome/browser/media_galleries/media_file_system_registry.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/prefs/pref_service.h" 13 #include "base/prefs/pref_service.h"
14 #include "base/stl_util.h" 14 #include "base/stl_util.h"
15 #include "base/strings/string_number_conversions.h"
16 #include "base/strings/string_util.h"
15 #include "chrome/browser/extensions/extension_service.h" 17 #include "chrome/browser/extensions/extension_service.h"
16 #include "chrome/browser/media_galleries/fileapi/mtp_device_map_service.h" 18 #include "chrome/browser/media_galleries/fileapi/mtp_device_map_service.h"
17 #include "chrome/browser/media_galleries/imported_media_gallery_registry.h" 19 #include "chrome/browser/media_galleries/imported_media_gallery_registry.h"
18 #include "chrome/browser/media_galleries/media_file_system_context.h" 20 #include "chrome/browser/media_galleries/media_file_system_context.h"
19 #include "chrome/browser/media_galleries/media_galleries_dialog_controller.h" 21 #include "chrome/browser/media_galleries/media_galleries_dialog_controller.h"
20 #include "chrome/browser/media_galleries/media_galleries_histograms.h" 22 #include "chrome/browser/media_galleries/media_galleries_histograms.h"
21 #include "chrome/browser/media_galleries/media_galleries_preferences_factory.h" 23 #include "chrome/browser/media_galleries/media_galleries_preferences_factory.h"
22 #include "chrome/browser/media_galleries/media_scan_manager.h" 24 #include "chrome/browser/media_galleries/media_scan_manager.h"
23 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/common/chrome_paths.h" 26 #include "chrome/common/chrome_paths.h"
25 #include "chrome/common/extensions/extension_constants.h" 27 #include "chrome/common/extensions/extension_constants.h"
26 #include "chrome/common/pref_names.h" 28 #include "chrome/common/pref_names.h"
27 #include "components/storage_monitor/media_storage_util.h" 29 #include "components/storage_monitor/media_storage_util.h"
28 #include "components/storage_monitor/storage_monitor.h" 30 #include "components/storage_monitor/storage_monitor.h"
29 #include "content/public/browser/browser_thread.h" 31 #include "content/public/browser/browser_thread.h"
30 #include "content/public/browser/navigation_details.h" 32 #include "content/public/browser/navigation_details.h"
31 #include "content/public/browser/render_process_host.h" 33 #include "content/public/browser/render_process_host.h"
32 #include "content/public/browser/render_process_host_observer.h" 34 #include "content/public/browser/render_process_host_observer.h"
33 #include "content/public/browser/render_view_host.h" 35 #include "content/public/browser/render_view_host.h"
34 #include "content/public/browser/web_contents.h" 36 #include "content/public/browser/web_contents.h"
35 #include "content/public/browser/web_contents_observer.h" 37 #include "content/public/browser/web_contents_observer.h"
36 #include "extensions/browser/extension_system.h" 38 #include "extensions/browser/extension_system.h"
37 #include "extensions/common/extension.h" 39 #include "extensions/common/extension.h"
38 #include "extensions/common/extension_set.h" 40 #include "extensions/common/extension_set.h"
39 #include "webkit/browser/fileapi/isolated_context.h" 41 #include "webkit/browser/fileapi/external_mount_points.h"
42 #include "webkit/common/fileapi/file_system_mount_option.h"
40 #include "webkit/common/fileapi/file_system_types.h" 43 #include "webkit/common/fileapi/file_system_types.h"
41 44
42 using content::BrowserThread; 45 using content::BrowserThread;
43 using content::NavigationController; 46 using content::NavigationController;
44 using content::RenderProcessHost; 47 using content::RenderProcessHost;
45 using content::WebContents; 48 using content::WebContents;
46 using fileapi::IsolatedContext;
47 using storage_monitor::MediaStorageUtil; 49 using storage_monitor::MediaStorageUtil;
48 using storage_monitor::StorageInfo; 50 using storage_monitor::StorageInfo;
49 using storage_monitor::StorageMonitor; 51 using storage_monitor::StorageMonitor;
52 using fileapi::ExternalMountPoints;
50 53
51 namespace { 54 namespace {
52 55
53 struct InvalidatedGalleriesInfo { 56 struct InvalidatedGalleriesInfo {
54 std::set<ExtensionGalleriesHost*> extension_hosts; 57 std::set<ExtensionGalleriesHost*> extension_hosts;
55 std::set<MediaGalleryPrefId> pref_ids; 58 std::set<MediaGalleryPrefId> pref_ids;
56 }; 59 };
57 60
58 // Tracks the liveness of multiple RenderProcessHosts that the caller is 61 // Tracks the liveness of multiple RenderProcessHosts that the caller is
59 // interested in. Once all of the RPHs have closed or been destroyed a call 62 // interested in. Once all of the RPHs have closed or been destroyed a call
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 257
255 // The main owner of this class is 258 // The main owner of this class is
256 // |MediaFileSystemRegistry::extension_hosts_map_|, but a callback may 259 // |MediaFileSystemRegistry::extension_hosts_map_|, but a callback may
257 // temporarily hold a reference. 260 // temporarily hold a reference.
258 class ExtensionGalleriesHost 261 class ExtensionGalleriesHost
259 : public base::RefCountedThreadSafe<ExtensionGalleriesHost> { 262 : public base::RefCountedThreadSafe<ExtensionGalleriesHost> {
260 public: 263 public:
261 // |no_references_callback| is called when the last RenderViewHost reference 264 // |no_references_callback| is called when the last RenderViewHost reference
262 // goes away. RenderViewHost references are added through ReferenceFromRVH(). 265 // goes away. RenderViewHost references are added through ReferenceFromRVH().
263 ExtensionGalleriesHost(MediaFileSystemContext* file_system_context, 266 ExtensionGalleriesHost(MediaFileSystemContext* file_system_context,
267 const std::string file_system_name_prefix,
264 const base::Closure& no_references_callback) 268 const base::Closure& no_references_callback)
265 : file_system_context_(file_system_context), 269 : file_system_context_(file_system_context),
270 file_system_name_prefix_(file_system_name_prefix),
266 no_references_callback_(no_references_callback), 271 no_references_callback_(no_references_callback),
267 rph_refs_(base::Bind(&ExtensionGalleriesHost::CleanUp, 272 rph_refs_(base::Bind(&ExtensionGalleriesHost::CleanUp,
268 base::Unretained(this))) { 273 base::Unretained(this))) {
269 } 274 }
270 275
271 // For each gallery in the list of permitted |galleries|, checks if the 276 // For each gallery in the list of permitted |galleries|, checks if the
272 // device is attached and if so looks up or creates a file system id and 277 // device is attached and if so looks up or creates a file system id and
273 // passes the information needed for the renderer to create those file 278 // passes the information needed for the renderer to create those file
274 // system objects to the |callback|. 279 // system objects to the |callback|.
275 void GetMediaFileSystems(const MediaGalleryPrefIdSet& galleries, 280 void GetMediaFileSystems(const MediaGalleryPrefIdSet& galleries,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 continue; 352 continue;
348 353
349 PrefIdFsInfoMap::const_iterator existing_info = 354 PrefIdFsInfoMap::const_iterator existing_info =
350 pref_id_map_.find(pref_id); 355 pref_id_map_.find(pref_id);
351 if (existing_info != pref_id_map_.end()) { 356 if (existing_info != pref_id_map_.end()) {
352 result.push_back(existing_info->second); 357 result.push_back(existing_info->second);
353 continue; 358 continue;
354 } 359 }
355 360
356 base::FilePath path = gallery_info.AbsolutePath(); 361 base::FilePath path = gallery_info.AbsolutePath();
357 if (!MediaStorageUtil::CanCreateFileSystem(device_id, path)) 362 if (path.empty() ||
363 !MediaStorageUtil::CanCreateFileSystem(device_id, path))
358 continue; 364 continue;
359 365
360 std::string fsid = 366 std::string fs_name = file_system_name_prefix_;
361 file_system_context_->RegisterFileSystem(device_id, path); 367 fs_name.append(base::Uint64ToString(pref_id));
362 if (fsid.empty()) 368 if (!file_system_context_->RegisterFileSystem(device_id, fs_name, path))
363 continue; 369 continue;
364 370
365 MediaFileSystemInfo new_entry( 371 MediaFileSystemInfo new_entry(
366 gallery_info.GetGalleryDisplayName(), 372 gallery_info.GetGalleryDisplayName(),
367 path, 373 file_system_context_->GetRegisteredPath(fs_name),
368 fsid, 374 fs_name,
369 pref_id, 375 pref_id,
370 GetTransientIdForRemovableDeviceId(device_id), 376 GetTransientIdForRemovableDeviceId(device_id),
371 StorageInfo::IsRemovableDevice(device_id), 377 StorageInfo::IsRemovableDevice(device_id),
372 StorageInfo::IsMediaDevice(device_id)); 378 StorageInfo::IsMediaDevice(device_id));
373 result.push_back(new_entry); 379 result.push_back(new_entry);
374 pref_id_map_[pref_id] = new_entry; 380 pref_id_map_[pref_id] = new_entry;
375 } 381 }
376 382
377 if (result.size() == 0) { 383 if (result.size() == 0) {
378 rph_refs_.Reset(); 384 rph_refs_.Reset();
(...skipping 20 matching lines...) Expand all
399 } 405 }
400 pref_id_map_.clear(); 406 pref_id_map_.clear();
401 407
402 no_references_callback_.Run(); 408 no_references_callback_.Run();
403 } 409 }
404 410
405 // MediaFileSystemRegistry owns |this| and |file_system_context_|, so it's 411 // MediaFileSystemRegistry owns |this| and |file_system_context_|, so it's
406 // safe to store a raw pointer. 412 // safe to store a raw pointer.
407 MediaFileSystemContext* file_system_context_; 413 MediaFileSystemContext* file_system_context_;
408 414
415 // A unique name prefix for filesystems.
416 std::string file_system_name_prefix_;
417
409 // A callback to call when the last RVH reference goes away. 418 // A callback to call when the last RVH reference goes away.
410 base::Closure no_references_callback_; 419 base::Closure no_references_callback_;
411 420
412 // A map from the gallery preferences id to the file system information. 421 // A map from the gallery preferences id to the file system information.
413 PrefIdFsInfoMap pref_id_map_; 422 PrefIdFsInfoMap pref_id_map_;
414 423
415 // The set of render processes and web contents that may have references to 424 // The set of render processes and web contents that may have references to
416 // the file system ids this instance manages. 425 // the file system ids this instance manages.
417 RPHReferenceManager rph_refs_; 426 RPHReferenceManager rph_refs_;
418 427
(...skipping 22 matching lines...) Expand all
441 } 450 }
442 451
443 ExtensionGalleriesHostMap::iterator extension_hosts = 452 ExtensionGalleriesHostMap::iterator extension_hosts =
444 extension_hosts_map_.find(profile); 453 extension_hosts_map_.find(profile);
445 if (extension_hosts->second.empty()) 454 if (extension_hosts->second.empty())
446 preferences->AddGalleryChangeObserver(this); 455 preferences->AddGalleryChangeObserver(this);
447 456
448 ExtensionGalleriesHost* extension_host = 457 ExtensionGalleriesHost* extension_host =
449 extension_hosts->second[extension->id()].get(); 458 extension_hosts->second[extension->id()].get();
450 if (!extension_host) { 459 if (!extension_host) {
460 std::string name_prefix = "media_galleries-";
461 name_prefix.append(profile->GetPath().BaseName().MaybeAsASCII());
462 name_prefix.append("-");
463 name_prefix.append(extension->id());
464 name_prefix.append("-");
465 base::ReplaceChars(name_prefix, " /", "_", &name_prefix);
451 extension_host = new ExtensionGalleriesHost( 466 extension_host = new ExtensionGalleriesHost(
452 file_system_context_.get(), 467 file_system_context_.get(),
468 name_prefix,
453 base::Bind(&MediaFileSystemRegistry::OnExtensionGalleriesHostEmpty, 469 base::Bind(&MediaFileSystemRegistry::OnExtensionGalleriesHostEmpty,
454 base::Unretained(this), 470 base::Unretained(this),
455 profile, 471 profile,
456 extension->id())); 472 extension->id()));
457 extension_hosts_map_[profile][extension->id()] = extension_host; 473 extension_hosts_map_[profile][extension->id()] = extension_host;
458 } 474 }
459 // This must come before the GetMediaFileSystems call to make sure the 475 // This must come before the GetMediaFileSystems call to make sure the
460 // RVH of the context is referenced before the filesystems are retrieved. 476 // RVH of the context is referenced before the filesystems are retrieved.
461 extension_host->ReferenceFromRVH(rvh); 477 extension_host->ReferenceFromRVH(rvh);
462 478
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 } 547 }
532 } 548 }
533 549
534 /****************** 550 /******************
535 * Private methods 551 * Private methods
536 ******************/ 552 ******************/
537 553
538 class MediaFileSystemRegistry::MediaFileSystemContextImpl 554 class MediaFileSystemRegistry::MediaFileSystemContextImpl
539 : public MediaFileSystemContext { 555 : public MediaFileSystemContext {
540 public: 556 public:
541 explicit MediaFileSystemContextImpl(MediaFileSystemRegistry* registry) 557 MediaFileSystemContextImpl() {}
542 : registry_(registry) {
543 DCHECK(registry_); // Suppresses unused warning on Android.
544 }
545 virtual ~MediaFileSystemContextImpl() {} 558 virtual ~MediaFileSystemContextImpl() {}
546 559
547 virtual std::string RegisterFileSystem( 560 virtual bool RegisterFileSystem(const std::string& device_id,
548 const std::string& device_id, const base::FilePath& path) OVERRIDE { 561 const std::string& fs_name,
562 const base::FilePath& path) OVERRIDE {
549 if (StorageInfo::IsMassStorageDevice(device_id)) { 563 if (StorageInfo::IsMassStorageDevice(device_id)) {
550 return RegisterFileSystemForMassStorage(device_id, path); 564 return RegisterFileSystemForMassStorage(device_id, fs_name, path);
551 } else { 565 } else {
552 return RegisterFileSystemForMTPDevice(device_id, path); 566 return RegisterFileSystemForMTPDevice(device_id, fs_name, path);
553 } 567 }
554 } 568 }
555 569
556 virtual void RevokeFileSystem(const std::string& fsid) OVERRIDE { 570 virtual void RevokeFileSystem(const std::string& fs_name) OVERRIDE {
557 ImportedMediaGalleryRegistry* imported_registry = 571 ImportedMediaGalleryRegistry* imported_registry =
558 ImportedMediaGalleryRegistry::GetInstance(); 572 ImportedMediaGalleryRegistry::GetInstance();
559 if (imported_registry->RevokeImportedFilesystemOnUIThread(fsid)) 573 if (imported_registry->RevokeImportedFilesystemOnUIThread(fs_name))
560 return; 574 return;
561 575
562 IsolatedContext::GetInstance()->RevokeFileSystem(fsid); 576 ExternalMountPoints::GetSystemInstance()->RevokeFileSystem(fs_name);
563 577
564 content::BrowserThread::PostTask( 578 content::BrowserThread::PostTask(
565 content::BrowserThread::IO, FROM_HERE, base::Bind( 579 content::BrowserThread::IO, FROM_HERE, base::Bind(
566 &MTPDeviceMapService::RevokeMTPFileSystem, 580 &MTPDeviceMapService::RevokeMTPFileSystem,
567 base::Unretained(MTPDeviceMapService::GetInstance()), 581 base::Unretained(MTPDeviceMapService::GetInstance()),
568 fsid)); 582 fs_name));
583 }
584
585 virtual base::FilePath GetRegisteredPath(
586 const std::string& fs_name) const OVERRIDE {
587 base::FilePath result;
588 if (!ExternalMountPoints::GetSystemInstance()->GetRegisteredPath(fs_name,
589 &result)) {
590 return base::FilePath();
591 }
592 return result;
569 } 593 }
570 594
571 private: 595 private:
572 // Registers and returns the file system id for the mass storage device 596 // Registers and returns the file system id for the mass storage device
573 // specified by |device_id| and |path|. 597 // specified by |device_id| and |path|.
574 std::string RegisterFileSystemForMassStorage( 598 bool RegisterFileSystemForMassStorage(const std::string& device_id,
575 const std::string& device_id, const base::FilePath& path) { 599 const std::string& fs_name,
600 const base::FilePath& path) {
576 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 601 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
577 DCHECK(StorageInfo::IsMassStorageDevice(device_id)); 602 DCHECK(StorageInfo::IsMassStorageDevice(device_id));
578 603
579 // Sanity checks for |path|. 604 // Sanity checks for |path|.
580 CHECK(path.IsAbsolute()); 605 CHECK(path.IsAbsolute());
581 CHECK(!path.ReferencesParent()); 606 CHECK(!path.ReferencesParent());
582 607
583 // TODO(gbillock): refactor ImportedMediaGalleryRegistry to delegate this 608 // TODO(gbillock): refactor ImportedMediaGalleryRegistry to delegate this
584 // call tree, probably by having it figure out by device id what 609 // call tree, probably by having it figure out by device id what
585 // registration is needed, or having per-device-type handlers at the 610 // registration is needed, or having per-device-type handlers at the
586 // next higher level. 611 // next higher level.
587 std::string fsid; 612 bool result = false;
588 if (StorageInfo::IsITunesDevice(device_id)) { 613 if (StorageInfo::IsITunesDevice(device_id)) {
589 ImportedMediaGalleryRegistry* imported_registry = 614 ImportedMediaGalleryRegistry* registry =
590 ImportedMediaGalleryRegistry::GetInstance(); 615 ImportedMediaGalleryRegistry::GetInstance();
591 fsid = imported_registry->RegisterITunesFilesystemOnUIThread(path); 616 result = registry->RegisterITunesFilesystemOnUIThread(fs_name, path);
592 } else if (StorageInfo::IsPicasaDevice(device_id)) { 617 } else if (StorageInfo::IsPicasaDevice(device_id)) {
593 ImportedMediaGalleryRegistry* imported_registry = 618 ImportedMediaGalleryRegistry* registry =
594 ImportedMediaGalleryRegistry::GetInstance(); 619 ImportedMediaGalleryRegistry::GetInstance();
595 fsid = imported_registry->RegisterPicasaFilesystemOnUIThread( 620 result = registry->RegisterPicasaFilesystemOnUIThread(fs_name, path);
596 path);
597 } else if (StorageInfo::IsIPhotoDevice(device_id)) { 621 } else if (StorageInfo::IsIPhotoDevice(device_id)) {
598 ImportedMediaGalleryRegistry* imported_registry = 622 ImportedMediaGalleryRegistry* registry =
599 ImportedMediaGalleryRegistry::GetInstance(); 623 ImportedMediaGalleryRegistry::GetInstance();
600 fsid = imported_registry->RegisterIPhotoFilesystemOnUIThread( 624 result = registry->RegisterIPhotoFilesystemOnUIThread(fs_name, path);
601 path);
602 } else { 625 } else {
603 std::string fs_name(extension_misc::kMediaFileSystemPathPart); 626 result = ExternalMountPoints::GetSystemInstance()->RegisterFileSystem(
604 fsid = IsolatedContext::GetInstance()->RegisterFileSystemForPath( 627 fs_name, fileapi::kFileSystemTypeNativeMedia,
605 fileapi::kFileSystemTypeNativeMedia, path, &fs_name); 628 fileapi::FileSystemMountOption(), path);
606 } 629 }
607 return fsid; 630 return result;
608 } 631 }
609 632
610 std::string RegisterFileSystemForMTPDevice( 633 bool RegisterFileSystemForMTPDevice(const std::string& device_id,
611 const std::string& device_id, const base::FilePath& path) { 634 const std::string fs_name,
635 const base::FilePath& path) {
612 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 636 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
613 DCHECK(!StorageInfo::IsMassStorageDevice(device_id)); 637 DCHECK(!StorageInfo::IsMassStorageDevice(device_id));
614 638
615 // Sanity checks for |path|. 639 // Sanity checks for |path|.
616 CHECK(MediaStorageUtil::CanCreateFileSystem(device_id, path)); 640 CHECK(MediaStorageUtil::CanCreateFileSystem(device_id, path));
617 std::string fs_name(extension_misc::kMediaFileSystemPathPart); 641 bool result = ExternalMountPoints::GetSystemInstance()->RegisterFileSystem(
618 const std::string fsid = 642 fs_name, fileapi::kFileSystemTypeDeviceMedia,
619 IsolatedContext::GetInstance()->RegisterFileSystemForPath( 643 fileapi::FileSystemMountOption(), path);
620 fileapi::kFileSystemTypeDeviceMedia, path, &fs_name); 644 CHECK(result);
621 CHECK(!fsid.empty());
622 content::BrowserThread::PostTask( 645 content::BrowserThread::PostTask(
623 content::BrowserThread::IO, FROM_HERE, base::Bind( 646 content::BrowserThread::IO, FROM_HERE, base::Bind(
624 &MTPDeviceMapService::RegisterMTPFileSystem, 647 &MTPDeviceMapService::RegisterMTPFileSystem,
625 base::Unretained(MTPDeviceMapService::GetInstance()), 648 base::Unretained(MTPDeviceMapService::GetInstance()),
626 path.value(), fsid)); 649 path.value(), fs_name));
627 return fsid; 650 return result;
628 } 651 }
629 652
630 MediaFileSystemRegistry* registry_;
631
632 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemContextImpl); 653 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemContextImpl);
633 }; 654 };
634 655
635 // Constructor in 'private' section because depends on private class definition. 656 // Constructor in 'private' section because depends on private class definition.
636 MediaFileSystemRegistry::MediaFileSystemRegistry() 657 MediaFileSystemRegistry::MediaFileSystemRegistry()
637 : file_system_context_(new MediaFileSystemContextImpl(this)) { 658 : file_system_context_(new MediaFileSystemContextImpl) {
638 StorageMonitor::GetInstance()->AddObserver(this); 659 StorageMonitor::GetInstance()->AddObserver(this);
639 } 660 }
640 661
641 MediaFileSystemRegistry::~MediaFileSystemRegistry() { 662 MediaFileSystemRegistry::~MediaFileSystemRegistry() {
642 // TODO(gbillock): This is needed because the unit test uses the 663 // TODO(gbillock): This is needed because the unit test uses the
643 // g_browser_process registry. We should create one in the unit test, 664 // g_browser_process registry. We should create one in the unit test,
644 // and then can remove this. 665 // and then can remove this.
645 if (StorageMonitor::GetInstance()) 666 if (StorageMonitor::GetInstance())
646 StorageMonitor::GetInstance()->RemoveObserver(this); 667 StorageMonitor::GetInstance()->RemoveObserver(this);
647 } 668 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 DCHECK_EQ(1U, erase_count); 731 DCHECK_EQ(1U, erase_count);
711 if (extension_hosts->second.empty()) { 732 if (extension_hosts->second.empty()) {
712 // When a profile has no ExtensionGalleriesHosts left, remove the 733 // When a profile has no ExtensionGalleriesHosts left, remove the
713 // matching gallery-change-watcher since it is no longer needed. Leave the 734 // matching gallery-change-watcher since it is no longer needed. Leave the
714 // |extension_hosts| entry alone, since it indicates the profile has been 735 // |extension_hosts| entry alone, since it indicates the profile has been
715 // previously used. 736 // previously used.
716 MediaGalleriesPreferences* preferences = GetPreferences(profile); 737 MediaGalleriesPreferences* preferences = GetPreferences(profile);
717 preferences->RemoveGalleryChangeObserver(this); 738 preferences->RemoveGalleryChangeObserver(this);
718 } 739 }
719 } 740 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698