OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/plugin_data_remover.h" | 5 #include "chrome/browser/plugin_data_remover.h" |
6 | 6 |
7 #include "base/message_loop_proxy.h" | 7 #include "base/message_loop_proxy.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/version.h" | 9 #include "base/version.h" |
10 #include "chrome/browser/browser_thread.h" | 10 #include "chrome/browser/browser_thread.h" |
11 #include "chrome/browser/plugin_service.h" | 11 #include "chrome/browser/plugin_service.h" |
12 #include "chrome/common/plugin_messages.h" | 12 #include "chrome/common/plugin_messages.h" |
13 #include "webkit/glue/plugins/plugin_group.h" | 13 #include "webkit/plugins/npapi/plugin_group.h" |
14 #include "webkit/glue/plugins/plugin_list.h" | 14 #include "webkit/plugins/npapi/plugin_list.h" |
15 | 15 |
16 #if defined(OS_POSIX) | 16 #if defined(OS_POSIX) |
17 #include "ipc/ipc_channel_posix.h" | 17 #include "ipc/ipc_channel_posix.h" |
18 #endif | 18 #endif |
19 | 19 |
20 namespace { | 20 namespace { |
21 const char* g_flash_mime_type = "application/x-shockwave-flash"; | 21 const char* g_flash_mime_type = "application/x-shockwave-flash"; |
22 // TODO(bauerb): Update minimum required Flash version as soon as there is one | 22 // TODO(bauerb): Update minimum required Flash version as soon as there is one |
23 // implementing the API. | 23 // implementing the API. |
24 const char* g_min_flash_version = "100"; | 24 const char* g_min_flash_version = "100"; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 int PluginDataRemover::ID() { | 59 int PluginDataRemover::ID() { |
60 // Generate an ID for the browser process. | 60 // Generate an ID for the browser process. |
61 return ChildProcessInfo::GenerateChildProcessUniqueId(); | 61 return ChildProcessInfo::GenerateChildProcessUniqueId(); |
62 } | 62 } |
63 | 63 |
64 bool PluginDataRemover::OffTheRecord() { | 64 bool PluginDataRemover::OffTheRecord() { |
65 return false; | 65 return false; |
66 } | 66 } |
67 | 67 |
68 void PluginDataRemover::SetPluginInfo(const WebPluginInfo& info) { | 68 void PluginDataRemover::SetPluginInfo( |
| 69 const webkit::npapi::WebPluginInfo& info) { |
69 } | 70 } |
70 | 71 |
71 void PluginDataRemover::OnChannelOpened(const IPC::ChannelHandle& handle) { | 72 void PluginDataRemover::OnChannelOpened(const IPC::ChannelHandle& handle) { |
72 ConnectToChannel(handle); | 73 ConnectToChannel(handle); |
73 Release(); | 74 Release(); |
74 } | 75 } |
75 | 76 |
76 void PluginDataRemover::ConnectToChannel(const IPC::ChannelHandle& handle) { | 77 void PluginDataRemover::ConnectToChannel(const IPC::ChannelHandle& handle) { |
77 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 78 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
78 | 79 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 if (done_task_.get()) { | 136 if (done_task_.get()) { |
136 message_loop_->PostTask(FROM_HERE, done_task_.release()); | 137 message_loop_->PostTask(FROM_HERE, done_task_.release()); |
137 message_loop_ = NULL; | 138 message_loop_ = NULL; |
138 } | 139 } |
139 } | 140 } |
140 | 141 |
141 // static | 142 // static |
142 bool PluginDataRemover::IsSupported() { | 143 bool PluginDataRemover::IsSupported() { |
143 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 144 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
144 bool allow_wildcard = false; | 145 bool allow_wildcard = false; |
145 WebPluginInfo plugin; | 146 webkit::npapi::WebPluginInfo plugin; |
146 std::string mime_type; | 147 std::string mime_type; |
147 if (!NPAPI::PluginList::Singleton()->GetPluginInfo(GURL(), | 148 if (!webkit::npapi::PluginList::Singleton()->GetPluginInfo(GURL(), |
148 g_flash_mime_type, | 149 g_flash_mime_type, |
149 allow_wildcard, | 150 allow_wildcard, |
150 &plugin, | 151 &plugin, |
151 &mime_type)) | 152 &mime_type)) |
152 return false; | 153 return false; |
153 scoped_ptr<Version> version( | 154 scoped_ptr<Version> version( |
154 PluginGroup::CreateVersionFromString(plugin.version)); | 155 webkit::npapi::PluginGroup::CreateVersionFromString(plugin.version)); |
155 scoped_ptr<Version> min_version( | 156 scoped_ptr<Version> min_version( |
156 Version::GetVersionFromString(g_min_flash_version)); | 157 Version::GetVersionFromString(g_min_flash_version)); |
157 return plugin.enabled && | 158 return plugin.enabled && |
158 version.get() && | 159 version.get() && |
159 min_version->CompareTo(*version) == -1; | 160 min_version->CompareTo(*version) == -1; |
160 } | 161 } |
OLD | NEW |