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

Side by Side Diff: chrome/browser/chromeos/arc/fileapi/arc_file_system_service.cc

Issue 2637163002: Defer ARC file system operations while ARC is booting. (Closed)
Patch Set: Addressed hashimoto's comments. Created 3 years, 11 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/chromeos/arc/fileapi/arc_file_system_service.h" 5 #include "chrome/browser/chromeos/arc/fileapi/arc_file_system_service.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_url_util.h " 8 #include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_url_util.h "
9 #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_util.h" 9 #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_util.h"
10 #include "components/arc/arc_bridge_service.h"
11 #include "components/arc/file_system/arc_file_system_observer.h"
12 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
13 #include "storage/browser/fileapi/external_mount_points.h" 11 #include "storage/browser/fileapi/external_mount_points.h"
14 12
15 using content::BrowserThread; 13 using content::BrowserThread;
16 14
17 namespace arc { 15 namespace arc {
18 16
19 // static 17 // static
20 const char ArcFileSystemService::kArcServiceName[] = 18 const char ArcFileSystemService::kArcServiceName[] =
21 "arc::ArcFileSystemService"; 19 "arc::ArcFileSystemService";
22 20
23 ArcFileSystemService::ArcFileSystemService(ArcBridgeService* bridge_service) 21 ArcFileSystemService::ArcFileSystemService(ArcBridgeService* bridge_service)
24 : ArcService(bridge_service) { 22 : ArcService(bridge_service) {
25 DCHECK_CURRENTLY_ON(BrowserThread::UI); 23 DCHECK_CURRENTLY_ON(BrowserThread::UI);
26 24
27 storage::ExternalMountPoints* mount_points = 25 storage::ExternalMountPoints* mount_points =
28 storage::ExternalMountPoints::GetSystemInstance(); 26 storage::ExternalMountPoints::GetSystemInstance();
29 27
30 mount_points->RegisterFileSystem( 28 mount_points->RegisterFileSystem(
31 kContentFileSystemMountPointName, storage::kFileSystemTypeArcContent, 29 kContentFileSystemMountPointName, storage::kFileSystemTypeArcContent,
32 storage::FileSystemMountOption(), 30 storage::FileSystemMountOption(),
33 base::FilePath(kContentFileSystemMountPointPath)); 31 base::FilePath(kContentFileSystemMountPointPath));
34 mount_points->RegisterFileSystem( 32 mount_points->RegisterFileSystem(
35 kDocumentsProviderMountPointName, 33 kDocumentsProviderMountPointName,
36 storage::kFileSystemTypeArcDocumentsProvider, 34 storage::kFileSystemTypeArcDocumentsProvider,
37 storage::FileSystemMountOption(), 35 storage::FileSystemMountOption(),
38 base::FilePath(kDocumentsProviderMountPointPath)); 36 base::FilePath(kDocumentsProviderMountPointPath));
39
40 arc_bridge_service()->file_system()->AddObserver(this);
41 } 37 }
42 38
43 ArcFileSystemService::~ArcFileSystemService() { 39 ArcFileSystemService::~ArcFileSystemService() {
44 DCHECK_CURRENTLY_ON(BrowserThread::UI); 40 DCHECK_CURRENTLY_ON(BrowserThread::UI);
45 41
46 arc_bridge_service()->file_system()->RemoveObserver(this);
47
48 storage::ExternalMountPoints* mount_points = 42 storage::ExternalMountPoints* mount_points =
49 storage::ExternalMountPoints::GetSystemInstance(); 43 storage::ExternalMountPoints::GetSystemInstance();
50 44
51 mount_points->RevokeFileSystem(kContentFileSystemMountPointName); 45 mount_points->RevokeFileSystem(kContentFileSystemMountPointName);
52 mount_points->RevokeFileSystem(kDocumentsProviderMountPointPath); 46 mount_points->RevokeFileSystem(kDocumentsProviderMountPointPath);
53 } 47 }
54 48
55 void ArcFileSystemService::AddObserver(ArcFileSystemObserver* observer) {
56 observer_list_.AddObserver(observer);
57 }
58
59 void ArcFileSystemService::RemoveObserver(ArcFileSystemObserver* observer) {
60 observer_list_.RemoveObserver(observer);
61 }
62
63 void ArcFileSystemService::OnInstanceReady() {
64 for (auto& observer : observer_list_)
65 observer.OnFileSystemsReady();
66 }
67
68 void ArcFileSystemService::OnInstanceClosed() {
69 for (auto& observer : observer_list_)
70 observer.OnFileSystemsClosed();
71 }
72
73 } // namespace arc 49 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/arc/fileapi/arc_file_system_service.h ('k') | chrome/browser/chromeos/file_manager/volume_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698