| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/plugins_resource_service.h" | 5 #include "chrome/browser/plugins/plugins_resource_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/prefs/pref_registry_simple.h" | |
| 10 #include "base/prefs/pref_service.h" | |
| 11 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 12 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/plugins/plugin_finder.h" | 11 #include "chrome/browser/plugins/plugin_finder.h" |
| 14 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
| 15 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
| 14 #include "components/prefs/pref_registry_simple.h" |
| 15 #include "components/prefs/pref_service.h" |
| 16 #include "components/safe_json/safe_json_parser.h" | 16 #include "components/safe_json/safe_json_parser.h" |
| 17 #include "url/gurl.h" | 17 #include "url/gurl.h" |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 // Delay on first fetch so we don't interfere with startup. | 21 // Delay on first fetch so we don't interfere with startup. |
| 22 const int kStartResourceFetchDelayMs = 60 * 1000; | 22 const int kStartResourceFetchDelayMs = 60 * 1000; |
| 23 | 23 |
| 24 // Delay between calls to update the cache 1 day and 2 minutes in testing mode. | 24 // Delay between calls to update the cache 1 day and 2 minutes in testing mode. |
| 25 const int kCacheUpdateDelayMs = 24 * 60 * 60 * 1000; | 25 const int kCacheUpdateDelayMs = 24 * 60 * 60 * 1000; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 void PluginsResourceService::RegisterPrefs(PrefRegistrySimple* registry) { | 70 void PluginsResourceService::RegisterPrefs(PrefRegistrySimple* registry) { |
| 71 registry->RegisterDictionaryPref(prefs::kPluginsMetadata, | 71 registry->RegisterDictionaryPref(prefs::kPluginsMetadata, |
| 72 new base::DictionaryValue()); | 72 new base::DictionaryValue()); |
| 73 registry->RegisterStringPref(prefs::kPluginsResourceCacheUpdate, "0"); | 73 registry->RegisterStringPref(prefs::kPluginsResourceCacheUpdate, "0"); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void PluginsResourceService::Unpack(const base::DictionaryValue& parsed_json) { | 76 void PluginsResourceService::Unpack(const base::DictionaryValue& parsed_json) { |
| 77 prefs_->Set(prefs::kPluginsMetadata, parsed_json); | 77 prefs_->Set(prefs::kPluginsMetadata, parsed_json); |
| 78 PluginFinder::GetInstance()->ReinitializePlugins(&parsed_json); | 78 PluginFinder::GetInstance()->ReinitializePlugins(&parsed_json); |
| 79 } | 79 } |
| OLD | NEW |