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

Side by Side Diff: chrome/browser/media_galleries/fileapi/media_file_system_backend.cc

Issue 1220963005: Update base::StartsWith calls to new form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@starts_with
Patch Set: Created 5 years, 5 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/fileapi/media_file_system_backend.h" 5 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 ExtensionService* extension_service = 87 ExtensionService* extension_service =
88 extensions::ExtensionSystem::Get(profile)->extension_service(); 88 extensions::ExtensionSystem::Get(profile)->extension_service();
89 const extensions::Extension* extension = 89 const extensions::Extension* extension =
90 extension_service->GetExtensionById(storage_domain, 90 extension_service->GetExtensionById(storage_domain,
91 false /*include disabled*/); 91 false /*include disabled*/);
92 std::string expected_mount_prefix = 92 std::string expected_mount_prefix =
93 MediaFileSystemBackend::ConstructMountName( 93 MediaFileSystemBackend::ConstructMountName(
94 profile->GetPath(), storage_domain, kInvalidMediaGalleryPrefId); 94 profile->GetPath(), storage_domain, kInvalidMediaGalleryPrefId);
95 MediaGalleryPrefId pref_id = kInvalidMediaGalleryPrefId; 95 MediaGalleryPrefId pref_id = kInvalidMediaGalleryPrefId;
96 if (extension && extension->id() == storage_domain && 96 if (extension && extension->id() == storage_domain &&
97 base::StartsWithASCII(mount_point, expected_mount_prefix, true) && 97 base::StartsWith(mount_point, expected_mount_prefix,
98 base::CompareCase::SENSITIVE) &&
98 base::StringToUint64(mount_point.substr(expected_mount_prefix.size()), 99 base::StringToUint64(mount_point.substr(expected_mount_prefix.size()),
99 &pref_id) && 100 &pref_id) &&
100 pref_id != kInvalidMediaGalleryPrefId) { 101 pref_id != kInvalidMediaGalleryPrefId) {
101 MediaGalleriesPreferences* preferences = 102 MediaGalleriesPreferences* preferences =
102 g_browser_process->media_file_system_registry()->GetPreferences( 103 g_browser_process->media_file_system_registry()->GetPreferences(
103 profile); 104 profile);
104 preferences->EnsureInitialized( 105 preferences->EnsureInitialized(
105 base::Bind(&OnPreferencesInit, rvh, extension, pref_id, callback)); 106 base::Bind(&OnPreferencesInit, rvh, extension, pref_id, callback));
106 return; 107 return;
107 } 108 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 } 192 }
192 193
193 const base::FilePath& virtual_path = filesystem_url.path(); 194 const base::FilePath& virtual_path = filesystem_url.path();
194 if (virtual_path.ReferencesParent()) 195 if (virtual_path.ReferencesParent())
195 return false; 196 return false;
196 std::vector<base::FilePath::StringType> components; 197 std::vector<base::FilePath::StringType> components;
197 virtual_path.GetComponents(&components); 198 virtual_path.GetComponents(&components);
198 if (components.empty()) 199 if (components.empty())
199 return false; 200 return false;
200 std::string mount_point = base::FilePath(components[0]).AsUTF8Unsafe(); 201 std::string mount_point = base::FilePath(components[0]).AsUTF8Unsafe();
201 if (!base::StartsWithASCII(mount_point, kMediaGalleryMountPrefix, true)) 202 if (!base::StartsWith(mount_point, kMediaGalleryMountPrefix,
203 base::CompareCase::SENSITIVE))
202 return false; 204 return false;
203 205
204 const content::ResourceRequestInfo* request_info = 206 const content::ResourceRequestInfo* request_info =
205 content::ResourceRequestInfo::ForRequest(url_request); 207 content::ResourceRequestInfo::ForRequest(url_request);
206 if (!request_info) 208 if (!request_info)
207 return false; 209 return false;
208 210
209 content::BrowserThread::PostTask( 211 content::BrowserThread::PostTask(
210 content::BrowserThread::UI, 212 content::BrowserThread::UI,
211 FROM_HERE, 213 FROM_HERE,
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 380
379 const storage::ChangeObserverList* MediaFileSystemBackend::GetChangeObservers( 381 const storage::ChangeObserverList* MediaFileSystemBackend::GetChangeObservers(
380 storage::FileSystemType type) const { 382 storage::FileSystemType type) const {
381 return NULL; 383 return NULL;
382 } 384 }
383 385
384 const storage::AccessObserverList* MediaFileSystemBackend::GetAccessObservers( 386 const storage::AccessObserverList* MediaFileSystemBackend::GetAccessObservers(
385 storage::FileSystemType type) const { 387 storage::FileSystemType type) const {
386 return NULL; 388 return NULL;
387 } 389 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698