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
3 // found in the LICENSE file.
5 #include "content/common/db_message_filter.h"
7 #include "content/common/database_messages.h"
8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDatabase.h"
9 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
11 DBMessageFilter::DBMessageFilter() {
14 bool DBMessageFilter::OnMessageReceived(const IPC::Message
& message
) {
16 IPC_BEGIN_MESSAGE_MAP(DBMessageFilter
, message
)
17 IPC_MESSAGE_HANDLER(DatabaseMsg_UpdateSize
, OnDatabaseUpdateSize
)
18 IPC_MESSAGE_HANDLER(DatabaseMsg_UpdateSpaceAvailable
,
19 OnDatabaseUpdateSpaceAvailable
)
20 IPC_MESSAGE_HANDLER(DatabaseMsg_ResetSpaceAvailable
,
21 OnDatabaseResetSpaceAvailable
)
22 IPC_MESSAGE_HANDLER(DatabaseMsg_CloseImmediately
,
23 OnDatabaseCloseImmediately
)
24 IPC_MESSAGE_UNHANDLED(handled
= false)
29 void DBMessageFilter::OnDatabaseUpdateSize(const string16
& origin_identifier
,
30 const string16
& database_name
,
31 int64 database_size
) {
32 WebKit::WebDatabase::updateDatabaseSize(
33 origin_identifier
, database_name
, database_size
);
36 void DBMessageFilter::OnDatabaseUpdateSpaceAvailable(
37 const string16
& origin_identifier
,
38 int64 space_available
) {
39 WebKit::WebDatabase::updateSpaceAvailable(
40 origin_identifier
, space_available
);
43 void DBMessageFilter::OnDatabaseResetSpaceAvailable(
44 const string16
& origin_identifier
) {
45 WebKit::WebDatabase::resetSpaceAvailable(origin_identifier
);
48 void DBMessageFilter::OnDatabaseCloseImmediately(
49 const string16
& origin_identifier
,
50 const string16
& database_name
) {
51 WebKit::WebDatabase::closeDatabaseImmediately(
52 origin_identifier
, database_name
);