| 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 std::string url(base::StringPrintf("%s:%s", | 191 std::string url(base::StringPrintf("%s:%s", |
| 192 chrome::kDriveScheme, | 192 chrome::kDriveScheme, |
| 193 path.AsUTF8Unsafe().c_str())); | 193 path.AsUTF8Unsafe().c_str())); |
| 194 return GURL(url); | 194 return GURL(url); |
| 195 } | 195 } |
| 196 | 196 |
| 197 base::FilePath DriveURLToFilePath(const GURL& url) { | 197 base::FilePath DriveURLToFilePath(const GURL& url) { |
| 198 if (!url.is_valid() || url.scheme() != chrome::kDriveScheme) | 198 if (!url.is_valid() || url.scheme() != chrome::kDriveScheme) |
| 199 return base::FilePath(); | 199 return base::FilePath(); |
| 200 std::string path_string = net::UnescapeURLComponent( | 200 std::string path_string = net::UnescapeURLComponent( |
| 201 url.path(), net::UnescapeRule::NORMAL); | 201 url.GetContent(), net::UnescapeRule::NORMAL); |
| 202 return base::FilePath::FromUTF8Unsafe(path_string); | 202 return base::FilePath::FromUTF8Unsafe(path_string); |
| 203 } | 203 } |
| 204 | 204 |
| 205 void MaybeSetDriveURL(Profile* profile, const base::FilePath& path, GURL* url) { | 205 void MaybeSetDriveURL(Profile* profile, const base::FilePath& path, GURL* url) { |
| 206 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 206 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 207 | 207 |
| 208 if (!IsUnderDriveMountPoint(path)) | 208 if (!IsUnderDriveMountPoint(path)) |
| 209 return; | 209 return; |
| 210 | 210 |
| 211 FileSystemInterface* file_system = GetFileSystemByProfile(profile); | 211 FileSystemInterface* file_system = GetFileSystemByProfile(profile); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 // Disable Drive if preference is set. This can happen with commandline flag | 419 // Disable Drive if preference is set. This can happen with commandline flag |
| 420 // --disable-drive or enterprise policy, or with user settings. | 420 // --disable-drive or enterprise policy, or with user settings. |
| 421 if (profile->GetPrefs()->GetBoolean(prefs::kDisableDrive)) | 421 if (profile->GetPrefs()->GetBoolean(prefs::kDisableDrive)) |
| 422 return false; | 422 return false; |
| 423 | 423 |
| 424 return true; | 424 return true; |
| 425 } | 425 } |
| 426 | 426 |
| 427 } // namespace util | 427 } // namespace util |
| 428 } // namespace drive | 428 } // namespace drive |
| OLD | NEW |