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/plugins/npapi/plugin_group.h" | 13 #include "webkit/glue/plugins/plugin_group.h" |
14 #include "webkit/plugins/npapi/plugin_list.h" | 14 #include "webkit/glue/plugins/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( | 68 void PluginDataRemover::SetPluginInfo(const WebPluginInfo& info) { |
69 const webkit::npapi::WebPluginInfo& info) { | |
70 } | 69 } |
71 | 70 |
72 void PluginDataRemover::OnChannelOpened(const IPC::ChannelHandle& handle) { | 71 void PluginDataRemover::OnChannelOpened(const IPC::ChannelHandle& handle) { |
73 ConnectToChannel(handle); | 72 ConnectToChannel(handle); |
74 Release(); | 73 Release(); |
75 } | 74 } |
76 | 75 |
77 void PluginDataRemover::ConnectToChannel(const IPC::ChannelHandle& handle) { | 76 void PluginDataRemover::ConnectToChannel(const IPC::ChannelHandle& handle) { |
78 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 77 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
79 | 78 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 if (done_task_.get()) { | 135 if (done_task_.get()) { |
137 message_loop_->PostTask(FROM_HERE, done_task_.release()); | 136 message_loop_->PostTask(FROM_HERE, done_task_.release()); |
138 message_loop_ = NULL; | 137 message_loop_ = NULL; |
139 } | 138 } |
140 } | 139 } |
141 | 140 |
142 // static | 141 // static |
143 bool PluginDataRemover::IsSupported() { | 142 bool PluginDataRemover::IsSupported() { |
144 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 143 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
145 bool allow_wildcard = false; | 144 bool allow_wildcard = false; |
146 webkit::npapi::WebPluginInfo plugin; | 145 WebPluginInfo plugin; |
147 std::string mime_type; | 146 std::string mime_type; |
148 if (!webkit::npapi::PluginList::Singleton()->GetPluginInfo(GURL(), | 147 if (!NPAPI::PluginList::Singleton()->GetPluginInfo(GURL(), |
149 g_flash_mime_type, | 148 g_flash_mime_type, |
150 allow_wildcard, | 149 allow_wildcard, |
151 &plugin, | 150 &plugin, |
152 &mime_type)) | 151 &mime_type)) |
153 return false; | 152 return false; |
154 scoped_ptr<Version> version( | 153 scoped_ptr<Version> version( |
155 webkit::npapi::PluginGroup::CreateVersionFromString(plugin.version)); | 154 PluginGroup::CreateVersionFromString(plugin.version)); |
156 scoped_ptr<Version> min_version( | 155 scoped_ptr<Version> min_version( |
157 Version::GetVersionFromString(g_min_flash_version)); | 156 Version::GetVersionFromString(g_min_flash_version)); |
158 return plugin.enabled && | 157 return plugin.enabled && |
159 version.get() && | 158 version.get() && |
160 min_version->CompareTo(*version) == -1; | 159 min_version->CompareTo(*version) == -1; |
161 } | 160 } |
OLD | NEW |