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

Side by Side Diff: chrome/browser/safe_browsing/incident_reporting/extension_data_collection.cc

Issue 2479593006: Move enable extensions define to a build flag. (Closed)
Patch Set: Merge Created 4 years, 1 month 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/safe_browsing/incident_reporting/extension_data_collect ion.h" 5 #include "chrome/browser/safe_browsing/incident_reporting/extension_data_collect ion.h"
6 6
7 #include "base/json/json_string_value_serializer.h" 7 #include "base/json/json_string_value_serializer.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/version.h" 9 #include "base/version.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/extensions/extension_util.h" 11 #include "chrome/browser/extensions/extension_util.h"
12 #include "chrome/browser/extensions/install_signer.h" 12 #include "chrome/browser/extensions/install_signer.h"
13 #include "chrome/browser/profiles/profile_manager.h" 13 #include "chrome/browser/profiles/profile_manager.h"
14 #include "chrome/browser/safe_browsing/incident_reporting/incident_reporting_ser vice.h" 14 #include "chrome/browser/safe_browsing/incident_reporting/incident_reporting_ser vice.h"
15 #include "chrome/common/safe_browsing/csd.pb.h" 15 #include "chrome/common/safe_browsing/csd.pb.h"
16 #include "extensions/browser/extension_prefs.h" 16 #include "extensions/browser/extension_prefs.h"
17 #include "extensions/browser/extension_prefs_factory.h" 17 #include "extensions/browser/extension_prefs_factory.h"
18 #include "extensions/browser/extension_registry.h" 18 #include "extensions/browser/extension_registry.h"
19 #include "extensions/browser/extension_registry_factory.h" 19 #include "extensions/browser/extension_registry_factory.h"
20 #include "extensions/common/extension_set.h" 20 #include "extensions/common/extension_set.h"
21 #include "extensions/common/manifest_constants.h" 21 #include "extensions/common/manifest_constants.h"
22 #include "extensions/features/features.h"
22 23
23 namespace safe_browsing { 24 namespace safe_browsing {
24 25
25 namespace { 26 namespace {
26 27
27 // Helper function to extract information from extension and extension_prefs 28 // Helper function to extract information from extension and extension_prefs
28 // into extension_info. 29 // into extension_info.
29 void PopulateExtensionInfo( 30 void PopulateExtensionInfo(
30 const extensions::Extension& extension, 31 const extensions::Extension& extension,
31 const extensions::ExtensionPrefs& extension_prefs, 32 const extensions::ExtensionPrefs& extension_prefs,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 extension_info->mutable_manifest()->swap(manifest_json); 94 extension_info->mutable_manifest()->swap(manifest_json);
94 95
95 extension_info->set_manifest_location_type(extension.manifest()->location()); 96 extension_info->set_manifest_location_type(extension.manifest()->location());
96 } 97 }
97 98
98 } // namespace 99 } // namespace
99 100
100 // Finds the last installed extension and adds relevant information to data's 101 // Finds the last installed extension and adds relevant information to data's
101 // last_installed_extension field. 102 // last_installed_extension field.
102 void CollectExtensionData(ClientIncidentReport_ExtensionData* data) { 103 void CollectExtensionData(ClientIncidentReport_ExtensionData* data) {
103 #if defined(ENABLE_EXTENSIONS) 104 #if BUILDFLAG(ENABLE_EXTENSIONS)
104 scoped_refptr<const extensions::Extension> last_installed_extension; 105 scoped_refptr<const extensions::Extension> last_installed_extension;
105 Profile* profile_for_last_installed_extension = nullptr; 106 Profile* profile_for_last_installed_extension = nullptr;
106 base::Time last_install_time; 107 base::Time last_install_time;
107 108
108 for (Profile* profile : 109 for (Profile* profile :
109 g_browser_process->profile_manager()->GetLoadedProfiles()) { 110 g_browser_process->profile_manager()->GetLoadedProfiles()) {
110 // Skip profiles for which the incident reporting service is not enabled. 111 // Skip profiles for which the incident reporting service is not enabled.
111 if (!IncidentReportingService::IsEnabledForProfile(profile)) 112 if (!IncidentReportingService::IsEnabledForProfile(profile))
112 continue; 113 continue;
113 114
(...skipping 18 matching lines...) Expand all
132 *last_installed_extension, 133 *last_installed_extension,
133 *extensions::ExtensionPrefs::Get(profile_for_last_installed_extension), 134 *extensions::ExtensionPrefs::Get(profile_for_last_installed_extension),
134 *extensions::ExtensionRegistryFactory::GetForBrowserContext( 135 *extensions::ExtensionRegistryFactory::GetForBrowserContext(
135 profile_for_last_installed_extension), 136 profile_for_last_installed_extension),
136 data->mutable_last_installed_extension()); 137 data->mutable_last_installed_extension());
137 } 138 }
138 #endif 139 #endif
139 } 140 }
140 141
141 } // namespace safe_browsing 142 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698