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 "content/browser/renderer_host/database_message_filter.h" | 5 #include "content/browser/renderer_host/database_message_filter.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 *thread = BrowserThread::FILE; | 80 *thread = BrowserThread::FILE; |
81 | 81 |
82 if (message.type() == DatabaseHostMsg_Opened::ID && !observer_added_) { | 82 if (message.type() == DatabaseHostMsg_Opened::ID && !observer_added_) { |
83 observer_added_ = true; | 83 observer_added_ = true; |
84 BrowserThread::PostTask( | 84 BrowserThread::PostTask( |
85 BrowserThread::FILE, FROM_HERE, | 85 BrowserThread::FILE, FROM_HERE, |
86 base::Bind(&DatabaseMessageFilter::AddObserver, this)); | 86 base::Bind(&DatabaseMessageFilter::AddObserver, this)); |
87 } | 87 } |
88 } | 88 } |
89 | 89 |
90 bool DatabaseMessageFilter::OnMessageReceived( | 90 bool DatabaseMessageFilter::OnMessageReceived(const IPC::Message& message) { |
91 const IPC::Message& message, | |
92 bool* message_was_ok) { | |
93 bool handled = true; | 91 bool handled = true; |
94 IPC_BEGIN_MESSAGE_MAP_EX(DatabaseMessageFilter, message, *message_was_ok) | 92 IPC_BEGIN_MESSAGE_MAP(DatabaseMessageFilter, message) |
95 IPC_MESSAGE_HANDLER_DELAY_REPLY(DatabaseHostMsg_OpenFile, | 93 IPC_MESSAGE_HANDLER_DELAY_REPLY(DatabaseHostMsg_OpenFile, |
96 OnDatabaseOpenFile) | 94 OnDatabaseOpenFile) |
97 IPC_MESSAGE_HANDLER_DELAY_REPLY(DatabaseHostMsg_DeleteFile, | 95 IPC_MESSAGE_HANDLER_DELAY_REPLY(DatabaseHostMsg_DeleteFile, |
98 OnDatabaseDeleteFile) | 96 OnDatabaseDeleteFile) |
99 IPC_MESSAGE_HANDLER_DELAY_REPLY(DatabaseHostMsg_GetFileAttributes, | 97 IPC_MESSAGE_HANDLER_DELAY_REPLY(DatabaseHostMsg_GetFileAttributes, |
100 OnDatabaseGetFileAttributes) | 98 OnDatabaseGetFileAttributes) |
101 IPC_MESSAGE_HANDLER_DELAY_REPLY(DatabaseHostMsg_GetFileSize, | 99 IPC_MESSAGE_HANDLER_DELAY_REPLY(DatabaseHostMsg_GetFileSize, |
102 OnDatabaseGetFileSize) | 100 OnDatabaseGetFileSize) |
103 IPC_MESSAGE_HANDLER_DELAY_REPLY(DatabaseHostMsg_GetSpaceAvailable, | 101 IPC_MESSAGE_HANDLER_DELAY_REPLY(DatabaseHostMsg_GetSpaceAvailable, |
104 OnDatabaseGetSpaceAvailable) | 102 OnDatabaseGetSpaceAvailable) |
105 IPC_MESSAGE_HANDLER(DatabaseHostMsg_Opened, OnDatabaseOpened) | 103 IPC_MESSAGE_HANDLER(DatabaseHostMsg_Opened, OnDatabaseOpened) |
106 IPC_MESSAGE_HANDLER(DatabaseHostMsg_Modified, OnDatabaseModified) | 104 IPC_MESSAGE_HANDLER(DatabaseHostMsg_Modified, OnDatabaseModified) |
107 IPC_MESSAGE_HANDLER(DatabaseHostMsg_Closed, OnDatabaseClosed) | 105 IPC_MESSAGE_HANDLER(DatabaseHostMsg_Closed, OnDatabaseClosed) |
108 IPC_MESSAGE_HANDLER(DatabaseHostMsg_HandleSqliteError, OnHandleSqliteError) | 106 IPC_MESSAGE_HANDLER(DatabaseHostMsg_HandleSqliteError, OnHandleSqliteError) |
109 IPC_MESSAGE_UNHANDLED(handled = false) | 107 IPC_MESSAGE_UNHANDLED(handled = false) |
110 IPC_END_MESSAGE_MAP_EX() | 108 IPC_END_MESSAGE_MAP() |
111 return handled; | 109 return handled; |
112 } | 110 } |
113 | 111 |
114 DatabaseMessageFilter::~DatabaseMessageFilter() { | 112 DatabaseMessageFilter::~DatabaseMessageFilter() { |
115 } | 113 } |
116 | 114 |
117 void DatabaseMessageFilter::OnDatabaseOpenFile( | 115 void DatabaseMessageFilter::OnDatabaseOpenFile( |
118 const base::string16& vfs_file_name, | 116 const base::string16& vfs_file_name, |
119 int desired_flags, | 117 int desired_flags, |
120 IPC::Message* reply_msg) { | 118 IPC::Message* reply_msg) { |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 } | 361 } |
364 | 362 |
365 void DatabaseMessageFilter::OnDatabaseScheduledForDeletion( | 363 void DatabaseMessageFilter::OnDatabaseScheduledForDeletion( |
366 const std::string& origin_identifier, | 364 const std::string& origin_identifier, |
367 const base::string16& database_name) { | 365 const base::string16& database_name) { |
368 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 366 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
369 Send(new DatabaseMsg_CloseImmediately(origin_identifier, database_name)); | 367 Send(new DatabaseMsg_CloseImmediately(origin_identifier, database_name)); |
370 } | 368 } |
371 | 369 |
372 } // namespace content | 370 } // namespace content |
OLD | NEW |