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 "webkit/browser/fileapi/obfuscated_file_util.h" | 5 #include "webkit/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 |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/format_macros.h" | 12 #include "base/format_macros.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "base/metrics/histogram.h" |
15 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
16 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
17 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
18 #include "base/strings/sys_string_conversions.h" | 19 #include "base/strings/sys_string_conversions.h" |
19 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
20 #include "base/time/time.h" | 21 #include "base/time/time.h" |
21 #include "url/gurl.h" | 22 #include "url/gurl.h" |
22 #include "webkit/browser/fileapi/file_observers.h" | 23 #include "webkit/browser/fileapi/file_observers.h" |
23 #include "webkit/browser/fileapi/file_system_context.h" | 24 #include "webkit/browser/fileapi/file_system_context.h" |
24 #include "webkit/browser/fileapi/file_system_operation_context.h" | 25 #include "webkit/browser/fileapi/file_system_operation_context.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 void TouchDirectory(SandboxDirectoryDatabase* db, FileId dir_id) { | 93 void TouchDirectory(SandboxDirectoryDatabase* db, FileId dir_id) { |
93 DCHECK(db); | 94 DCHECK(db); |
94 if (!db->UpdateModificationTime(dir_id, base::Time::Now())) | 95 if (!db->UpdateModificationTime(dir_id, base::Time::Now())) |
95 NOTREACHED(); | 96 NOTREACHED(); |
96 } | 97 } |
97 | 98 |
98 const base::FilePath::CharType kTemporaryDirectoryName[] = FILE_PATH_LITERAL("t"
); | 99 const base::FilePath::CharType kTemporaryDirectoryName[] = FILE_PATH_LITERAL("t"
); |
99 const base::FilePath::CharType kPersistentDirectoryName[] = FILE_PATH_LITERAL("p
"); | 100 const base::FilePath::CharType kPersistentDirectoryName[] = FILE_PATH_LITERAL("p
"); |
100 const base::FilePath::CharType kSyncableDirectoryName[] = FILE_PATH_LITERAL("s")
; | 101 const base::FilePath::CharType kSyncableDirectoryName[] = FILE_PATH_LITERAL("s")
; |
101 | 102 |
| 103 enum IsolatedOriginStatus { |
| 104 kIsolatedOriginMatch, |
| 105 kIsolatedOriginDontMatch, |
| 106 kIsolatedOriginStatusMax, |
| 107 }; |
| 108 |
102 } // namespace | 109 } // namespace |
103 | 110 |
104 using base::PlatformFile; | 111 using base::PlatformFile; |
105 using base::PlatformFileError; | 112 using base::PlatformFileError; |
106 | 113 |
107 class ObfuscatedFileEnumerator | 114 class ObfuscatedFileEnumerator |
108 : public FileSystemFileUtil::AbstractFileEnumerator { | 115 : public FileSystemFileUtil::AbstractFileEnumerator { |
109 public: | 116 public: |
110 ObfuscatedFileEnumerator( | 117 ObfuscatedFileEnumerator( |
111 SandboxDirectoryDatabase* db, | 118 SandboxDirectoryDatabase* db, |
(...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1429 return error; | 1436 return error; |
1430 } | 1437 } |
1431 | 1438 |
1432 bool ObfuscatedFileUtil::HasIsolatedStorage(const GURL& origin) { | 1439 bool ObfuscatedFileUtil::HasIsolatedStorage(const GURL& origin) { |
1433 if (special_storage_policy_.get() && | 1440 if (special_storage_policy_.get() && |
1434 special_storage_policy_->HasIsolatedStorage(origin)) { | 1441 special_storage_policy_->HasIsolatedStorage(origin)) { |
1435 if (isolated_origin_.is_empty()) | 1442 if (isolated_origin_.is_empty()) |
1436 isolated_origin_ = origin; | 1443 isolated_origin_ = origin; |
1437 // Record isolated_origin_, but always disable for now. | 1444 // Record isolated_origin_, but always disable for now. |
1438 // crbug.com/264429 | 1445 // crbug.com/264429 |
| 1446 if (isolated_origin_ != origin) { |
| 1447 UMA_HISTOGRAM_ENUMERATION("FileSystem.IsolatedOriginStatus", |
| 1448 kIsolatedOriginDontMatch, |
| 1449 kIsolatedOriginStatusMax); |
| 1450 } else { |
| 1451 UMA_HISTOGRAM_ENUMERATION("FileSystem.IsolatedOriginStatus", |
| 1452 kIsolatedOriginMatch, |
| 1453 kIsolatedOriginStatusMax); |
| 1454 } |
1439 return false; | 1455 return false; |
1440 } | 1456 } |
1441 return false; | 1457 return false; |
1442 } | 1458 } |
1443 | 1459 |
1444 } // namespace fileapi | 1460 } // namespace fileapi |
OLD | NEW |