OLD | NEW |
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/shell/browser/shell_message_filter.h" | 5 #include "content/shell/browser/shell_message_filter.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/threading/thread_restrictions.h" | 8 #include "base/threading/thread_restrictions.h" |
9 #include "content/public/browser/child_process_security_policy.h" | 9 #include "content/public/browser/child_process_security_policy.h" |
10 #include "content/shell/browser/shell_browser_context.h" | 10 #include "content/shell/browser/shell_browser_context.h" |
11 #include "content/shell/browser/shell_content_browser_client.h" | 11 #include "content/shell/browser/shell_content_browser_client.h" |
12 #include "content/shell/browser/shell_network_delegate.h" | 12 #include "content/shell/browser/shell_network_delegate.h" |
13 #include "content/shell/browser/shell_notification_manager.h" | 13 #include "content/shell/browser/shell_notification_manager.h" |
14 #include "content/shell/common/shell_messages.h" | 14 #include "content/shell/common/shell_messages.h" |
15 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
16 #include "net/cookies/cookie_monster.h" | 16 #include "net/cookies/cookie_monster.h" |
17 #include "net/url_request/url_request_context.h" | 17 #include "net/url_request/url_request_context.h" |
18 #include "net/url_request/url_request_context_getter.h" | 18 #include "net/url_request/url_request_context_getter.h" |
19 #include "webkit/browser/database/database_tracker.h" | 19 #include "storage/browser/database/database_tracker.h" |
20 #include "webkit/browser/fileapi/isolated_context.h" | 20 #include "storage/browser/fileapi/isolated_context.h" |
21 #include "webkit/browser/quota/quota_manager.h" | 21 #include "storage/browser/quota/quota_manager.h" |
22 | 22 |
23 namespace content { | 23 namespace content { |
24 | 24 |
25 ShellMessageFilter::ShellMessageFilter( | 25 ShellMessageFilter::ShellMessageFilter( |
26 int render_process_id, | 26 int render_process_id, |
27 webkit_database::DatabaseTracker* database_tracker, | 27 webkit_database::DatabaseTracker* database_tracker, |
28 quota::QuotaManager* quota_manager, | 28 quota::QuotaManager* quota_manager, |
29 net::URLRequestContextGetter* request_context_getter) | 29 net::URLRequestContextGetter* request_context_getter) |
30 : BrowserMessageFilter(ShellMsgStart), | 30 : BrowserMessageFilter(ShellMsgStart), |
31 render_process_id_(render_process_id), | 31 render_process_id_(render_process_id), |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 void ShellMessageFilter::OnReadFileToString(const base::FilePath& local_file, | 68 void ShellMessageFilter::OnReadFileToString(const base::FilePath& local_file, |
69 std::string* contents) { | 69 std::string* contents) { |
70 base::ThreadRestrictions::ScopedAllowIO allow_io; | 70 base::ThreadRestrictions::ScopedAllowIO allow_io; |
71 base::ReadFileToString(local_file, contents); | 71 base::ReadFileToString(local_file, contents); |
72 } | 72 } |
73 | 73 |
74 void ShellMessageFilter::OnRegisterIsolatedFileSystem( | 74 void ShellMessageFilter::OnRegisterIsolatedFileSystem( |
75 const std::vector<base::FilePath>& absolute_filenames, | 75 const std::vector<base::FilePath>& absolute_filenames, |
76 std::string* filesystem_id) { | 76 std::string* filesystem_id) { |
77 fileapi::IsolatedContext::FileInfoSet files; | 77 storage::IsolatedContext::FileInfoSet files; |
78 ChildProcessSecurityPolicy* policy = | 78 ChildProcessSecurityPolicy* policy = |
79 ChildProcessSecurityPolicy::GetInstance(); | 79 ChildProcessSecurityPolicy::GetInstance(); |
80 for (size_t i = 0; i < absolute_filenames.size(); ++i) { | 80 for (size_t i = 0; i < absolute_filenames.size(); ++i) { |
81 files.AddPath(absolute_filenames[i], NULL); | 81 files.AddPath(absolute_filenames[i], NULL); |
82 if (!policy->CanReadFile(render_process_id_, absolute_filenames[i])) | 82 if (!policy->CanReadFile(render_process_id_, absolute_filenames[i])) |
83 policy->GrantReadFile(render_process_id_, absolute_filenames[i]); | 83 policy->GrantReadFile(render_process_id_, absolute_filenames[i]); |
84 } | 84 } |
85 *filesystem_id = | 85 *filesystem_id = |
86 fileapi::IsolatedContext::GetInstance()->RegisterDraggedFileSystem(files); | 86 storage::IsolatedContext::GetInstance()->RegisterDraggedFileSystem(files); |
87 policy->GrantReadFileSystem(render_process_id_, *filesystem_id); | 87 policy->GrantReadFileSystem(render_process_id_, *filesystem_id); |
88 } | 88 } |
89 | 89 |
90 void ShellMessageFilter::OnClearAllDatabases() { | 90 void ShellMessageFilter::OnClearAllDatabases() { |
91 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 91 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
92 database_tracker_->DeleteDataModifiedSince( | 92 database_tracker_->DeleteDataModifiedSince( |
93 base::Time(), net::CompletionCallback()); | 93 base::Time(), net::CompletionCallback()); |
94 } | 94 } |
95 | 95 |
96 void ShellMessageFilter::OnSetDatabaseQuota(int quota) { | 96 void ShellMessageFilter::OnSetDatabaseQuota(int quota) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 ShellNetworkDelegate::SetAcceptAllCookies(accept); | 131 ShellNetworkDelegate::SetAcceptAllCookies(accept); |
132 } | 132 } |
133 | 133 |
134 void ShellMessageFilter::OnDeleteAllCookies() { | 134 void ShellMessageFilter::OnDeleteAllCookies() { |
135 request_context_getter_->GetURLRequestContext()->cookie_store() | 135 request_context_getter_->GetURLRequestContext()->cookie_store() |
136 ->GetCookieMonster() | 136 ->GetCookieMonster() |
137 ->DeleteAllAsync(net::CookieMonster::DeleteCallback()); | 137 ->DeleteAllAsync(net::CookieMonster::DeleteCallback()); |
138 } | 138 } |
139 | 139 |
140 } // namespace content | 140 } // namespace content |
OLD | NEW |