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

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

Issue 1832473002: WebSQL: Use url::Origin rather than database identifiers for IPC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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/db_message_filter.h" 5 #include "content/child/db_message_filter.h"
6 6
7 #include "content/common/database_messages.h" 7 #include "content/common/database_messages.h"
8 #include "storage/common/database/database_identifier.h" 8 #include "storage/common/database/database_identifier.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/WebKit/public/platform/WebURL.h" 11 #include "third_party/WebKit/public/platform/WebURL.h"
12 #include "third_party/WebKit/public/web/WebDatabase.h" 12 #include "third_party/WebKit/public/web/WebDatabase.h"
13 #include "url/origin.h"
13 14
14 using blink::WebSecurityOrigin; 15 using blink::WebSecurityOrigin;
15 using blink::WebString; 16 using blink::WebString;
16 17
17 namespace content { 18 namespace content {
18 19
19 namespace {
20
21 // TODO(jsbell): Pass url::Origin over IPC instead of database identifier/GURL.
22 // https://crbug.com/591482
23 WebSecurityOrigin OriginFromIdentifier(const std::string& identifier) {
24 return WebSecurityOrigin::create(
25 storage::GetOriginFromIdentifier(identifier));
26 }
27
28 } // namespace
29
30 DBMessageFilter::DBMessageFilter() { 20 DBMessageFilter::DBMessageFilter() {
31 } 21 }
32 22
33 bool DBMessageFilter::OnMessageReceived(const IPC::Message& message) { 23 bool DBMessageFilter::OnMessageReceived(const IPC::Message& message) {
34 bool handled = true; 24 bool handled = true;
35 IPC_BEGIN_MESSAGE_MAP(DBMessageFilter, message) 25 IPC_BEGIN_MESSAGE_MAP(DBMessageFilter, message)
36 IPC_MESSAGE_HANDLER(DatabaseMsg_UpdateSize, OnDatabaseUpdateSize) 26 IPC_MESSAGE_HANDLER(DatabaseMsg_UpdateSize, OnDatabaseUpdateSize)
37 IPC_MESSAGE_HANDLER(DatabaseMsg_UpdateSpaceAvailable, 27 IPC_MESSAGE_HANDLER(DatabaseMsg_UpdateSpaceAvailable,
38 OnDatabaseUpdateSpaceAvailable) 28 OnDatabaseUpdateSpaceAvailable)
39 IPC_MESSAGE_HANDLER(DatabaseMsg_ResetSpaceAvailable, 29 IPC_MESSAGE_HANDLER(DatabaseMsg_ResetSpaceAvailable,
40 OnDatabaseResetSpaceAvailable) 30 OnDatabaseResetSpaceAvailable)
41 IPC_MESSAGE_HANDLER(DatabaseMsg_CloseImmediately, 31 IPC_MESSAGE_HANDLER(DatabaseMsg_CloseImmediately,
42 OnDatabaseCloseImmediately) 32 OnDatabaseCloseImmediately)
43 IPC_MESSAGE_UNHANDLED(handled = false) 33 IPC_MESSAGE_UNHANDLED(handled = false)
44 IPC_END_MESSAGE_MAP() 34 IPC_END_MESSAGE_MAP()
45 return handled; 35 return handled;
46 } 36 }
47 37
48 void DBMessageFilter::OnDatabaseUpdateSize(const std::string& origin_identifier, 38 void DBMessageFilter::OnDatabaseUpdateSize(const url::Origin& origin,
49 const base::string16& database_name, 39 const base::string16& database_name,
50 int64_t database_size) { 40 int64_t database_size) {
51 blink::WebDatabase::updateDatabaseSize( 41 blink::WebDatabase::updateDatabaseSize(origin, database_name, database_size);
52 OriginFromIdentifier(origin_identifier), database_name, database_size);
53 } 42 }
54 43
55 void DBMessageFilter::OnDatabaseUpdateSpaceAvailable( 44 void DBMessageFilter::OnDatabaseUpdateSpaceAvailable(const url::Origin& origin,
56 const std::string& origin_identifier, 45 int64_t space_available) {
57 int64_t space_available) { 46 blink::WebDatabase::updateSpaceAvailable(origin, space_available);
58 blink::WebDatabase::updateSpaceAvailable(
59 OriginFromIdentifier(origin_identifier), space_available);
60 } 47 }
61 48
62 void DBMessageFilter::OnDatabaseResetSpaceAvailable( 49 void DBMessageFilter::OnDatabaseResetSpaceAvailable(const url::Origin& origin) {
63 const std::string& origin_identifier) { 50 blink::WebDatabase::resetSpaceAvailable(origin);
64 blink::WebDatabase::resetSpaceAvailable(
65 OriginFromIdentifier(origin_identifier));
66 } 51 }
67 52
68 void DBMessageFilter::OnDatabaseCloseImmediately( 53 void DBMessageFilter::OnDatabaseCloseImmediately(
69 const std::string& origin_identifier, 54 const url::Origin& origin,
70 const base::string16& database_name) { 55 const base::string16& database_name) {
71 blink::WebDatabase::closeDatabaseImmediately( 56 blink::WebDatabase::closeDatabaseImmediately(origin, database_name);
72 OriginFromIdentifier(origin_identifier), database_name);
73 } 57 }
74 58
75 } // namespace content 59 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698