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

Side by Side Diff: content/child/database_util.cc

Issue 2586483002: Use explicit WebString <-> string16 conversion methods in storage API files (Closed)
Patch Set: '' Created 4 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
« no previous file with comments | « no previous file | content/child/db_message_filter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/child/database_util.h" 5 #include "content/child/database_util.h"
6 6
7 #include "content/common/database_messages.h" 7 #include "content/common/database_messages.h"
8 #include "ipc/ipc_sync_message_filter.h" 8 #include "ipc/ipc_sync_message_filter.h"
9 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 9 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
10 #include "third_party/WebKit/public/platform/WebString.h" 10 #include "third_party/WebKit/public/platform/WebString.h"
11 #include "third_party/sqlite/sqlite3.h" 11 #include "third_party/sqlite/sqlite3.h"
12 12
13 using blink::Platform; 13 using blink::Platform;
14 using blink::WebSecurityOrigin; 14 using blink::WebSecurityOrigin;
15 using blink::WebString; 15 using blink::WebString;
16 16
17 namespace content { 17 namespace content {
18 18
19 Platform::FileHandle DatabaseUtil::DatabaseOpenFile( 19 Platform::FileHandle DatabaseUtil::DatabaseOpenFile(
20 const WebString& vfs_file_name, 20 const WebString& vfs_file_name,
21 int desired_flags, 21 int desired_flags,
22 IPC::SyncMessageFilter* sync_message_filter) { 22 IPC::SyncMessageFilter* sync_message_filter) {
23 IPC::PlatformFileForTransit file_handle = 23 IPC::PlatformFileForTransit file_handle =
24 IPC::InvalidPlatformFileForTransit(); 24 IPC::InvalidPlatformFileForTransit();
25 25
26 sync_message_filter->Send(new DatabaseHostMsg_OpenFile( 26 sync_message_filter->Send(new DatabaseHostMsg_OpenFile(
27 vfs_file_name, desired_flags, &file_handle)); 27 vfs_file_name.utf16(), desired_flags, &file_handle));
28 28
29 return IPC::PlatformFileForTransitToPlatformFile(file_handle); 29 return IPC::PlatformFileForTransitToPlatformFile(file_handle);
30 } 30 }
31 31
32 int DatabaseUtil::DatabaseDeleteFile( 32 int DatabaseUtil::DatabaseDeleteFile(
33 const WebString& vfs_file_name, 33 const WebString& vfs_file_name,
34 bool sync_dir, 34 bool sync_dir,
35 IPC::SyncMessageFilter* sync_message_filter) { 35 IPC::SyncMessageFilter* sync_message_filter) {
36 int rv = SQLITE_IOERR_DELETE; 36 int rv = SQLITE_IOERR_DELETE;
37 sync_message_filter->Send( 37 sync_message_filter->Send(
38 new DatabaseHostMsg_DeleteFile(vfs_file_name, sync_dir, &rv)); 38 new DatabaseHostMsg_DeleteFile(vfs_file_name.utf16(), sync_dir, &rv));
39 return rv; 39 return rv;
40 } 40 }
41 41
42 long DatabaseUtil::DatabaseGetFileAttributes( 42 long DatabaseUtil::DatabaseGetFileAttributes(
43 const WebString& vfs_file_name, 43 const WebString& vfs_file_name,
44 IPC::SyncMessageFilter* sync_message_filter) { 44 IPC::SyncMessageFilter* sync_message_filter) {
45 int32_t rv = -1; 45 int32_t rv = -1;
46 sync_message_filter->Send( 46 sync_message_filter->Send(
47 new DatabaseHostMsg_GetFileAttributes(vfs_file_name, &rv)); 47 new DatabaseHostMsg_GetFileAttributes(vfs_file_name.utf16(), &rv));
48 return rv; 48 return rv;
49 } 49 }
50 50
51 long long DatabaseUtil::DatabaseGetFileSize( 51 long long DatabaseUtil::DatabaseGetFileSize(
52 const WebString& vfs_file_name, 52 const WebString& vfs_file_name,
53 IPC::SyncMessageFilter* sync_message_filter) { 53 IPC::SyncMessageFilter* sync_message_filter) {
54 int64_t rv = 0LL; 54 int64_t rv = 0LL;
55 sync_message_filter->Send( 55 sync_message_filter->Send(
56 new DatabaseHostMsg_GetFileSize(vfs_file_name, &rv)); 56 new DatabaseHostMsg_GetFileSize(vfs_file_name.utf16(), &rv));
57 return rv; 57 return rv;
58 } 58 }
59 59
60 long long DatabaseUtil::DatabaseGetSpaceAvailable( 60 long long DatabaseUtil::DatabaseGetSpaceAvailable(
61 const WebSecurityOrigin& origin, 61 const WebSecurityOrigin& origin,
62 IPC::SyncMessageFilter* sync_message_filter) { 62 IPC::SyncMessageFilter* sync_message_filter) {
63 int64_t rv = 0LL; 63 int64_t rv = 0LL;
64 sync_message_filter->Send(new DatabaseHostMsg_GetSpaceAvailable(origin, &rv)); 64 sync_message_filter->Send(new DatabaseHostMsg_GetSpaceAvailable(origin, &rv));
65 return rv; 65 return rv;
66 } 66 }
67 67
68 bool DatabaseUtil::DatabaseSetFileSize( 68 bool DatabaseUtil::DatabaseSetFileSize(
69 const WebString& vfs_file_name, 69 const WebString& vfs_file_name,
70 int64_t size, 70 int64_t size,
71 IPC::SyncMessageFilter* sync_message_filter) { 71 IPC::SyncMessageFilter* sync_message_filter) {
72 bool rv = false; 72 bool rv = false;
73 sync_message_filter->Send( 73 sync_message_filter->Send(
74 new DatabaseHostMsg_SetFileSize(vfs_file_name, size, &rv)); 74 new DatabaseHostMsg_SetFileSize(vfs_file_name.utf16(), size, &rv));
75 return rv; 75 return rv;
76 } 76 }
77 77
78 } // namespace content 78 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/child/db_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698