summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-30 01:39:02 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-30 01:39:02 +0000
commit1e4c4560f20ac0802cfa71a25dd040eae801c8da (patch)
tree1aa59f089163cff17e0316e72bbcef1dca85e9e8 /chrome/common
parent036e91c7ed0104d4d147a2937814694d03e4a74b (diff)
downloadchromium_src-1e4c4560f20ac0802cfa71a25dd040eae801c8da.zip
chromium_src-1e4c4560f20ac0802cfa71a25dd040eae801c8da.tar.gz
chromium_src-1e4c4560f20ac0802cfa71a25dd040eae801c8da.tar.bz2
Report active extensions in crash reports. This only implements Windows right now. Mac and linux will be separate CLs.
"Active" is overloaded to mean different things depending on the process type: - browser: all enabled extensions - renderer: unique set of extensions from all user scripts - extension: extensions running in the process BUG=27169 Review URL: http://codereview.chromium.org/437078 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33255 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/child_process_logging.h10
-rw-r--r--chrome/common/child_process_logging_linux.cc4
-rw-r--r--chrome/common/child_process_logging_mac.mm5
-rw-r--r--chrome/common/child_process_logging_win.cc25
4 files changed, 44 insertions, 0 deletions
diff --git a/chrome/common/child_process_logging.h b/chrome/common/child_process_logging.h
index aa336af..513359f 100644
--- a/chrome/common/child_process_logging.h
+++ b/chrome/common/child_process_logging.h
@@ -5,6 +5,8 @@
#ifndef CHROME_COMMON_CHILD_PROCESS_LOGGING_H_
#define CHROME_COMMON_CHILD_PROCESS_LOGGING_H_
+#include <vector>
+
#include "base/basictypes.h"
#include "googleurl/src/gurl.h"
@@ -17,6 +19,14 @@ void SetActiveURL(const GURL& url);
// Sets the Client ID that is used as GUID if a Chrome process crashes.
void SetClientId(const std::string& client_id);
+// Sets the list of "active" extensions in this process. We overload "active" to
+// mean different things depending on the process type:
+// - browser: all enabled extensions
+// - renderer: the unique set of extension ids from all content scripts
+// - extension: the id of each extension running in this process (there can be
+// multiple because of process collapsing).
+void SetActiveExtensions(const std::vector<std::string>& extension_ids);
+
// Simple wrapper class that sets the active URL in it's constructor and clears
// the active URL in the destructor.
class ScopedActiveURLSetter {
diff --git a/chrome/common/child_process_logging_linux.cc b/chrome/common/child_process_logging_linux.cc
index 9b51303..0b54010 100644
--- a/chrome/common/child_process_logging_linux.cc
+++ b/chrome/common/child_process_logging_linux.cc
@@ -31,4 +31,8 @@ void SetClientId(const std::string& client_id) {
std::wstring wstr = ASCIIToWide(str);
GoogleUpdateSettings::SetMetricsId(wstr);
}
+
+void SetActiveExtensions(const std::vector<std::string> extension_ids) {
+ // TODO(port)
+}
} // namespace child_process_logging
diff --git a/chrome/common/child_process_logging_mac.mm b/chrome/common/child_process_logging_mac.mm
index 9e89c01..8ed617d 100644
--- a/chrome/common/child_process_logging_mac.mm
+++ b/chrome/common/child_process_logging_mac.mm
@@ -91,4 +91,9 @@ void SetClientId(const std::string& client_id) {
std::wstring wstr = ASCIIToWide(str);
GoogleUpdateSettings::SetMetricsId(wstr);
}
+
+void SetActiveExtensions(const std::vector<std::string> extension_ids) {
+ // TODO(port)
+}
+
} // namespace child_process_logging
diff --git a/chrome/common/child_process_logging_win.cc b/chrome/common/child_process_logging_win.cc
index 94b77d8..9a11e8f 100644
--- a/chrome/common/child_process_logging_win.cc
+++ b/chrome/common/child_process_logging_win.cc
@@ -7,6 +7,7 @@
#include <windows.h>
#include "base/string_util.h"
+#include "chrome/app/breakpad_win.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/installer/util/google_update_settings.h"
#include "googleurl/src/gurl.h"
@@ -18,6 +19,10 @@ typedef void (__cdecl *MainSetActiveURL)(const wchar_t*);
// exported in breakpad_win.cc: void __declspec(dllexport) __cdecl SetClientId.
typedef void (__cdecl *MainSetClientId)(const wchar_t*);
+// exported in breakpad_win.cc:
+// void __declspec(dllexport) __cdecl SetExtensionID.
+typedef void (__cdecl *MainSetExtensionID)(size_t, const wchar_t*);
+
void SetActiveURL(const GURL& url) {
static MainSetActiveURL set_active_url = NULL;
// note: benign race condition on set_active_url.
@@ -61,4 +66,24 @@ void SetClientId(const std::string& client_id) {
(set_client_id)(wstr.c_str());
}
+void SetActiveExtensions(const std::vector<std::string>& extension_ids) {
+ static MainSetExtensionID set_extension_id = NULL;
+ if (!set_extension_id) {
+ HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName);
+ if (!exe_module)
+ return;
+ set_extension_id = reinterpret_cast<MainSetExtensionID>(
+ GetProcAddress(exe_module, "SetExtensionID"));
+ if (!set_extension_id)
+ return;
+ }
+
+ for (size_t i = 0; i < kMaxReportedActiveExtensions; ++i) {
+ if (i < extension_ids.size())
+ (set_extension_id)(i, ASCIIToWide(extension_ids[i].c_str()).c_str());
+ else
+ (set_extension_id)(i, L"");
+ }
+}
+
} // namespace child_process_logging