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

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

Issue 2717473002: Network traffic annotation added to web_resource_service. (Closed)
Patch Set: Annotation updated. Created 3 years, 9 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
« no previous file with comments | « no previous file | components/web_resource/web_resource_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/plugins/plugin_finder.h" 11 #include "chrome/browser/plugins/plugin_finder.h"
12 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
13 #include "chrome/common/pref_names.h" 13 #include "chrome/common/pref_names.h"
14 #include "components/prefs/pref_registry_simple.h" 14 #include "components/prefs/pref_registry_simple.h"
15 #include "components/prefs/pref_service.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 constexpr net::NetworkTrafficAnnotationTag kTrafficAnnotation =
21 net::DefineNetworkTrafficAnnotation("plugins_resource_service", R"(
22 semantics {
23 sender: "Plugins Resource Service"
24 description:
25 "Fetches updates to the list of plugins known to Chromium. For a "
26 "given plugin, this list contains the minimum version not "
27 "containing known security vulnerabilities, and can be used to "
28 "inform the user that their plugins need to be updated."
29 trigger: "Triggered at regular intervals (once per day)."
30 data: "None"
31 destination: GOOGLE_OWNED_SERVICE
32 }
33 policy {
34 cookies_allowed: false
35 setting: "This feature cannot be disabled in settings."
36 policy_exception_justification:
37 "Not implemented. AllowOutdatedPlugins policy silences local "
38 "warnings, but network request to update the list of plugins are "
39 "still sent."
40 })");
41
42 } // namespace
43
44 namespace {
20 45
21 // Delay on first fetch so we don't interfere with startup. 46 // Delay on first fetch so we don't interfere with startup.
22 const int kStartResourceFetchDelayMs = 60 * 1000; 47 const int kStartResourceFetchDelayMs = 60 * 1000;
23 48
24 // Delay between calls to update the cache 1 day and 2 minutes in testing mode. 49 // Delay between calls to update the cache 1 day and 2 minutes in testing mode.
25 const int kCacheUpdateDelayMs = 24 * 60 * 60 * 1000; 50 const int kCacheUpdateDelayMs = 24 * 60 * 60 * 1000;
26 51
27 const char kPluginsServerUrl[] = 52 const char kPluginsServerUrl[] =
28 "https://www.gstatic.com/chrome/config/plugins_2/"; 53 "https://www.gstatic.com/chrome/config/plugins_2/";
29 54
(...skipping 17 matching lines...) Expand all
47 PluginsResourceService::PluginsResourceService(PrefService* local_state) 72 PluginsResourceService::PluginsResourceService(PrefService* local_state)
48 : web_resource::WebResourceService( 73 : web_resource::WebResourceService(
49 local_state, 74 local_state,
50 GetPluginsServerURL(), 75 GetPluginsServerURL(),
51 std::string(), 76 std::string(),
52 prefs::kPluginsResourceCacheUpdate, 77 prefs::kPluginsResourceCacheUpdate,
53 kStartResourceFetchDelayMs, 78 kStartResourceFetchDelayMs,
54 kCacheUpdateDelayMs, 79 kCacheUpdateDelayMs,
55 g_browser_process->system_request_context(), 80 g_browser_process->system_request_context(),
56 switches::kDisableBackgroundNetworking, 81 switches::kDisableBackgroundNetworking,
57 base::Bind(safe_json::SafeJsonParser::Parse)) {} 82 base::Bind(safe_json::SafeJsonParser::Parse),
83 kTrafficAnnotation) {}
58 84
59 void PluginsResourceService::Init() { 85 void PluginsResourceService::Init() {
60 const base::DictionaryValue* metadata = 86 const base::DictionaryValue* metadata =
61 prefs_->GetDictionary(prefs::kPluginsMetadata); 87 prefs_->GetDictionary(prefs::kPluginsMetadata);
62 PluginFinder::GetInstance()->ReinitializePlugins(metadata); 88 PluginFinder::GetInstance()->ReinitializePlugins(metadata);
63 StartAfterDelay(); 89 StartAfterDelay();
64 } 90 }
65 91
66 PluginsResourceService::~PluginsResourceService() { 92 PluginsResourceService::~PluginsResourceService() {
67 } 93 }
68 94
69 // static 95 // static
70 void PluginsResourceService::RegisterPrefs(PrefRegistrySimple* registry) { 96 void PluginsResourceService::RegisterPrefs(PrefRegistrySimple* registry) {
71 registry->RegisterDictionaryPref(prefs::kPluginsMetadata, 97 registry->RegisterDictionaryPref(prefs::kPluginsMetadata,
72 new base::DictionaryValue()); 98 new base::DictionaryValue());
73 registry->RegisterStringPref(prefs::kPluginsResourceCacheUpdate, "0"); 99 registry->RegisterStringPref(prefs::kPluginsResourceCacheUpdate, "0");
74 } 100 }
75 101
76 void PluginsResourceService::Unpack(const base::DictionaryValue& parsed_json) { 102 void PluginsResourceService::Unpack(const base::DictionaryValue& parsed_json) {
77 prefs_->Set(prefs::kPluginsMetadata, parsed_json); 103 prefs_->Set(prefs::kPluginsMetadata, parsed_json);
78 PluginFinder::GetInstance()->ReinitializePlugins(&parsed_json); 104 PluginFinder::GetInstance()->ReinitializePlugins(&parsed_json);
79 } 105 }
OLDNEW
« no previous file with comments | « no previous file | components/web_resource/web_resource_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698