Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / child / db_message_filter.cc
blobf50d080b8d885a1bd55321f922f80961d130620f
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
3 // found in the LICENSE file.
5 #include "content/child/db_message_filter.h"
7 #include "content/common/database_messages.h"
8 #include "third_party/WebKit/public/platform/WebString.h"
9 #include "third_party/WebKit/public/web/WebDatabase.h"
11 using blink::WebString;
13 namespace content {
15 DBMessageFilter::DBMessageFilter() {
18 bool DBMessageFilter::OnMessageReceived(const IPC::Message& message) {
19 bool handled = true;
20 IPC_BEGIN_MESSAGE_MAP(DBMessageFilter, message)
21 IPC_MESSAGE_HANDLER(DatabaseMsg_UpdateSize, OnDatabaseUpdateSize)
22 IPC_MESSAGE_HANDLER(DatabaseMsg_UpdateSpaceAvailable,
23 OnDatabaseUpdateSpaceAvailable)
24 IPC_MESSAGE_HANDLER(DatabaseMsg_ResetSpaceAvailable,
25 OnDatabaseResetSpaceAvailable)
26 IPC_MESSAGE_HANDLER(DatabaseMsg_CloseImmediately,
27 OnDatabaseCloseImmediately)
28 IPC_MESSAGE_UNHANDLED(handled = false)
29 IPC_END_MESSAGE_MAP()
30 return handled;
33 void DBMessageFilter::OnDatabaseUpdateSize(const std::string& origin_identifier,
34 const base::string16& database_name,
35 int64 database_size) {
36 blink::WebDatabase::updateDatabaseSize(
37 WebString::fromUTF8(origin_identifier), database_name, database_size);
40 void DBMessageFilter::OnDatabaseUpdateSpaceAvailable(
41 const std::string& origin_identifier,
42 int64 space_available) {
43 blink::WebDatabase::updateSpaceAvailable(
44 WebString::fromUTF8(origin_identifier), space_available);
47 void DBMessageFilter::OnDatabaseResetSpaceAvailable(
48 const std::string& origin_identifier) {
49 blink::WebDatabase::resetSpaceAvailable(
50 WebString::fromUTF8(origin_identifier));
53 void DBMessageFilter::OnDatabaseCloseImmediately(
54 const std::string& origin_identifier,
55 const base::string16& database_name) {
56 blink::WebDatabase::closeDatabaseImmediately(
57 WebString::fromUTF8(origin_identifier), database_name);
60 } // namespace content