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

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

Issue 636093002: Add SandboxPrioritizedOriginDatabase support for dump_file_system (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 2 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
« no previous file with comments | « storage/browser/fileapi/sandbox_prioritized_origin_database.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "storage/browser/fileapi/sandbox_prioritized_origin_database.h" 5 #include "storage/browser/fileapi/sandbox_prioritized_origin_database.h"
6 6
7 #include "base/files/file.h" 7 #include "base/files/file.h"
8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
10 #include "base/logging.h" 9 #include "base/logging.h"
11 #include "base/pickle.h" 10 #include "base/pickle.h"
12 #include "storage/browser/fileapi/sandbox_isolated_origin_database.h" 11 #include "storage/browser/fileapi/sandbox_isolated_origin_database.h"
13 #include "storage/browser/fileapi/sandbox_origin_database.h" 12 #include "storage/browser/fileapi/sandbox_origin_database.h"
14 13
15 namespace storage { 14 namespace storage {
16 15
16 const base::FilePath::CharType*
17 SandboxPrioritizedOriginDatabase::kPrimaryDirectory =
18 FILE_PATH_LITERAL("primary");
19
20 const base::FilePath::CharType*
21 SandboxPrioritizedOriginDatabase::kPrimaryOriginFile =
22 FILE_PATH_LITERAL("primary.origin");
23
17 namespace { 24 namespace {
18 25
19 const base::FilePath::CharType kPrimaryDirectory[] =
20 FILE_PATH_LITERAL("primary");
21 const base::FilePath::CharType kPrimaryOriginFile[] =
22 FILE_PATH_LITERAL("primary.origin");
23
24 bool WritePrimaryOriginFile(const base::FilePath& path, 26 bool WritePrimaryOriginFile(const base::FilePath& path,
25 const std::string& origin) { 27 const std::string& origin) {
26 base::File file(path, base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_WRITE); 28 base::File file(path, base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_WRITE);
27 if (!file.IsValid()) 29 if (!file.IsValid())
28 return false; 30 return false;
29 if (!file.created()) 31 if (!file.created())
30 file.SetLength(0); 32 file.SetLength(0);
31 Pickle pickle; 33 Pickle pickle;
32 pickle.WriteString(origin); 34 pickle.WriteString(origin);
33 file.Write(0, static_cast<const char*>(pickle.data()), pickle.size()); 35 file.Write(0, static_cast<const char*>(pickle.data()), pickle.size());
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 } 216 }
215 } 217 }
216 218
217 SandboxOriginDatabase* 219 SandboxOriginDatabase*
218 SandboxPrioritizedOriginDatabase::GetSandboxOriginDatabase() { 220 SandboxPrioritizedOriginDatabase::GetSandboxOriginDatabase() {
219 MaybeInitializeNonPrimaryDatabase(true); 221 MaybeInitializeNonPrimaryDatabase(true);
220 return origin_database_.get(); 222 return origin_database_.get();
221 } 223 }
222 224
223 } // namespace storage 225 } // namespace storage
OLDNEW
« no previous file with comments | « storage/browser/fileapi/sandbox_prioritized_origin_database.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698