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/plugin_info_message_filter.h" | 5 #include "chrome/browser/renderer_host/plugin_info_message_filter.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/content_settings/content_settings_utils.h" | 10 #include "chrome/browser/content_settings/content_settings_utils.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 PluginInfoMessageFilter::Context::~Context() { | 50 PluginInfoMessageFilter::Context::~Context() { |
51 } | 51 } |
52 | 52 |
53 PluginInfoMessageFilter::PluginInfoMessageFilter( | 53 PluginInfoMessageFilter::PluginInfoMessageFilter( |
54 int render_process_id, | 54 int render_process_id, |
55 Profile* profile) | 55 Profile* profile) |
56 : context_(render_process_id, profile), | 56 : context_(render_process_id, profile), |
57 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 57 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
58 } | 58 } |
59 | 59 |
60 PluginInfoMessageFilter::~PluginInfoMessageFilter() {} | |
61 | |
62 bool PluginInfoMessageFilter::OnMessageReceived(const IPC::Message& message, | 60 bool PluginInfoMessageFilter::OnMessageReceived(const IPC::Message& message, |
63 bool* message_was_ok) { | 61 bool* message_was_ok) { |
64 IPC_BEGIN_MESSAGE_MAP_EX(PluginInfoMessageFilter, message, *message_was_ok) | 62 IPC_BEGIN_MESSAGE_MAP_EX(PluginInfoMessageFilter, message, *message_was_ok) |
65 IPC_MESSAGE_HANDLER_DELAY_REPLY(ChromeViewHostMsg_GetPluginInfo, | 63 IPC_MESSAGE_HANDLER_DELAY_REPLY(ChromeViewHostMsg_GetPluginInfo, |
66 OnGetPluginInfo) | 64 OnGetPluginInfo) |
67 IPC_MESSAGE_UNHANDLED(return false) | 65 IPC_MESSAGE_UNHANDLED(return false) |
68 IPC_END_MESSAGE_MAP() | 66 IPC_END_MESSAGE_MAP() |
69 return true; | 67 return true; |
70 } | 68 } |
71 | 69 |
72 void PluginInfoMessageFilter::OnDestruct() const { | 70 void PluginInfoMessageFilter::OnDestruct() const { |
73 const_cast<PluginInfoMessageFilter*>(this)-> | 71 const_cast<PluginInfoMessageFilter*>(this)-> |
74 weak_ptr_factory_.DetachFromThread(); | 72 weak_ptr_factory_.DetachFromThread(); |
75 const_cast<PluginInfoMessageFilter*>(this)-> | 73 const_cast<PluginInfoMessageFilter*>(this)-> |
76 weak_ptr_factory_.InvalidateWeakPtrs(); | 74 weak_ptr_factory_.InvalidateWeakPtrs(); |
77 | 75 |
78 // Destroy on the UI thread because we contain a |PrefMember|. | 76 // Destroy on the UI thread because we contain a |PrefMember|. |
79 content::BrowserThread::DeleteOnUIThread::Destruct(this); | 77 content::BrowserThread::DeleteOnUIThread::Destruct(this); |
80 } | 78 } |
81 | 79 |
| 80 PluginInfoMessageFilter::~PluginInfoMessageFilter() {} |
| 81 |
82 struct PluginInfoMessageFilter::GetPluginInfo_Params { | 82 struct PluginInfoMessageFilter::GetPluginInfo_Params { |
83 int render_view_id; | 83 int render_view_id; |
84 GURL url; | 84 GURL url; |
85 GURL top_origin_url; | 85 GURL top_origin_url; |
86 std::string mime_type; | 86 std::string mime_type; |
87 }; | 87 }; |
88 | 88 |
89 void PluginInfoMessageFilter::OnGetPluginInfo( | 89 void PluginInfoMessageFilter::OnGetPluginInfo( |
90 int render_view_id, | 90 int render_view_id, |
91 const GURL& url, | 91 const GURL& url, |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 policy_url, plugin_url, CONTENT_SETTINGS_TYPE_PLUGINS, std::string(), | 268 policy_url, plugin_url, CONTENT_SETTINGS_TYPE_PLUGINS, std::string(), |
269 &info)); | 269 &info)); |
270 } | 270 } |
271 } | 271 } |
272 *setting = content_settings::ValueToContentSetting(value.get()); | 272 *setting = content_settings::ValueToContentSetting(value.get()); |
273 *uses_default_content_setting = | 273 *uses_default_content_setting = |
274 !uses_plugin_specific_setting && | 274 !uses_plugin_specific_setting && |
275 info.primary_pattern == ContentSettingsPattern::Wildcard() && | 275 info.primary_pattern == ContentSettingsPattern::Wildcard() && |
276 info.secondary_pattern == ContentSettingsPattern::Wildcard(); | 276 info.secondary_pattern == ContentSettingsPattern::Wildcard(); |
277 } | 277 } |
OLD | NEW |