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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/service.cc

Issue 350683002: [fsp] Add notifications in case of slow operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed clang. Created 6 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/file_system_provider/service.h" 5 #include "chrome/browser/chromeos/file_system_provider/service.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/prefs/scoped_user_pref_update.h" 9 #include "base/prefs/scoped_user_pref_update.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
11 #include "chrome/browser/chromeos/file_system_provider/mount_path_util.h" 11 #include "chrome/browser/chromeos/file_system_provider/mount_path_util.h"
12 #include "chrome/browser/chromeos/file_system_provider/observer.h" 12 #include "chrome/browser/chromeos/file_system_provider/observer.h"
13 #include "chrome/browser/chromeos/file_system_provider/provided_file_system.h" 13 #include "chrome/browser/chromeos/file_system_provider/provided_file_system.h"
14 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info .h" 14 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info .h"
15 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte rface.h" 15 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte rface.h"
16 #include "chrome/browser/chromeos/file_system_provider/service_factory.h" 16 #include "chrome/browser/chromeos/file_system_provider/service_factory.h"
17 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
18 #include "components/pref_registry/pref_registry_syncable.h" 18 #include "components/pref_registry/pref_registry_syncable.h"
19 #include "extensions/browser/event_router.h"
20 #include "extensions/browser/extension_registry.h" 19 #include "extensions/browser/extension_registry.h"
21 #include "extensions/browser/extension_system.h" 20 #include "extensions/browser/extension_system.h"
22 #include "webkit/browser/fileapi/external_mount_points.h" 21 #include "webkit/browser/fileapi/external_mount_points.h"
23 22
24 namespace chromeos { 23 namespace chromeos {
25 namespace file_system_provider { 24 namespace file_system_provider {
26 namespace { 25 namespace {
27 26
28 // Maximum number of file systems to be mounted in the same time, per profile. 27 // Maximum number of file systems to be mounted in the same time, per profile.
29 const size_t kMaxFileSystems = 16; 28 const size_t kMaxFileSystems = 16;
30 29
31 // Default factory for provided file systems. The |event_router| must not be 30 // Default factory for provided file systems. |profile| must not be NULL.
32 // NULL.
33 ProvidedFileSystemInterface* CreateProvidedFileSystem( 31 ProvidedFileSystemInterface* CreateProvidedFileSystem(
34 extensions::EventRouter* event_router, 32 Profile* profile,
35 const ProvidedFileSystemInfo& file_system_info) { 33 const ProvidedFileSystemInfo& file_system_info) {
36 DCHECK(event_router); 34 DCHECK(profile);
37 return new ProvidedFileSystem(event_router, file_system_info); 35 return new ProvidedFileSystem(profile, file_system_info);
38 } 36 }
39 37
40 } // namespace 38 } // namespace
41 39
42 const char kPrefKeyFileSystemId[] = "file-system-id"; 40 const char kPrefKeyFileSystemId[] = "file-system-id";
43 const char kPrefKeyFileSystemName[] = "file-system-name"; 41 const char kPrefKeyFileSystemName[] = "file-system-name";
44 42
45 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { 43 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
46 registry->RegisterDictionaryPref( 44 registry->RegisterDictionaryPref(
47 prefs::kFileSystemProviderMounted, 45 prefs::kFileSystemProviderMounted,
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 143
146 // Store the file system descriptor. Use the mount point name as the file 144 // Store the file system descriptor. Use the mount point name as the file
147 // system provider file system id. 145 // system provider file system id.
148 // Examples: 146 // Examples:
149 // file_system_id = 41 147 // file_system_id = 41
150 // mount_point_name = b33f1337-41-5aa5 148 // mount_point_name = b33f1337-41-5aa5
151 // mount_path = /provided/b33f1337-41-5aa5 149 // mount_path = /provided/b33f1337-41-5aa5
152 ProvidedFileSystemInfo file_system_info( 150 ProvidedFileSystemInfo file_system_info(
153 extension_id, file_system_id, file_system_name, mount_path); 151 extension_id, file_system_id, file_system_name, mount_path);
154 152
155 // The event router may be NULL for unit tests.
156 extensions::EventRouter* router = extensions::EventRouter::Get(profile_);
157
158 ProvidedFileSystemInterface* file_system = 153 ProvidedFileSystemInterface* file_system =
159 file_system_factory_.Run(router, file_system_info); 154 file_system_factory_.Run(profile_, file_system_info);
160 DCHECK(file_system); 155 DCHECK(file_system);
161 file_system_map_[FileSystemKey(extension_id, file_system_id)] = file_system; 156 file_system_map_[FileSystemKey(extension_id, file_system_id)] = file_system;
162 mount_point_name_to_key_map_[mount_point_name] = 157 mount_point_name_to_key_map_[mount_point_name] =
163 FileSystemKey(extension_id, file_system_id); 158 FileSystemKey(extension_id, file_system_id);
164 159
165 FOR_EACH_OBSERVER( 160 FOR_EACH_OBSERVER(
166 Observer, 161 Observer,
167 observers_, 162 observers_,
168 OnProvidedFileSystemMount(file_system_info, base::File::FILE_OK)); 163 OnProvidedFileSystemMount(file_system_info, base::File::FILE_OK));
169 164
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 if (!result) { 388 if (!result) {
394 LOG(ERROR) << "Failed to restore a provided file system from " 389 LOG(ERROR) << "Failed to restore a provided file system from "
395 << "preferences: " << extension_id << ", " << file_system_id 390 << "preferences: " << extension_id << ", " << file_system_id
396 << ", " << file_system_name << "."; 391 << ", " << file_system_name << ".";
397 } 392 }
398 } 393 }
399 } 394 }
400 395
401 } // namespace file_system_provider 396 } // namespace file_system_provider
402 } // namespace chromeos 397 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/file_system_provider/service.h ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698