| 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/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 base::AutoLock lock(mutex_); | 234 base::AutoLock lock(mutex_); |
| 235 int version = 0; // If no version is defined, we default to 0. | 235 int version = 0; // If no version is defined, we default to 0. |
| 236 const char kVersionKey[] = "x-version"; | 236 const char kVersionKey[] = "x-version"; |
| 237 plugin_list->GetInteger(kVersionKey, &version); | 237 plugin_list->GetInteger(kVersionKey, &version); |
| 238 if (version <= version_) | 238 if (version <= version_) |
| 239 return; | 239 return; |
| 240 | 240 |
| 241 version_ = version; | 241 version_ = version; |
| 242 | 242 |
| 243 STLDeleteValues(&identifier_plugin_); | 243 STLDeleteValues(&identifier_plugin_); |
| 244 identifier_plugin_.clear(); | |
| 245 | 244 |
| 246 for (base::DictionaryValue::Iterator plugin_it(*plugin_list); | 245 for (base::DictionaryValue::Iterator plugin_it(*plugin_list); |
| 247 !plugin_it.IsAtEnd(); plugin_it.Advance()) { | 246 !plugin_it.IsAtEnd(); plugin_it.Advance()) { |
| 248 const base::DictionaryValue* plugin = NULL; | 247 const base::DictionaryValue* plugin = NULL; |
| 249 const std::string& identifier = plugin_it.key(); | 248 const std::string& identifier = plugin_it.key(); |
| 250 if (plugin_list->GetDictionaryWithoutPathExpansion(identifier, &plugin)) { | 249 if (plugin_list->GetDictionaryWithoutPathExpansion(identifier, &plugin)) { |
| 251 DCHECK(!identifier_plugin_[identifier]); | 250 DCHECK(!identifier_plugin_[identifier]); |
| 252 identifier_plugin_[identifier] = CreatePluginMetadata(identifier, plugin); | 251 identifier_plugin_[identifier] = CreatePluginMetadata(identifier, plugin); |
| 253 | 252 |
| 254 #if defined(ENABLE_PLUGIN_INSTALLATION) | 253 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 metadata->AddMatchingMimeType(plugin.mime_types[i].mime_type); | 294 metadata->AddMatchingMimeType(plugin.mime_types[i].mime_type); |
| 296 | 295 |
| 297 DCHECK(metadata->MatchesPlugin(plugin)); | 296 DCHECK(metadata->MatchesPlugin(plugin)); |
| 298 if (identifier_plugin_.find(identifier) != identifier_plugin_.end()) | 297 if (identifier_plugin_.find(identifier) != identifier_plugin_.end()) |
| 299 identifier = GetLongIdentifier(plugin); | 298 identifier = GetLongIdentifier(plugin); |
| 300 | 299 |
| 301 DCHECK(identifier_plugin_.find(identifier) == identifier_plugin_.end()); | 300 DCHECK(identifier_plugin_.find(identifier) == identifier_plugin_.end()); |
| 302 identifier_plugin_[identifier] = metadata; | 301 identifier_plugin_[identifier] = metadata; |
| 303 return metadata->Clone(); | 302 return metadata->Clone(); |
| 304 } | 303 } |
| OLD | NEW |