Chromium Code Reviews| 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/web_resource/plugins_resource_service.h" | 5 #include "chrome/browser/web_resource/plugins_resource_service.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/plugins/plugin_finder.h" | 8 #include "chrome/browser/plugins/plugin_finder.h" |
| 9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| 11 #include "chrome/common/pref_names.h" | 11 #include "chrome/common/pref_names.h" |
| 12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 // Delay on first fetch so we don't interfere with startup. | 16 // Delay on first fetch so we don't interfere with startup. |
| 17 const int kStartResourceFetchDelayMs = 60 * 1000; | 17 const int kStartResourceFetchDelayMs = 60 * 1000; |
| 18 | 18 |
| 19 // Delay between calls to update the cache 1 day and 2 minutes in testing mode. | 19 // Delay between calls to update the cache 1 day and 2 minutes in testing mode. |
| 20 const int kCacheUpdateDelayMs = 24 * 60 * 60 * 1000; | 20 const int kCacheUpdateDelayMs = 24 * 60 * 60 * 1000; |
| 21 const int kTestCacheUpdateDelayMs = 2 * 60 * 1000; | 21 const int kTestCacheUpdateDelayMs = 2 * 60 * 1000; |
| 22 | 22 |
| 23 const char kPluginsServerUrl[] = "https://www.gstatic.com/chrome/config/"; | 23 const char kPluginsServerUrl[] = |
| 24 "https://www.gstatic.com/chrome/config/plugins_pattern_matching/"; | |
|
Bernhard Bauer
2012/11/23 12:51:13
Can we name this plugins_2 or something? Then we c
ibraa
2012/11/23 12:58:22
Done.
| |
| 24 | 25 |
| 25 bool IsTest() { | 26 bool IsTest() { |
| 26 return CommandLine::ForCurrentProcess()->HasSwitch( | 27 return CommandLine::ForCurrentProcess()->HasSwitch( |
| 27 switches::kPluginsMetadataServerURL); | 28 switches::kPluginsMetadataServerURL); |
| 28 } | 29 } |
| 29 | 30 |
| 30 GURL GetPluginsServerURL() { | 31 GURL GetPluginsServerURL() { |
| 31 std::string filename; | 32 std::string filename; |
| 32 #if defined(OS_WIN) | 33 #if defined(OS_WIN) |
| 33 filename = "plugins_win.json"; | 34 filename = "plugins_win.json"; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 void PluginsResourceService::RegisterPrefs(PrefService* local_state) { | 68 void PluginsResourceService::RegisterPrefs(PrefService* local_state) { |
| 68 local_state->RegisterDictionaryPref( | 69 local_state->RegisterDictionaryPref( |
| 69 prefs::kPluginsMetadata, new base::DictionaryValue()); | 70 prefs::kPluginsMetadata, new base::DictionaryValue()); |
| 70 local_state->RegisterStringPref(prefs::kPluginsResourceCacheUpdate, "0"); | 71 local_state->RegisterStringPref(prefs::kPluginsResourceCacheUpdate, "0"); |
| 71 } | 72 } |
| 72 | 73 |
| 73 void PluginsResourceService::Unpack(const DictionaryValue& parsed_json) { | 74 void PluginsResourceService::Unpack(const DictionaryValue& parsed_json) { |
| 74 prefs_->Set(prefs::kPluginsMetadata, parsed_json); | 75 prefs_->Set(prefs::kPluginsMetadata, parsed_json); |
| 75 PluginFinder::GetInstance()->ReinitializePlugins(parsed_json); | 76 PluginFinder::GetInstance()->ReinitializePlugins(parsed_json); |
| 76 } | 77 } |
| OLD | NEW |