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 "chrome/browser/renderer_host/chrome_render_message_filter.h" | 5 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/profiles/profile_manager.h" | 23 #include "chrome/browser/profiles/profile_manager.h" |
24 #include "chrome/common/render_messages.h" | 24 #include "chrome/common/render_messages.h" |
25 #include "components/content_settings/core/browser/cookie_settings.h" | 25 #include "components/content_settings/core/browser/cookie_settings.h" |
26 #include "components/network_hints/common/network_hints_common.h" | 26 #include "components/network_hints/common/network_hints_common.h" |
27 #include "components/network_hints/common/network_hints_messages.h" | 27 #include "components/network_hints/common/network_hints_messages.h" |
28 #include "components/web_cache/browser/web_cache_manager.h" | 28 #include "components/web_cache/browser/web_cache_manager.h" |
29 #include "content/public/browser/notification_service.h" | 29 #include "content/public/browser/notification_service.h" |
30 #include "content/public/browser/render_process_host.h" | 30 #include "content/public/browser/render_process_host.h" |
31 #include "content/public/browser/service_worker_context.h" | 31 #include "content/public/browser/service_worker_context.h" |
| 32 #include "extensions/features/features.h" |
32 | 33 |
33 #if defined(ENABLE_EXTENSIONS) | 34 #if BUILDFLAG(ENABLE_EXTENSIONS) |
34 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h" | 35 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h" |
35 #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" | 36 #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" |
36 #include "extensions/common/manifest_handlers/default_locale_handler.h" | 37 #include "extensions/common/manifest_handlers/default_locale_handler.h" |
37 #endif | 38 #endif |
38 | 39 |
39 using content::BrowserThread; | 40 using content::BrowserThread; |
40 | 41 |
41 namespace { | 42 namespace { |
42 | 43 |
43 const uint32_t kFilteredMessageClasses[] = { | 44 const uint32_t kFilteredMessageClasses[] = { |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 } | 202 } |
202 | 203 |
203 void ChromeRenderMessageFilter::OnRequestFileSystemAccessSyncResponse( | 204 void ChromeRenderMessageFilter::OnRequestFileSystemAccessSyncResponse( |
204 IPC::Message* reply_msg, | 205 IPC::Message* reply_msg, |
205 bool allowed) { | 206 bool allowed) { |
206 ChromeViewHostMsg_RequestFileSystemAccessSync::WriteReplyParams(reply_msg, | 207 ChromeViewHostMsg_RequestFileSystemAccessSync::WriteReplyParams(reply_msg, |
207 allowed); | 208 allowed); |
208 Send(reply_msg); | 209 Send(reply_msg); |
209 } | 210 } |
210 | 211 |
211 #if defined(ENABLE_EXTENSIONS) | 212 #if BUILDFLAG(ENABLE_EXTENSIONS) |
212 void ChromeRenderMessageFilter::FileSystemAccessedSyncOnUIThread( | 213 void ChromeRenderMessageFilter::FileSystemAccessedSyncOnUIThread( |
213 int render_process_id, | 214 int render_process_id, |
214 int render_frame_id, | 215 int render_frame_id, |
215 const GURL& url, | 216 const GURL& url, |
216 bool blocked_by_policy, | 217 bool blocked_by_policy, |
217 IPC::Message* reply_msg) { | 218 IPC::Message* reply_msg) { |
218 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 219 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
219 extensions::WebViewPermissionHelper* web_view_permission_helper = | 220 extensions::WebViewPermissionHelper* web_view_permission_helper = |
220 extensions::WebViewPermissionHelper::FromFrameID( | 221 extensions::WebViewPermissionHelper::FromFrameID( |
221 render_process_id, render_frame_id); | 222 render_process_id, render_frame_id); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 void ChromeRenderMessageFilter::OnRequestFileSystemAccess( | 258 void ChromeRenderMessageFilter::OnRequestFileSystemAccess( |
258 int render_frame_id, | 259 int render_frame_id, |
259 const GURL& origin_url, | 260 const GURL& origin_url, |
260 const GURL& top_origin_url, | 261 const GURL& top_origin_url, |
261 base::Callback<void(bool)> callback) { | 262 base::Callback<void(bool)> callback) { |
262 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 263 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
263 | 264 |
264 bool allowed = | 265 bool allowed = |
265 cookie_settings_->IsSettingCookieAllowed(origin_url, top_origin_url); | 266 cookie_settings_->IsSettingCookieAllowed(origin_url, top_origin_url); |
266 | 267 |
267 #if defined(ENABLE_EXTENSIONS) | 268 #if BUILDFLAG(ENABLE_EXTENSIONS) |
268 bool is_web_view_guest = extensions::WebViewRendererState::GetInstance() | 269 bool is_web_view_guest = extensions::WebViewRendererState::GetInstance() |
269 ->IsGuest(render_process_id_); | 270 ->IsGuest(render_process_id_); |
270 if (is_web_view_guest) { | 271 if (is_web_view_guest) { |
271 // Record access to file system for potential display in UI. | 272 // Record access to file system for potential display in UI. |
272 BrowserThread::PostTask( | 273 BrowserThread::PostTask( |
273 BrowserThread::UI, | 274 BrowserThread::UI, |
274 FROM_HERE, | 275 FROM_HERE, |
275 base::Bind(&ChromeRenderMessageFilter::FileSystemAccessedOnUIThread, | 276 base::Bind(&ChromeRenderMessageFilter::FileSystemAccessedOnUIThread, |
276 render_process_id_, | 277 render_process_id_, |
277 render_frame_id, | 278 render_frame_id, |
278 origin_url, | 279 origin_url, |
279 allowed, | 280 allowed, |
280 callback)); | 281 callback)); |
281 return; | 282 return; |
282 } | 283 } |
283 #endif | 284 #endif |
284 callback.Run(allowed); | 285 callback.Run(allowed); |
285 // Record access to file system for potential display in UI. | 286 // Record access to file system for potential display in UI. |
286 BrowserThread::PostTask( | 287 BrowserThread::PostTask( |
287 BrowserThread::UI, | 288 BrowserThread::UI, |
288 FROM_HERE, | 289 FROM_HERE, |
289 base::Bind(&TabSpecificContentSettings::FileSystemAccessed, | 290 base::Bind(&TabSpecificContentSettings::FileSystemAccessed, |
290 render_process_id_, | 291 render_process_id_, |
291 render_frame_id, | 292 render_frame_id, |
292 origin_url, | 293 origin_url, |
293 !allowed)); | 294 !allowed)); |
294 } | 295 } |
295 | 296 |
296 #if defined(ENABLE_EXTENSIONS) | 297 #if BUILDFLAG(ENABLE_EXTENSIONS) |
297 void ChromeRenderMessageFilter::FileSystemAccessedOnUIThread( | 298 void ChromeRenderMessageFilter::FileSystemAccessedOnUIThread( |
298 int render_process_id, | 299 int render_process_id, |
299 int render_frame_id, | 300 int render_frame_id, |
300 const GURL& url, | 301 const GURL& url, |
301 bool allowed, | 302 bool allowed, |
302 base::Callback<void(bool)> callback) { | 303 base::Callback<void(bool)> callback) { |
303 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 304 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
304 extensions::WebViewPermissionHelper* web_view_permission_helper = | 305 extensions::WebViewPermissionHelper* web_view_permission_helper = |
305 extensions::WebViewPermissionHelper::FromFrameID( | 306 extensions::WebViewPermissionHelper::FromFrameID( |
306 render_process_id, render_frame_id); | 307 render_process_id, render_frame_id); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 } | 351 } |
351 #endif | 352 #endif |
352 | 353 |
353 void ChromeRenderMessageFilter::OnFieldTrialActivated( | 354 void ChromeRenderMessageFilter::OnFieldTrialActivated( |
354 const std::string& trial_name) { | 355 const std::string& trial_name) { |
355 // Activate the trial in the browser process to match its state in the | 356 // Activate the trial in the browser process to match its state in the |
356 // renderer. This is done by calling FindFullName which finalizes the group | 357 // renderer. This is done by calling FindFullName which finalizes the group |
357 // and activates the trial. | 358 // and activates the trial. |
358 base::FieldTrialList::FindFullName(trial_name); | 359 base::FieldTrialList::FindFullName(trial_name); |
359 } | 360 } |
OLD | NEW |