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

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

Issue 12208079: Move TransientDeviceId from MediFileSystemRegistry to RemovableStorageNotifications. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 7 years, 10 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 // MediaFileSystemRegistry implementation. 5 // MediaFileSystemRegistry implementation.
6 6
7 #include "chrome/browser/media_gallery/media_file_system_registry.h" 7 #include "chrome/browser/media_gallery/media_file_system_registry.h"
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 11 matching lines...) Expand all
22 #include "base/values.h" 22 #include "base/values.h"
23 #include "chrome/browser/extensions/extension_service.h" 23 #include "chrome/browser/extensions/extension_service.h"
24 #include "chrome/browser/extensions/extension_system.h" 24 #include "chrome/browser/extensions/extension_system.h"
25 #include "chrome/browser/media_gallery/media_file_system_context.h" 25 #include "chrome/browser/media_gallery/media_file_system_context.h"
26 #include "chrome/browser/media_gallery/media_galleries_preferences_factory.h" 26 #include "chrome/browser/media_gallery/media_galleries_preferences_factory.h"
27 #include "chrome/browser/media_gallery/scoped_mtp_device_map_entry.h" 27 #include "chrome/browser/media_gallery/scoped_mtp_device_map_entry.h"
28 #include "chrome/browser/prefs/pref_service.h" 28 #include "chrome/browser/prefs/pref_service.h"
29 #include "chrome/browser/profiles/profile.h" 29 #include "chrome/browser/profiles/profile.h"
30 #include "chrome/browser/system_monitor/media_storage_util.h" 30 #include "chrome/browser/system_monitor/media_storage_util.h"
31 #include "chrome/browser/system_monitor/removable_storage_notifications.h" 31 #include "chrome/browser/system_monitor/removable_storage_notifications.h"
32 #include "chrome/browser/system_monitor/transient_device_ids.h"
32 #include "chrome/common/chrome_notification_types.h" 33 #include "chrome/common/chrome_notification_types.h"
33 #include "chrome/common/chrome_paths.h" 34 #include "chrome/common/chrome_paths.h"
34 #include "chrome/common/chrome_switches.h" 35 #include "chrome/common/chrome_switches.h"
35 #include "chrome/common/extensions/extension_constants.h" 36 #include "chrome/common/extensions/extension_constants.h"
36 #include "chrome/common/extensions/extension_set.h" 37 #include "chrome/common/extensions/extension_set.h"
37 #include "chrome/common/extensions/extension.h" 38 #include "chrome/common/extensions/extension.h"
38 #include "chrome/common/pref_names.h" 39 #include "chrome/common/pref_names.h"
39 #include "content/public/browser/browser_thread.h" 40 #include "content/public/browser/browser_thread.h"
40 #include "content/public/browser/notification_details.h" 41 #include "content/public/browser/notification_details.h"
41 #include "content/public/browser/notification_observer.h" 42 #include "content/public/browser/notification_observer.h"
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 } else { 395 } else {
395 RevokeOldGalleries(new_galleries); 396 RevokeOldGalleries(new_galleries);
396 } 397 }
397 398
398 callback.Run(result); 399 callback.Run(result);
399 } 400 }
400 401
401 uint64 GetTransientIdForRemovableDeviceId(const std::string& device_id) { 402 uint64 GetTransientIdForRemovableDeviceId(const std::string& device_id) {
402 if (!MediaStorageUtil::IsRemovableDevice(device_id)) 403 if (!MediaStorageUtil::IsRemovableDevice(device_id))
403 return 0; 404 return 0;
404 MediaFileSystemRegistry* registry = 405 TransientDeviceIds* transient_ids =
405 file_system_context_->GetMediaFileSystemRegistry(); 406 RemovableStorageNotifications::GetInstance()->transient_device_ids();
406 return registry->GetTransientIdForDeviceId(device_id); 407 return transient_ids->GetTransientIdForDeviceId(device_id);
407 } 408 }
408 409
409 // This code is deprecated and should be removed. See http://crbug.com/170138 410 // This code is deprecated and should be removed. See http://crbug.com/170138
410 // Make a JSON string out of |name|, |pref_id| and |device_id|. The IDs makes 411 // Make a JSON string out of |name|, |pref_id| and |device_id|. The IDs makes
411 // the combined name unique. The JSON string should not contain any slashes. 412 // the combined name unique. The JSON string should not contain any slashes.
412 std::string MakeJSONFileSystemName(const string16& name, 413 std::string MakeJSONFileSystemName(const string16& name,
413 const MediaGalleryPrefId& pref_id, 414 const MediaGalleryPrefId& pref_id,
414 const std::string& device_id) { 415 const std::string& device_id) {
415 string16 sanitized_name; 416 string16 sanitized_name;
416 string16 separators = 417 string16 separators =
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 (*extension_host_it)->RevokeGalleryByPrefId(*pref_id_it); 622 (*extension_host_it)->RevokeGalleryByPrefId(*pref_id_it);
622 } 623 }
623 } 624 }
624 } 625 }
625 } 626 }
626 627
627 size_t MediaFileSystemRegistry::GetExtensionHostCountForTests() const { 628 size_t MediaFileSystemRegistry::GetExtensionHostCountForTests() const {
628 return extension_hosts_map_.size(); 629 return extension_hosts_map_.size();
629 } 630 }
630 631
631 uint64 MediaFileSystemRegistry::GetTransientIdForDeviceId(
632 const std::string& device_id) {
633 return transient_device_ids_.GetTransientIdForDeviceId(device_id);
634 }
635
636 /****************** 632 /******************
637 * Private methods 633 * Private methods
638 ******************/ 634 ******************/
639 635
640 class MediaFileSystemRegistry::MediaFileSystemContextImpl 636 class MediaFileSystemRegistry::MediaFileSystemContextImpl
641 : public MediaFileSystemContext { 637 : public MediaFileSystemContext {
642 public: 638 public:
643 explicit MediaFileSystemContextImpl(MediaFileSystemRegistry* registry) 639 explicit MediaFileSystemContextImpl(MediaFileSystemRegistry* registry)
644 : registry_(registry) { 640 : registry_(registry) {
645 DCHECK(registry_); // Suppresses unused warning on Android. 641 DCHECK(registry_); // Suppresses unused warning on Android.
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 803
808 PrefChangeRegistrarMap::iterator pref_it = 804 PrefChangeRegistrarMap::iterator pref_it =
809 pref_change_registrar_map_.find(profile); 805 pref_change_registrar_map_.find(profile);
810 DCHECK(pref_it != pref_change_registrar_map_.end()); 806 DCHECK(pref_it != pref_change_registrar_map_.end());
811 delete pref_it->second; 807 delete pref_it->second;
812 pref_change_registrar_map_.erase(pref_it); 808 pref_change_registrar_map_.erase(pref_it);
813 } 809 }
814 } 810 }
815 811
816 } // namespace chrome 812 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698