| 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 "content/browser/plugin_data_remover_impl.h" | 5 #include "content/browser/plugin_data_remover_impl.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 base::TimeDelta::FromMilliseconds(kRemovalTimeoutMs)); | 84 base::TimeDelta::FromMilliseconds(kRemovalTimeoutMs)); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void InitOnIOThread(const std::string& mime_type) { | 87 void InitOnIOThread(const std::string& mime_type) { |
| 88 PluginServiceImpl* plugin_service = PluginServiceImpl::GetInstance(); | 88 PluginServiceImpl* plugin_service = PluginServiceImpl::GetInstance(); |
| 89 | 89 |
| 90 // Get the plugin file path. | 90 // Get the plugin file path. |
| 91 std::vector<WebPluginInfo> plugins; | 91 std::vector<WebPluginInfo> plugins; |
| 92 plugin_service->GetPluginInfoArray( | 92 plugin_service->GetPluginInfoArray( |
| 93 GURL(), mime_type, false, &plugins, NULL); | 93 GURL(), mime_type, false, &plugins, NULL); |
| 94 base::FilePath plugin_path; | 94 |
| 95 if (!plugins.empty()) // May be empty for some tests. | 95 if (plugins.empty()) { |
| 96 plugin_path = plugins[0].path; | 96 // May be empty for some tests and on the CrOS login OOBE screen. |
| 97 event_->Signal(); |
| 98 return; |
| 99 } |
| 100 |
| 101 base::FilePath plugin_path = plugins[0].path; |
| 97 | 102 |
| 98 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 103 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 99 remove_start_time_ = base::Time::Now(); | 104 remove_start_time_ = base::Time::Now(); |
| 100 is_removing_ = true; | 105 is_removing_ = true; |
| 101 // Balanced in On[Ppapi]ChannelOpened or OnError. Exactly one them will | 106 // Balanced in On[Ppapi]ChannelOpened or OnError. Exactly one them will |
| 102 // eventually be called, so we need to keep this object around until then. | 107 // eventually be called, so we need to keep this object around until then. |
| 103 AddRef(); | 108 AddRef(); |
| 104 | 109 |
| 105 PepperPluginInfo* pepper_info = | 110 PepperPluginInfo* pepper_info = |
| 106 plugin_service->GetRegisteredPpapiPluginInfo(plugin_path); | 111 plugin_service->GetRegisteredPpapiPluginInfo(plugin_path); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 | 309 |
| 305 base::WaitableEvent* PluginDataRemoverImpl::StartRemoving( | 310 base::WaitableEvent* PluginDataRemoverImpl::StartRemoving( |
| 306 base::Time begin_time) { | 311 base::Time begin_time) { |
| 307 DCHECK(!context_.get()); | 312 DCHECK(!context_.get()); |
| 308 context_ = new Context(begin_time, browser_context_); | 313 context_ = new Context(begin_time, browser_context_); |
| 309 context_->Init(mime_type_); | 314 context_->Init(mime_type_); |
| 310 return context_->event(); | 315 return context_->event(); |
| 311 } | 316 } |
| 312 | 317 |
| 313 } // namespace content | 318 } // namespace content |
| OLD | NEW |