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

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: Address review comments and adds tests Created 6 years 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 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 if (origin_database_) { 897 if (origin_database_) {
898 origin_database_->RemovePathForOrigin( 898 origin_database_->RemovePathForOrigin(
899 storage::GetIdentifierFromOrigin(origin)); 899 storage::GetIdentifierFromOrigin(origin));
900 } 900 }
901 if (!base::DeleteFile(origin_path, true /* recursive */)) 901 if (!base::DeleteFile(origin_path, true /* recursive */))
902 return false; 902 return false;
903 903
904 return true; 904 return true;
905 } 905 }
906 906
907 void ObfuscatedFileUtil::CloseFileSystemForOriginAndType(
908 const GURL& origin,
909 const std::string& type_string) {
910 std::string key = GetDirectoryDatabaseKey(origin, type_string);
911 if (key.empty())
912 return;
913 DirectoryMap::iterator iter = directories_.find(key);
914 if (iter == directories_.end())
915 return;
916 scoped_ptr<SandboxDirectoryDatabase> database(iter->second);
917 directories_.erase(iter);
918 }
919
907 ObfuscatedFileUtil::AbstractOriginEnumerator* 920 ObfuscatedFileUtil::AbstractOriginEnumerator*
908 ObfuscatedFileUtil::CreateOriginEnumerator() { 921 ObfuscatedFileUtil::CreateOriginEnumerator() {
909 std::vector<SandboxOriginDatabase::OriginRecord> origins; 922 std::vector<SandboxOriginDatabase::OriginRecord> origins;
910 923
911 InitOriginDatabase(GURL(), false); 924 InitOriginDatabase(GURL(), false);
912 return new ObfuscatedOriginEnumerator( 925 return new ObfuscatedOriginEnumerator(
913 origin_database_.get(), file_system_directory_); 926 origin_database_.get(), file_system_directory_);
914 } 927 }
915 928
916 bool ObfuscatedFileUtil::DestroyDirectoryDatabase( 929 bool ObfuscatedFileUtil::DestroyDirectoryDatabase(
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 } 1419 }
1407 return file.Pass(); 1420 return file.Pass();
1408 } 1421 }
1409 1422
1410 bool ObfuscatedFileUtil::HasIsolatedStorage(const GURL& origin) { 1423 bool ObfuscatedFileUtil::HasIsolatedStorage(const GURL& origin) {
1411 return special_storage_policy_.get() && 1424 return special_storage_policy_.get() &&
1412 special_storage_policy_->HasIsolatedStorage(origin); 1425 special_storage_policy_->HasIsolatedStorage(origin);
1413 } 1426 }
1414 1427
1415 } // namespace storage 1428 } // namespace storage
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698