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/pepper/pepper_broker_message_filter.h" | 5 #include "chrome/browser/renderer_host/pepper/pepper_broker_message_filter.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "components/content_settings/core/browser/host_content_settings_map.h" | 10 #include "components/content_settings/core/browser/host_content_settings_map.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 ppapi::host::HostMessageContext* context) { | 44 ppapi::host::HostMessageContext* context) { |
45 PPAPI_BEGIN_MESSAGE_MAP(PepperBrokerMessageFilter, msg) | 45 PPAPI_BEGIN_MESSAGE_MAP(PepperBrokerMessageFilter, msg) |
46 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_Broker_IsAllowed, | 46 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_Broker_IsAllowed, |
47 OnIsAllowed) | 47 OnIsAllowed) |
48 PPAPI_END_MESSAGE_MAP() | 48 PPAPI_END_MESSAGE_MAP() |
49 return PP_ERROR_FAILED; | 49 return PP_ERROR_FAILED; |
50 } | 50 } |
51 | 51 |
52 int32_t PepperBrokerMessageFilter::OnIsAllowed( | 52 int32_t PepperBrokerMessageFilter::OnIsAllowed( |
53 ppapi::host::HostMessageContext* context) { | 53 ppapi::host::HostMessageContext* context) { |
54 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 54 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
55 if (!document_url_.is_valid()) | 55 if (!document_url_.is_valid()) |
56 return PP_ERROR_FAILED; | 56 return PP_ERROR_FAILED; |
57 RenderProcessHost* render_process_host = | 57 RenderProcessHost* render_process_host = |
58 RenderProcessHost::FromID(render_process_id_); | 58 RenderProcessHost::FromID(render_process_id_); |
59 if (!render_process_host) | 59 if (!render_process_host) |
60 return PP_ERROR_FAILED; | 60 return PP_ERROR_FAILED; |
61 Profile* profile = | 61 Profile* profile = |
62 Profile::FromBrowserContext(render_process_host->GetBrowserContext()); | 62 Profile::FromBrowserContext(render_process_host->GetBrowserContext()); |
63 HostContentSettingsMap* content_settings = | 63 HostContentSettingsMap* content_settings = |
64 profile->GetHostContentSettingsMap(); | 64 profile->GetHostContentSettingsMap(); |
65 ContentSetting setting = | 65 ContentSetting setting = |
66 content_settings->GetContentSetting(document_url_, | 66 content_settings->GetContentSetting(document_url_, |
67 document_url_, | 67 document_url_, |
68 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, | 68 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, |
69 std::string()); | 69 std::string()); |
70 if (setting == CONTENT_SETTING_ALLOW) | 70 if (setting == CONTENT_SETTING_ALLOW) |
71 return PP_OK; | 71 return PP_OK; |
72 return PP_ERROR_FAILED; | 72 return PP_ERROR_FAILED; |
73 } | 73 } |
74 | 74 |
75 } // namespace chrome | 75 } // namespace chrome |
OLD | NEW |