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

Side by Side Diff: storage/browser/fileapi/obfuscated_file_util.cc

Issue 671873004: Migrates legacy packaged app data when it's upgraded to a platform app (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses cmumford comments Created 5 years, 11 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) 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 "storage/browser/fileapi/obfuscated_file_util.h" 5 #include "storage/browser/fileapi/obfuscated_file_util.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 891
892 // No other directories seem exist. Try deleting the entire origin directory. 892 // No other directories seem exist. Try deleting the entire origin directory.
893 InitOriginDatabase(origin, false); 893 InitOriginDatabase(origin, false);
894 if (origin_database_) { 894 if (origin_database_) {
895 origin_database_->RemovePathForOrigin( 895 origin_database_->RemovePathForOrigin(
896 storage::GetIdentifierFromOrigin(origin)); 896 storage::GetIdentifierFromOrigin(origin));
897 } 897 }
898 return base::DeleteFile(origin_path, true /* recursive */); 898 return base::DeleteFile(origin_path, true /* recursive */);
899 } 899 }
900 900
901 void ObfuscatedFileUtil::CloseFileSystemForOriginAndType(
902 const GURL& origin,
903 const std::string& type_string) {
904 const std::string key_prefix = GetDirectoryDatabaseKey(origin, type_string);
905 for (DirectoryMap::iterator iter = directories_.lower_bound(key_prefix);
906 iter != directories_.end();) {
907 if (!StartsWithASCII(iter->first, key_prefix, true))
908 break;
909 DCHECK(type_string.empty() || iter->first == key_prefix);
910 scoped_ptr<SandboxDirectoryDatabase> database(iter->second);
911 directories_.erase(iter++);
912 }
913 }
914
901 ObfuscatedFileUtil::AbstractOriginEnumerator* 915 ObfuscatedFileUtil::AbstractOriginEnumerator*
902 ObfuscatedFileUtil::CreateOriginEnumerator() { 916 ObfuscatedFileUtil::CreateOriginEnumerator() {
903 std::vector<SandboxOriginDatabase::OriginRecord> origins; 917 std::vector<SandboxOriginDatabase::OriginRecord> origins;
904 918
905 InitOriginDatabase(GURL(), false); 919 InitOriginDatabase(GURL(), false);
906 return new ObfuscatedOriginEnumerator( 920 return new ObfuscatedOriginEnumerator(
907 origin_database_.get(), file_system_directory_); 921 origin_database_.get(), file_system_directory_);
908 } 922 }
909 923
910 void ObfuscatedFileUtil::DestroyDirectoryDatabase( 924 void ObfuscatedFileUtil::DestroyDirectoryDatabase(
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1402 } 1416 }
1403 return file.Pass(); 1417 return file.Pass();
1404 } 1418 }
1405 1419
1406 bool ObfuscatedFileUtil::HasIsolatedStorage(const GURL& origin) { 1420 bool ObfuscatedFileUtil::HasIsolatedStorage(const GURL& origin) {
1407 return special_storage_policy_.get() && 1421 return special_storage_policy_.get() &&
1408 special_storage_policy_->HasIsolatedStorage(origin); 1422 special_storage_policy_->HasIsolatedStorage(origin);
1409 } 1423 }
1410 1424
1411 } // namespace storage 1425 } // namespace storage
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698