summaryrefslogtreecommitdiffstats
path: root/chrome/browser/feedback/feedback_data.cc
diff options
context:
space:
mode:
authorrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-11 07:28:06 +0000
committerrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-11 07:28:06 +0000
commit051d04ff3e3c99c662992f5f885ebc39879cb6a3 (patch)
tree36860a417dda85a84d58e107997fabb05997e67a /chrome/browser/feedback/feedback_data.cc
parentaf206c113e16256610122d567ac043ec26652cc7 (diff)
downloadchromium_src-051d04ff3e3c99c662992f5f885ebc39879cb6a3.zip
chromium_src-051d04ff3e3c99c662992f5f885ebc39879cb6a3.tar.gz
chromium_src-051d04ff3e3c99c662992f5f885ebc39879cb6a3.tar.bz2
Send list of extensions with feedback reports.
If crash reporting is enabled, send the list of extensions installed on a ChromeOS machine with the feedback report. R=tbarzic@chromium.org BUG=158154 TEST=Verify that the list of extensions shows up in a feedback report, and only if crash reporting is enabled. Review URL: https://chromiumcodereview.appspot.com/11280317 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172273 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/feedback/feedback_data.cc')
-rw-r--r--chrome/browser/feedback/feedback_data.cc43
1 files changed, 43 insertions, 0 deletions
diff --git a/chrome/browser/feedback/feedback_data.cc b/chrome/browser/feedback/feedback_data.cc
index 45bad23..403d4ee 100644
--- a/chrome/browser/feedback/feedback_data.cc
+++ b/chrome/browser/feedback/feedback_data.cc
@@ -6,10 +6,16 @@
#include "base/json/json_string_value_serializer.h"
#include "base/values.h"
+#include "chrome/browser/browser_process.h"
+#include "chrome/browser/chromeos/settings/cros_settings.h"
+#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/feedback/feedback_util.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/sync/about_sync_util.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
+#include "chrome/common/extensions/extension.h"
+#include "chrome/common/extensions/extension_set.h"
#include "content/public/browser/browser_thread.h"
using content::BrowserThread;
@@ -19,6 +25,8 @@ using content::BrowserThread;
// log data source once crbug.com/138582 is fixed.
namespace {
+const char kExtensionsListKey[] = "extensions";
+
void AddSyncLogs(chromeos::system::LogDictionaryType* logs) {
Profile* profile = ProfileManager::GetDefaultProfile();
if (!ProfileSyncServiceFactory::GetInstance()->HasProfileSyncService(
@@ -55,6 +63,40 @@ void AddSyncLogs(chromeos::system::LogDictionaryType* logs) {
(*logs)[kSyncDataKey] = sync_logs_string;
}
+void AddExtensionInfoLogs(chromeos::system::LogDictionaryType* logs) {
+ bool reporting_enabled = false;
+ chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref,
+ &reporting_enabled);
+ if (!reporting_enabled)
+ return;
+
+ Profile* default_profile =
+ g_browser_process->profile_manager()->GetDefaultProfile();
+ if (!default_profile)
+ return;
+
+ ExtensionService* service =
+ extensions::ExtensionSystem::Get(default_profile)->extension_service();
+ if (!service)
+ return;
+
+ std::string extensions_list;
+ const ExtensionSet* extensions = service->extensions();
+ for (ExtensionSet::const_iterator it = extensions->begin();
+ it != extensions->end();
+ ++it) {
+ const extensions::Extension* extension = *it;
+ if (extensions_list.empty()) {
+ extensions_list = extension->name();
+ } else {
+ extensions_list += ", " + extension->name();
+ }
+ }
+
+ if (!extensions_list.empty())
+ (*logs)[kExtensionsListKey] = extensions_list;
+}
+
}
#endif // OS_CHROMEOS
@@ -158,6 +200,7 @@ void FeedbackData::SyslogsComplete(chromeos::system::LogDictionaryType* logs,
// TODO(rkc): Move to the correct place once crbug.com/138582 is done.
AddSyncLogs(logs);
+ AddExtensionInfoLogs(logs);
// Will get deleted when SendReport() is called.
zip_content_ = zip_content;