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

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

Issue 660343006: Standardize usage of virtual/override/final in chrome/browser/media_galleries (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 void ReferenceFromRVH(const content::RenderViewHost* rvh); 79 void ReferenceFromRVH(const content::RenderViewHost* rvh);
80 80
81 private: 81 private:
82 class RPHWebContentsObserver : public content::WebContentsObserver { 82 class RPHWebContentsObserver : public content::WebContentsObserver {
83 public: 83 public:
84 RPHWebContentsObserver(RPHReferenceManager* manager, 84 RPHWebContentsObserver(RPHReferenceManager* manager,
85 WebContents* web_contents); 85 WebContents* web_contents);
86 86
87 private: 87 private:
88 // content::WebContentsObserver 88 // content::WebContentsObserver
89 virtual void WebContentsDestroyed() override; 89 void WebContentsDestroyed() override;
90 virtual void NavigationEntryCommitted( 90 void NavigationEntryCommitted(
91 const content::LoadCommittedDetails& load_details) override; 91 const content::LoadCommittedDetails& load_details) override;
92 92
93 RPHReferenceManager* manager_; 93 RPHReferenceManager* manager_;
94 }; 94 };
95 95
96 class RPHObserver : public content::RenderProcessHostObserver { 96 class RPHObserver : public content::RenderProcessHostObserver {
97 public: 97 public:
98 RPHObserver(RPHReferenceManager* manager, RenderProcessHost* host); 98 RPHObserver(RPHReferenceManager* manager, RenderProcessHost* host);
99 virtual ~RPHObserver(); 99 ~RPHObserver() override;
100 100
101 void AddWebContentsObserver(WebContents* web_contents); 101 void AddWebContentsObserver(WebContents* web_contents);
102 void RemoveWebContentsObserver(WebContents* web_contents); 102 void RemoveWebContentsObserver(WebContents* web_contents);
103 bool HasWebContentsObservers() { 103 bool HasWebContentsObservers() {
104 return observed_web_contentses_.size() > 0; 104 return observed_web_contentses_.size() > 0;
105 } 105 }
106 106
107 private: 107 private:
108 virtual void RenderProcessHostDestroyed(RenderProcessHost* host) override; 108 void RenderProcessHostDestroyed(RenderProcessHost* host) override;
109 109
110 RPHReferenceManager* manager_; 110 RPHReferenceManager* manager_;
111 RenderProcessHost* host_; 111 RenderProcessHost* host_;
112 typedef std::map<WebContents*, RPHWebContentsObserver*> WCObserverMap; 112 typedef std::map<WebContents*, RPHWebContentsObserver*> WCObserverMap;
113 WCObserverMap observed_web_contentses_; 113 WCObserverMap observed_web_contentses_;
114 }; 114 };
115 typedef std::map<const RenderProcessHost*, RPHObserver*> RPHObserverMap; 115 typedef std::map<const RenderProcessHost*, RPHObserver*> RPHObserverMap;
116 116
117 // Handlers for observed events. 117 // Handlers for observed events.
118 void OnRenderProcessHostDestroyed(RenderProcessHost* rph); 118 void OnRenderProcessHostDestroyed(RenderProcessHost* rph);
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 } 628 }
629 629
630 /****************** 630 /******************
631 * Private methods 631 * Private methods
632 ******************/ 632 ******************/
633 633
634 class MediaFileSystemRegistry::MediaFileSystemContextImpl 634 class MediaFileSystemRegistry::MediaFileSystemContextImpl
635 : public MediaFileSystemContext { 635 : public MediaFileSystemContext {
636 public: 636 public:
637 MediaFileSystemContextImpl() {} 637 MediaFileSystemContextImpl() {}
638 virtual ~MediaFileSystemContextImpl() {} 638 ~MediaFileSystemContextImpl() override {}
639 639
640 virtual bool RegisterFileSystem(const std::string& device_id, 640 bool RegisterFileSystem(const std::string& device_id,
641 const std::string& fs_name, 641 const std::string& fs_name,
642 const base::FilePath& path) override { 642 const base::FilePath& path) override {
643 if (StorageInfo::IsMassStorageDevice(device_id)) { 643 if (StorageInfo::IsMassStorageDevice(device_id)) {
644 return RegisterFileSystemForMassStorage(device_id, fs_name, path); 644 return RegisterFileSystemForMassStorage(device_id, fs_name, path);
645 } else { 645 } else {
646 return RegisterFileSystemForMTPDevice(device_id, fs_name, path); 646 return RegisterFileSystemForMTPDevice(device_id, fs_name, path);
647 } 647 }
648 } 648 }
649 649
650 virtual void RevokeFileSystem(const std::string& fs_name) override { 650 void RevokeFileSystem(const std::string& fs_name) override {
651 ImportedMediaGalleryRegistry* imported_registry = 651 ImportedMediaGalleryRegistry* imported_registry =
652 ImportedMediaGalleryRegistry::GetInstance(); 652 ImportedMediaGalleryRegistry::GetInstance();
653 if (imported_registry->RevokeImportedFilesystemOnUIThread(fs_name)) 653 if (imported_registry->RevokeImportedFilesystemOnUIThread(fs_name))
654 return; 654 return;
655 655
656 ExternalMountPoints::GetSystemInstance()->RevokeFileSystem(fs_name); 656 ExternalMountPoints::GetSystemInstance()->RevokeFileSystem(fs_name);
657 657
658 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( 658 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind(
659 &MTPDeviceMapService::RevokeMTPFileSystem, 659 &MTPDeviceMapService::RevokeMTPFileSystem,
660 base::Unretained(MTPDeviceMapService::GetInstance()), 660 base::Unretained(MTPDeviceMapService::GetInstance()),
661 fs_name)); 661 fs_name));
662 } 662 }
663 663
664 virtual base::FilePath GetRegisteredPath( 664 base::FilePath GetRegisteredPath(const std::string& fs_name) const override {
665 const std::string& fs_name) const override {
666 base::FilePath result; 665 base::FilePath result;
667 if (!ExternalMountPoints::GetSystemInstance()->GetRegisteredPath(fs_name, 666 if (!ExternalMountPoints::GetSystemInstance()->GetRegisteredPath(fs_name,
668 &result)) { 667 &result)) {
669 return base::FilePath(); 668 return base::FilePath();
670 } 669 }
671 return result; 670 return result;
672 } 671 }
673 672
674 private: 673 private:
675 // Registers and returns the file system id for the mass storage device 674 // Registers and returns the file system id for the mass storage device
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 DCHECK_EQ(1U, erase_count); 839 DCHECK_EQ(1U, erase_count);
841 if (extension_hosts->second.empty()) { 840 if (extension_hosts->second.empty()) {
842 // When a profile has no ExtensionGalleriesHosts left, remove the 841 // When a profile has no ExtensionGalleriesHosts left, remove the
843 // matching gallery-change-watcher since it is no longer needed. Leave the 842 // matching gallery-change-watcher since it is no longer needed. Leave the
844 // |extension_hosts| entry alone, since it indicates the profile has been 843 // |extension_hosts| entry alone, since it indicates the profile has been
845 // previously used. 844 // previously used.
846 MediaGalleriesPreferences* preferences = GetPreferences(profile); 845 MediaGalleriesPreferences* preferences = GetPreferences(profile);
847 preferences->RemoveGalleryChangeObserver(this); 846 preferences->RemoveGalleryChangeObserver(this);
848 } 847 }
849 } 848 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698