 Chromium Code Reviews
 Chromium Code Reviews Issue 6148006:
  Update our use of the NPAPI ClearSiteData API.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 6148006:
  Update our use of the NPAPI ClearSiteData API.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| Index: chrome/browser/plugin_data_remover.cc | 
| diff --git a/chrome/browser/plugin_data_remover.cc b/chrome/browser/plugin_data_remover.cc | 
| index 2baf0d0452ba6c60c92703bde6e5d6fc89b56bd1..e7b7e9bae4c1fa2184cb8692ef434e0958812d55 100644 | 
| --- a/chrome/browser/plugin_data_remover.cc | 
| +++ b/chrome/browser/plugin_data_remover.cc | 
| @@ -18,11 +18,12 @@ | 
| #endif | 
| namespace { | 
| -const char* g_flash_mime_type = "application/x-shockwave-flash"; | 
| +const char* kFlashMimeType = "application/x-shockwave-flash"; | 
| // TODO(bauerb): Update minimum required Flash version as soon as there is one | 
| // implementing the API. | 
| 
stuartmorgan
2011/01/10 17:53:45
This approach isn't going to scale well with other
 
jam
2011/01/10 18:09:36
As Bernhard said, the number of plugins implementi
 | 
| -const char* g_min_flash_version = "100"; | 
| -const int64 g_timeout_ms = 10000; | 
| +const char* kMinFlashVersion = "100"; | 
| +const int64 kRemovalTimeoutMs = 10000; | 
| +const uint64 kClearAllData = 0; | 
| } // namespace | 
| PluginDataRemover::PluginDataRemover() | 
| @@ -47,13 +48,13 @@ void PluginDataRemover::StartRemoving(base::Time begin_time, Task* done_task) { | 
| AddRef(); | 
| PluginService::GetInstance()->OpenChannelToPlugin( | 
| - GURL(), g_flash_mime_type, this); | 
| + GURL(), kFlashMimeType, this); | 
| BrowserThread::PostDelayedTask( | 
| BrowserThread::IO, | 
| FROM_HERE, | 
| NewRunnableMethod(this, &PluginDataRemover::OnTimeout), | 
| - g_timeout_ms); | 
| + kRemovalTimeoutMs); | 
| } | 
| int PluginDataRemover::ID() { | 
| @@ -90,7 +91,9 @@ void PluginDataRemover::ConnectToChannel(const IPC::ChannelHandle& handle) { | 
| } | 
| if (!channel_->Send( | 
| - new PluginMsg_ClearSiteData(0, std::string(), begin_time_))) { | 
| + new PluginMsg_ClearSiteData(std::string(), | 
| + kClearAllData, | 
| + begin_time_))) { | 
| LOG(DFATAL) << "Couldn't send ClearSiteData message"; | 
| SignalDone(); | 
| } | 
| @@ -147,16 +150,14 @@ bool PluginDataRemover::IsSupported() { | 
| bool allow_wildcard = false; | 
| webkit::npapi::WebPluginInfo plugin; | 
| std::string mime_type; | 
| - if (!webkit::npapi::PluginList::Singleton()->GetPluginInfo(GURL(), | 
| - g_flash_mime_type, | 
| - allow_wildcard, | 
| - &plugin, | 
| - &mime_type)) | 
| + if (!webkit::npapi::PluginList::Singleton()->GetPluginInfo( | 
| + GURL(), kFlashMimeType, allow_wildcard, &plugin, &mime_type)) { | 
| 
jam
2011/01/10 18:09:36
nit: i think you need 4 spaces before GURL()
 
Bernhard Bauer
2011/01/11 12:43:34
Right, done.
 | 
| return false; | 
| + } | 
| scoped_ptr<Version> version( | 
| webkit::npapi::PluginGroup::CreateVersionFromString(plugin.version)); | 
| scoped_ptr<Version> min_version( | 
| - Version::GetVersionFromString(g_min_flash_version)); | 
| + Version::GetVersionFromString(kMinFlashVersion)); | 
| return plugin.enabled && | 
| version.get() && | 
| min_version->CompareTo(*version) == -1; |