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

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

Issue 23727009: Cleanup: Remove chrome namespace for storage monitor and media galleries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nit Created 7 years, 3 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_galleries_preferences.h" 5 #include "chrome/browser/media_galleries/media_galleries_preferences.h"
6 6
7 #include "base/i18n/time_formatting.h" 7 #include "base/i18n/time_formatting.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 20 matching lines...) Expand all
31 #include "chrome/common/pref_names.h" 31 #include "chrome/common/pref_names.h"
32 #include "components/user_prefs/pref_registry_syncable.h" 32 #include "components/user_prefs/pref_registry_syncable.h"
33 #include "grit/generated_resources.h" 33 #include "grit/generated_resources.h"
34 #include "ui/base/l10n/l10n_util.h" 34 #include "ui/base/l10n/l10n_util.h"
35 #include "ui/base/text/bytes_formatting.h" 35 #include "ui/base/text/bytes_formatting.h"
36 36
37 using base::DictionaryValue; 37 using base::DictionaryValue;
38 using base::ListValue; 38 using base::ListValue;
39 using extensions::ExtensionPrefs; 39 using extensions::ExtensionPrefs;
40 40
41 namespace chrome {
42
43 namespace { 41 namespace {
44 42
45 // Pref key for the list of media gallery permissions. 43 // Pref key for the list of media gallery permissions.
46 const char kMediaGalleriesPermissions[] = "media_galleries_permissions"; 44 const char kMediaGalleriesPermissions[] = "media_galleries_permissions";
47 // Pref key for Media Gallery ID. 45 // Pref key for Media Gallery ID.
48 const char kMediaGalleryIdKey[] = "id"; 46 const char kMediaGalleryIdKey[] = "id";
49 // Pref key for Media Gallery Permission Value. 47 // Pref key for Media Gallery Permission Value.
50 const char kMediaGalleryHasPermissionKey[] = "has_permission"; 48 const char kMediaGalleryHasPermissionKey[] = "has_permission";
51 49
52 const char kMediaGalleriesDeviceIdKey[] = "deviceId"; 50 const char kMediaGalleriesDeviceIdKey[] = "deviceId";
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 StorageMonitor::GetInstance()->RemoveObserver(this); 358 StorageMonitor::GetInstance()->RemoveObserver(this);
361 } 359 }
362 360
363 void MediaGalleriesPreferences::AddDefaultGalleriesIfFreshProfile() { 361 void MediaGalleriesPreferences::AddDefaultGalleriesIfFreshProfile() {
364 // Only add defaults the first time. 362 // Only add defaults the first time.
365 if (APIHasBeenUsed(profile_)) 363 if (APIHasBeenUsed(profile_))
366 return; 364 return;
367 365
368 // Fresh profile case. 366 // Fresh profile case.
369 const int kDirectoryKeys[] = { 367 const int kDirectoryKeys[] = {
370 DIR_USER_MUSIC, 368 chrome::DIR_USER_MUSIC,
371 DIR_USER_PICTURES, 369 chrome::DIR_USER_PICTURES,
372 DIR_USER_VIDEOS, 370 chrome::DIR_USER_VIDEOS,
373 }; 371 };
374 372
375 for (size_t i = 0; i < arraysize(kDirectoryKeys); ++i) { 373 for (size_t i = 0; i < arraysize(kDirectoryKeys); ++i) {
376 base::FilePath path; 374 base::FilePath path;
377 if (!PathService::Get(kDirectoryKeys[i], &path)) 375 if (!PathService::Get(kDirectoryKeys[i], &path))
378 continue; 376 continue;
379 377
380 base::FilePath relative_path; 378 base::FilePath relative_path;
381 StorageInfo info; 379 StorageInfo info;
382 if (MediaStorageUtil::GetDeviceInfoFromPath(path, &info, &relative_path)) { 380 if (MediaStorageUtil::GetDeviceInfoFromPath(path, &info, &relative_path)) {
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 ExtensionPrefs* MediaGalleriesPreferences::GetExtensionPrefs() const { 938 ExtensionPrefs* MediaGalleriesPreferences::GetExtensionPrefs() const {
941 if (extension_prefs_for_testing_) 939 if (extension_prefs_for_testing_)
942 return extension_prefs_for_testing_; 940 return extension_prefs_for_testing_;
943 return extensions::ExtensionPrefs::Get(profile_); 941 return extensions::ExtensionPrefs::Get(profile_);
944 } 942 }
945 943
946 void MediaGalleriesPreferences::SetExtensionPrefsForTesting( 944 void MediaGalleriesPreferences::SetExtensionPrefsForTesting(
947 extensions::ExtensionPrefs* extension_prefs) { 945 extensions::ExtensionPrefs* extension_prefs) {
948 extension_prefs_for_testing_ = extension_prefs; 946 extension_prefs_for_testing_ = extension_prefs;
949 } 947 }
950
951 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698