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

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 {
37 AllowOutdatedPlugins {
38 policy_options {mode: MANDATORY}
39 AllowOutdatedPlugins: true
Bernhard Bauer 2017/03/14 12:20:17 This policy does not disable the network request t
Ramin Halavati 2017/03/14 12:25:46 Sorry, thank you.
40 }
41 }
42 })");
43
44 } // namespace
45
46 namespace {
20 47
21 // Delay on first fetch so we don't interfere with startup. 48 // Delay on first fetch so we don't interfere with startup.
22 const int kStartResourceFetchDelayMs = 60 * 1000; 49 const int kStartResourceFetchDelayMs = 60 * 1000;
23 50
24 // Delay between calls to update the cache 1 day and 2 minutes in testing mode. 51 // Delay between calls to update the cache 1 day and 2 minutes in testing mode.
25 const int kCacheUpdateDelayMs = 24 * 60 * 60 * 1000; 52 const int kCacheUpdateDelayMs = 24 * 60 * 60 * 1000;
26 53
27 const char kPluginsServerUrl[] = 54 const char kPluginsServerUrl[] =
28 "https://www.gstatic.com/chrome/config/plugins_2/"; 55 "https://www.gstatic.com/chrome/config/plugins_2/";
29 56
(...skipping 17 matching lines...) Expand all
47 PluginsResourceService::PluginsResourceService(PrefService* local_state) 74 PluginsResourceService::PluginsResourceService(PrefService* local_state)
48 : web_resource::WebResourceService( 75 : web_resource::WebResourceService(
49 local_state, 76 local_state,
50 GetPluginsServerURL(), 77 GetPluginsServerURL(),
51 std::string(), 78 std::string(),
52 prefs::kPluginsResourceCacheUpdate, 79 prefs::kPluginsResourceCacheUpdate,
53 kStartResourceFetchDelayMs, 80 kStartResourceFetchDelayMs,
54 kCacheUpdateDelayMs, 81 kCacheUpdateDelayMs,
55 g_browser_process->system_request_context(), 82 g_browser_process->system_request_context(),
56 switches::kDisableBackgroundNetworking, 83 switches::kDisableBackgroundNetworking,
57 base::Bind(safe_json::SafeJsonParser::Parse)) {} 84 base::Bind(safe_json::SafeJsonParser::Parse),
85 kTrafficAnnotation) {}
58 86
59 void PluginsResourceService::Init() { 87 void PluginsResourceService::Init() {
60 const base::DictionaryValue* metadata = 88 const base::DictionaryValue* metadata =
61 prefs_->GetDictionary(prefs::kPluginsMetadata); 89 prefs_->GetDictionary(prefs::kPluginsMetadata);
62 PluginFinder::GetInstance()->ReinitializePlugins(metadata); 90 PluginFinder::GetInstance()->ReinitializePlugins(metadata);
63 StartAfterDelay(); 91 StartAfterDelay();
64 } 92 }
65 93
66 PluginsResourceService::~PluginsResourceService() { 94 PluginsResourceService::~PluginsResourceService() {
67 } 95 }
68 96
69 // static 97 // static
70 void PluginsResourceService::RegisterPrefs(PrefRegistrySimple* registry) { 98 void PluginsResourceService::RegisterPrefs(PrefRegistrySimple* registry) {
71 registry->RegisterDictionaryPref(prefs::kPluginsMetadata, 99 registry->RegisterDictionaryPref(prefs::kPluginsMetadata,
72 new base::DictionaryValue()); 100 new base::DictionaryValue());
73 registry->RegisterStringPref(prefs::kPluginsResourceCacheUpdate, "0"); 101 registry->RegisterStringPref(prefs::kPluginsResourceCacheUpdate, "0");
74 } 102 }
75 103
76 void PluginsResourceService::Unpack(const base::DictionaryValue& parsed_json) { 104 void PluginsResourceService::Unpack(const base::DictionaryValue& parsed_json) {
77 prefs_->Set(prefs::kPluginsMetadata, parsed_json); 105 prefs_->Set(prefs::kPluginsMetadata, parsed_json);
78 PluginFinder::GetInstance()->ReinitializePlugins(&parsed_json); 106 PluginFinder::GetInstance()->ReinitializePlugins(&parsed_json);
79 } 107 }
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