OLD | NEW |
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/chromeos/drive/file_system_util.h" | 5 #include "chrome/browser/chromeos/drive/file_system_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 std::string url(base::StringPrintf("%s:%s", | 205 std::string url(base::StringPrintf("%s:%s", |
206 chrome::kDriveScheme, | 206 chrome::kDriveScheme, |
207 path.AsUTF8Unsafe().c_str())); | 207 path.AsUTF8Unsafe().c_str())); |
208 return GURL(url); | 208 return GURL(url); |
209 } | 209 } |
210 | 210 |
211 base::FilePath DriveURLToFilePath(const GURL& url) { | 211 base::FilePath DriveURLToFilePath(const GURL& url) { |
212 if (!url.is_valid() || url.scheme() != chrome::kDriveScheme) | 212 if (!url.is_valid() || url.scheme() != chrome::kDriveScheme) |
213 return base::FilePath(); | 213 return base::FilePath(); |
214 std::string path_string = net::UnescapeURLComponent( | 214 std::string path_string = net::UnescapeURLComponent( |
215 url.path(), net::UnescapeRule::NORMAL); | 215 url.GetContent(), net::UnescapeRule::NORMAL); |
216 return base::FilePath::FromUTF8Unsafe(path_string); | 216 return base::FilePath::FromUTF8Unsafe(path_string); |
217 } | 217 } |
218 | 218 |
219 void MaybeSetDriveURL(Profile* profile, const base::FilePath& path, GURL* url) { | 219 void MaybeSetDriveURL(Profile* profile, const base::FilePath& path, GURL* url) { |
220 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 220 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
221 | 221 |
222 if (!IsUnderDriveMountPoint(path)) | 222 if (!IsUnderDriveMountPoint(path)) |
223 return; | 223 return; |
224 | 224 |
225 FileSystemInterface* file_system = GetFileSystemByProfile(profile); | 225 FileSystemInterface* file_system = GetFileSystemByProfile(profile); |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 // Disable Drive if preference is set. This can happen with commandline flag | 454 // Disable Drive if preference is set. This can happen with commandline flag |
455 // --disable-drive or enterprise policy, or with user settings. | 455 // --disable-drive or enterprise policy, or with user settings. |
456 if (profile->GetPrefs()->GetBoolean(prefs::kDisableDrive)) | 456 if (profile->GetPrefs()->GetBoolean(prefs::kDisableDrive)) |
457 return false; | 457 return false; |
458 | 458 |
459 return true; | 459 return true; |
460 } | 460 } |
461 | 461 |
462 } // namespace util | 462 } // namespace util |
463 } // namespace drive | 463 } // namespace drive |
OLD | NEW |