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

Side by Side Diff: chrome/browser/renderer_host/chrome_render_message_filter.cc

Issue 6915017: Chrome side to allow WebKit layer to use WebPermissionClient to check if access to local storage ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/content_settings/host_content_settings_map.h" 10 #include "chrome/browser/content_settings/host_content_settings_map.h"
11 #include "chrome/browser/extensions/extension_event_router.h" 11 #include "chrome/browser/extensions/extension_event_router.h"
12 #include "chrome/browser/extensions/extension_message_service.h" 12 #include "chrome/browser/extensions/extension_message_service.h"
13 #include "chrome/browser/metrics/histogram_synchronizer.h" 13 #include "chrome/browser/metrics/histogram_synchronizer.h"
14 #include "chrome/browser/nacl_host/nacl_process_host.h" 14 #include "chrome/browser/nacl_host/nacl_process_host.h"
15 #include "chrome/browser/net/chrome_url_request_context.h" 15 #include "chrome/browser/net/chrome_url_request_context.h"
16 #include "chrome/browser/net/predictor_api.h" 16 #include "chrome/browser/net/predictor_api.h"
17 #include "chrome/browser/prefs/pref_member.h" 17 #include "chrome/browser/prefs/pref_member.h"
18 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/task_manager/task_manager.h" 19 #include "chrome/browser/task_manager/task_manager.h"
20 #include "chrome/common/extensions/extension_file_util.h" 20 #include "chrome/common/extensions/extension_file_util.h"
21 #include "chrome/common/extensions/extension_message_bundle.h" 21 #include "chrome/common/extensions/extension_message_bundle.h"
22 #include "chrome/common/extensions/extension_messages.h" 22 #include "chrome/common/extensions/extension_messages.h"
23 #include "chrome/common/pref_names.h" 23 #include "chrome/common/pref_names.h"
24 #include "chrome/common/render_messages.h" 24 #include "chrome/common/render_messages.h"
25 #include "content/browser/renderer_host/render_process_host.h" 25 #include "content/browser/renderer_host/render_process_host.h"
26 #include "content/browser/renderer_host/render_view_host_notification_task.h"
26 #include "content/browser/renderer_host/resource_dispatcher_host.h" 27 #include "content/browser/renderer_host/resource_dispatcher_host.h"
27 28
28 #if defined(USE_TCMALLOC) 29 #if defined(USE_TCMALLOC)
29 #include "chrome/browser/browser_about_handler.h" 30 #include "chrome/browser/browser_about_handler.h"
30 #endif 31 #endif
31 32
32 using WebKit::WebCache; 33 using WebKit::WebCache;
33 34
34 ChromeRenderMessageFilter::ChromeRenderMessageFilter( 35 ChromeRenderMessageFilter::ChromeRenderMessageFilter(
35 int render_process_id, 36 int render_process_id,
(...skipping 28 matching lines...) Expand all
64 IPC_MESSAGE_HANDLER(ExtensionHostMsg_OpenChannelToTab, OnOpenChannelToTab) 65 IPC_MESSAGE_HANDLER(ExtensionHostMsg_OpenChannelToTab, OnOpenChannelToTab)
65 IPC_MESSAGE_HANDLER_DELAY_REPLY(ExtensionHostMsg_GetMessageBundle, 66 IPC_MESSAGE_HANDLER_DELAY_REPLY(ExtensionHostMsg_GetMessageBundle,
66 OnGetExtensionMessageBundle) 67 OnGetExtensionMessageBundle)
67 IPC_MESSAGE_HANDLER(ExtensionHostMsg_AddListener, OnExtensionAddListener) 68 IPC_MESSAGE_HANDLER(ExtensionHostMsg_AddListener, OnExtensionAddListener)
68 IPC_MESSAGE_HANDLER(ExtensionHostMsg_RemoveListener, 69 IPC_MESSAGE_HANDLER(ExtensionHostMsg_RemoveListener,
69 OnExtensionRemoveListener) 70 OnExtensionRemoveListener)
70 IPC_MESSAGE_HANDLER(ExtensionHostMsg_CloseChannel, OnExtensionCloseChannel) 71 IPC_MESSAGE_HANDLER(ExtensionHostMsg_CloseChannel, OnExtensionCloseChannel)
71 #if defined(USE_TCMALLOC) 72 #if defined(USE_TCMALLOC)
72 IPC_MESSAGE_HANDLER(ViewHostMsg_RendererTcmalloc, OnRendererTcmalloc) 73 IPC_MESSAGE_HANDLER(ViewHostMsg_RendererTcmalloc, OnRendererTcmalloc)
73 #endif 74 #endif
74 IPC_MESSAGE_HANDLER(ViewHostMsg_GetPluginPolicies, 75 IPC_MESSAGE_HANDLER(ViewHostMsg_GetPluginPolicies, OnGetPluginPolicies)
75 OnGetPluginPolicies)
76 IPC_MESSAGE_HANDLER(ViewHostMsg_AllowDatabase, OnAllowDatabase) 76 IPC_MESSAGE_HANDLER(ViewHostMsg_AllowDatabase, OnAllowDatabase)
77 IPC_MESSAGE_HANDLER(ViewHostMsg_AllowDOMStorage, OnAllowDOMStorage)
77 IPC_MESSAGE_UNHANDLED(handled = false) 78 IPC_MESSAGE_UNHANDLED(handled = false)
78 IPC_END_MESSAGE_MAP() 79 IPC_END_MESSAGE_MAP()
79 80
80 return handled; 81 return handled;
81 } 82 }
82 83
83 void ChromeRenderMessageFilter::OnDestruct() const { 84 void ChromeRenderMessageFilter::OnDestruct() const {
84 // Destroy on the UI thread because we contain a PrefMember. 85 // Destroy on the UI thread because we contain a PrefMember.
85 BrowserThread::DeleteOnUIThread::Destruct(this); 86 BrowserThread::DeleteOnUIThread::Destruct(this);
86 } 87 }
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 *authorize_policy = always_authorize_plugins_.GetValue() ? 298 *authorize_policy = always_authorize_plugins_.GetValue() ?
298 CONTENT_SETTING_ALLOW : CONTENT_SETTING_ASK; 299 CONTENT_SETTING_ALLOW : CONTENT_SETTING_ASK;
299 } 300 }
300 301
301 void ChromeRenderMessageFilter::OnAllowDatabase(const std::string& origin_url, 302 void ChromeRenderMessageFilter::OnAllowDatabase(const std::string& origin_url,
302 const string16& name, 303 const string16& name,
303 const string16& display_name, 304 const string16& display_name,
304 unsigned long estimated_size, 305 unsigned long estimated_size,
305 bool* result) { 306 bool* result) {
306 GURL url(origin_url); 307 GURL url(origin_url);
307 ContentSetting content_setting = 308 ContentSetting setting = host_content_settings_map_->GetContentSetting(
308 host_content_settings_map_->GetContentSetting( 309 url, CONTENT_SETTINGS_TYPE_COOKIES, "");
309 url, CONTENT_SETTINGS_TYPE_COOKIES, ""); 310 DCHECK((setting == CONTENT_SETTING_ALLOW) ||
310 DCHECK((content_setting == CONTENT_SETTING_ALLOW) || 311 (setting == CONTENT_SETTING_BLOCK) ||
311 (content_setting == CONTENT_SETTING_BLOCK) || 312 (setting == CONTENT_SETTING_SESSION_ONLY));
312 (content_setting == CONTENT_SETTING_SESSION_ONLY)); 313 *result = setting != CONTENT_SETTING_BLOCK;
313 *result = content_setting != CONTENT_SETTING_BLOCK;
314 } 314 }
315
316 void ChromeRenderMessageFilter::OnAllowDOMStorage(int render_view_id,
317 const GURL& url,
318 DOMStorageType type,
319 bool* result) {
320 ContentSetting setting = host_content_settings_map_->GetContentSetting(
321 url, CONTENT_SETTINGS_TYPE_COOKIES, "");
322 *result = setting != CONTENT_SETTING_BLOCK;
323 // If content was blocked, tell the UI to display the blocked content icon.
324 CallRenderViewHostContentSettingsDelegate(
325 render_process_id_, render_view_id,
326 &RenderViewHostDelegate::ContentSettings::OnLocalStorageAccessed,
327 url, type, *result);
328 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/chrome_render_message_filter.h ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698