Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: chrome/browser/plugins/plugins_resource_service.cc

Issue 816403003: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/plugins_resource_service.h" 5 #include "chrome/browser/plugins/plugins_resource_service.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/prefs/pref_registry_simple.h" 8 #include "base/prefs/pref_registry_simple.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "chrome/browser/plugins/plugin_finder.h" 10 #include "chrome/browser/plugins/plugin_finder.h"
11 #include "chrome/common/chrome_switches.h" 11 #include "chrome/common/chrome_switches.h"
12 #include "chrome/common/pref_names.h" 12 #include "chrome/common/pref_names.h"
13 #include "url/gurl.h" 13 #include "url/gurl.h"
14 14
15 namespace { 15 namespace {
16 16
17 // Delay on first fetch so we don't interfere with startup. 17 // Delay on first fetch so we don't interfere with startup.
18 const int kStartResourceFetchDelayMs = 60 * 1000; 18 const int kStartResourceFetchDelayMs = 60 * 1000;
19 19
20 // Delay between calls to update the cache 1 day and 2 minutes in testing mode. 20 // Delay between calls to update the cache 1 day and 2 minutes in testing mode.
21 const int kCacheUpdateDelayMs = 24 * 60 * 60 * 1000; 21 const int kCacheUpdateDelayMs = 24 * 60 * 60 * 1000;
22 const int kTestCacheUpdateDelayMs = 2 * 60 * 1000; 22 const int kTestCacheUpdateDelayMs = 2 * 60 * 1000;
23 23
24 const char kPluginsServerUrl[] = 24 const char kPluginsServerUrl[] =
25 "https://www.gstatic.com/chrome/config/plugins_2/"; 25 "https://www.gstatic.com/chrome/config/plugins_2/";
26 26
27 bool IsTest() { 27 bool IsTest() {
28 return CommandLine::ForCurrentProcess()->HasSwitch( 28 return base::CommandLine::ForCurrentProcess()->HasSwitch(
29 switches::kPluginsMetadataServerURL); 29 switches::kPluginsMetadataServerURL);
30 } 30 }
31 31
32 GURL GetPluginsServerURL() { 32 GURL GetPluginsServerURL() {
33 std::string filename; 33 std::string filename;
34 #if defined(OS_WIN) 34 #if defined(OS_WIN)
35 filename = "plugins_win.json"; 35 filename = "plugins_win.json";
36 #elif defined(OS_LINUX) 36 #elif defined(OS_LINUX)
37 filename = "plugins_linux.json"; 37 filename = "plugins_linux.json";
38 #elif defined(OS_MACOSX) 38 #elif defined(OS_MACOSX)
39 filename = "plugins_mac.json"; 39 filename = "plugins_mac.json";
40 #else 40 #else
41 #error Unknown platform 41 #error Unknown platform
42 #endif 42 #endif
43 43
44 std::string test_url = 44 std::string test_url =
45 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 45 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
46 switches::kPluginsMetadataServerURL); 46 switches::kPluginsMetadataServerURL);
47 return GURL(IsTest() ? test_url : kPluginsServerUrl + filename); 47 return GURL(IsTest() ? test_url : kPluginsServerUrl + filename);
48 } 48 }
49 49
50 int GetCacheUpdateDelay() { 50 int GetCacheUpdateDelay() {
51 return IsTest() ? kTestCacheUpdateDelayMs : kCacheUpdateDelayMs; 51 return IsTest() ? kTestCacheUpdateDelayMs : kCacheUpdateDelayMs;
52 } 52 }
53 53
54 } // namespace 54 } // namespace
55 55
(...skipping 20 matching lines...) Expand all
76 void PluginsResourceService::RegisterPrefs(PrefRegistrySimple* registry) { 76 void PluginsResourceService::RegisterPrefs(PrefRegistrySimple* registry) {
77 registry->RegisterDictionaryPref(prefs::kPluginsMetadata, 77 registry->RegisterDictionaryPref(prefs::kPluginsMetadata,
78 new base::DictionaryValue()); 78 new base::DictionaryValue());
79 registry->RegisterStringPref(prefs::kPluginsResourceCacheUpdate, "0"); 79 registry->RegisterStringPref(prefs::kPluginsResourceCacheUpdate, "0");
80 } 80 }
81 81
82 void PluginsResourceService::Unpack(const base::DictionaryValue& parsed_json) { 82 void PluginsResourceService::Unpack(const base::DictionaryValue& parsed_json) {
83 prefs_->Set(prefs::kPluginsMetadata, parsed_json); 83 prefs_->Set(prefs::kPluginsMetadata, parsed_json);
84 PluginFinder::GetInstance()->ReinitializePlugins(&parsed_json); 84 PluginFinder::GetInstance()->ReinitializePlugins(&parsed_json);
85 } 85 }
OLDNEW
« no previous file with comments | « chrome/browser/plugins/plugin_prefs.cc ('k') | chrome/browser/policy/chrome_browser_policy_connector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698