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/plugins/plugin_finder.h" | 5 #include "chrome/browser/plugins/plugin_finder.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 } | 159 } |
160 | 160 |
161 // static | 161 // static |
162 PluginFinder* PluginFinder::GetInstance() { | 162 PluginFinder* PluginFinder::GetInstance() { |
163 // PluginFinder::GetInstance() is the only method that's allowed to call | 163 // PluginFinder::GetInstance() is the only method that's allowed to call |
164 // Singleton<PluginFinder>::get(). | 164 // Singleton<PluginFinder>::get(). |
165 return Singleton<PluginFinder>::get(); | 165 return Singleton<PluginFinder>::get(); |
166 } | 166 } |
167 | 167 |
168 PluginFinder::PluginFinder() : version_(-1) { | 168 PluginFinder::PluginFinder() : version_(-1) { |
169 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 169 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
170 } | 170 } |
171 | 171 |
172 void PluginFinder::Init() { | 172 void PluginFinder::Init() { |
173 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 173 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
174 // Load the built-in plugin list first. If we have a newer version stored | 174 // Load the built-in plugin list first. If we have a newer version stored |
175 // locally or download one, we will replace this one with it. | 175 // locally or download one, we will replace this one with it. |
176 scoped_ptr<base::DictionaryValue> plugin_list(LoadBuiltInPluginList()); | 176 scoped_ptr<base::DictionaryValue> plugin_list(LoadBuiltInPluginList()); |
177 | 177 |
178 // Gracefully handle the case where we couldn't parse the built-in plugin list | 178 // Gracefully handle the case where we couldn't parse the built-in plugin list |
179 // for some reason (https://crbug.com/388560). TODO(bauerb): Change back to a | 179 // for some reason (https://crbug.com/388560). TODO(bauerb): Change back to a |
180 // DCHECK once we have gathered more data about the underlying problem. | 180 // DCHECK once we have gathered more data about the underlying problem. |
181 if (!plugin_list) | 181 if (!plugin_list) |
182 return; | 182 return; |
183 | 183 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 metadata->AddMatchingMimeType(plugin.mime_types[i].mime_type); | 362 metadata->AddMatchingMimeType(plugin.mime_types[i].mime_type); |
363 | 363 |
364 DCHECK(metadata->MatchesPlugin(plugin)); | 364 DCHECK(metadata->MatchesPlugin(plugin)); |
365 if (identifier_plugin_.find(identifier) != identifier_plugin_.end()) | 365 if (identifier_plugin_.find(identifier) != identifier_plugin_.end()) |
366 identifier = GetLongIdentifier(plugin); | 366 identifier = GetLongIdentifier(plugin); |
367 | 367 |
368 DCHECK(identifier_plugin_.find(identifier) == identifier_plugin_.end()); | 368 DCHECK(identifier_plugin_.find(identifier) == identifier_plugin_.end()); |
369 identifier_plugin_[identifier] = metadata; | 369 identifier_plugin_[identifier] = metadata; |
370 return metadata->Clone(); | 370 return metadata->Clone(); |
371 } | 371 } |
OLD | NEW |