summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authoralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-08 18:17:31 +0000
committeralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-08 18:17:31 +0000
commit1136cdf45b24e517f1a91316f64aecb3d4b54ee1 (patch)
tree92b282a0f1917c85a5583add46fe9a2d7f6ad313 /remoting
parent0fc8f6a941546902247c09d3ae8a9b32af36261c (diff)
downloadchromium_src-1136cdf45b24e517f1a91316f64aecb3d4b54ee1.zip
chromium_src-1136cdf45b24e517f1a91316f64aecb3d4b54ee1.tar.gz
chromium_src-1136cdf45b24e517f1a91316f64aecb3d4b54ee1.tar.bz2
Make Chromoting Host report crashes to Breakpad (Windows only). The user must enable crash dumps collection by setting the "usagestats" value in the ClientState or ClientStateMedium key.
BUG=130678 TEST=remoting_unittests.BreakpadWinDeathTest Review URL: https://chromiumcodereview.appspot.com/10495003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141239 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/base/DEPS1
-rw-r--r--remoting/base/breakpad.h23
-rw-r--r--remoting/base/breakpad_linux.cc14
-rw-r--r--remoting/base/breakpad_mac.mm14
-rw-r--r--remoting/base/breakpad_win.cc213
-rw-r--r--remoting/base/breakpad_win_unittest.cc136
-rw-r--r--remoting/host/breakpad.h15
-rw-r--r--remoting/host/breakpad_win.cc60
-rw-r--r--remoting/host/constants.h9
-rw-r--r--remoting/host/constants_win.cc21
-rw-r--r--remoting/host/elevated_controller_module_win.cc7
-rw-r--r--remoting/host/host_service_win.cc8
-rw-r--r--remoting/host/host_ui.rc2
-rw-r--r--remoting/host/plugin/daemon_installer_win.cc10
-rw-r--r--remoting/host/remoting_me2me_host.cc7
-rw-r--r--remoting/remoting.gyp49
16 files changed, 578 insertions, 11 deletions
diff --git a/remoting/base/DEPS b/remoting/base/DEPS
index d7cdc30..7ef3114 100644
--- a/remoting/base/DEPS
+++ b/remoting/base/DEPS
@@ -1,4 +1,5 @@
include_rules = [
+ "+breakpad",
"+google/protobuf",
"+net",
"+third_party/zlib",
diff --git a/remoting/base/breakpad.h b/remoting/base/breakpad.h
new file mode 100644
index 0000000..7e1f0a4
--- /dev/null
+++ b/remoting/base/breakpad.h
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_BASE_BREAKPAD_H_
+#define REMOTING_BASE_BREAKPAD_H_
+
+namespace remoting {
+
+// Initializes collection and upload of crash reports. The caller has to ensure
+// that the user has agreed to crash dump reporting.
+//
+// Crash reporting has to be initialized as early as possible (e.g. the first
+// thing in main()) to catch crashes occured during the process startup.
+// The crashes occurred while invoking the static objects' constructors will not
+// be caught and reported. This should not be a problem as the static non POD
+// objects are not allowed by the style guide and exceptions to this rule are
+// rare.
+void InitializeCrashReporting();
+
+} // remoting
+
+#endif // REMOTING_BASE_BREAKPAD_H_
diff --git a/remoting/base/breakpad_linux.cc b/remoting/base/breakpad_linux.cc
new file mode 100644
index 0000000..a9f8c89
--- /dev/null
+++ b/remoting/base/breakpad_linux.cc
@@ -0,0 +1,14 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "remoting/base/breakpad.h"
+
+namespace remoting {
+
+void InitializeCrashReporting() {
+ // Crash dump collection is not implemented on Linux yet.
+ // http://crbug.com/130678.
+}
+
+} // namespace remoting
diff --git a/remoting/base/breakpad_mac.mm b/remoting/base/breakpad_mac.mm
new file mode 100644
index 0000000..7cfbec2
--- /dev/null
+++ b/remoting/base/breakpad_mac.mm
@@ -0,0 +1,14 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "remoting/base/breakpad.h"
+
+namespace remoting {
+
+void InitializeCrashReporting() {
+ // Do nothing because crash dump reporting on Mac is initialized from
+ // awakeFromNib method.
+}
+
+} // namespace remoting
diff --git a/remoting/base/breakpad_win.cc b/remoting/base/breakpad_win.cc
new file mode 100644
index 0000000..732c186
--- /dev/null
+++ b/remoting/base/breakpad_win.cc
@@ -0,0 +1,213 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This module contains the necessary code to register the Breakpad exception
+// handler. This implementation is based on Chrome/Crome Frame crash reporitng
+// code. See:
+// - src/chrome/app/breakpad_win.cc
+// - src/chrome_frame/crash_server_init.cc
+// - src/chrome/installer/setup/setup_main.cc
+// - src/chrome_frame/crash_reporting/crash_report.cc
+
+#include "remoting/base/breakpad.h"
+
+#include <windows.h>
+
+#include "base/atomicops.h"
+#include "base/logging.h"
+#include "base/file_version_info.h"
+#include "base/lazy_instance.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/process_util.h"
+#include "base/string16.h"
+#include "base/win/wrapped_window_proc.h"
+#include "breakpad/src/client/windows/handler/exception_handler.h"
+
+namespace remoting {
+void InitializeCrashReportingForTest(const wchar_t*);
+} // namespace remoting
+
+namespace {
+
+const wchar_t kBreakpadProductName[] = L"Chromoting";
+const wchar_t kBreakpadVersionEntry[] = L"ver";
+const wchar_t kBreakpadVersionDefault[] = L"0.1.0.0";
+const wchar_t kBreakpadProdEntry[] = L"prod";
+const wchar_t kBreakpadPlatformEntry[] = L"plat";
+const wchar_t kBreakpadPlatformWin32[] = L"Win32";
+
+// The protocol for connecting to the out-of-process Breakpad crash
+// reporter is different for x86-32 and x86-64: the message sizes
+// are different because the message struct contains a pointer. As
+// a result, there are two different named pipes to connect to. The
+// 64-bit one is distinguished with an "-x64" suffix.
+#if defined(_WIN64)
+const wchar_t kGoogleUpdatePipeName[] =
+ L"\\\\.\\pipe\\GoogleCrashServices\\S-1-5-18-x64";
+#else
+const wchar_t kGoogleUpdatePipeName[] =
+ L"\\\\.\\pipe\\GoogleCrashServices\\S-1-5-18";
+#endif
+
+using base::subtle::AtomicWord;
+using base::subtle::NoBarrier_CompareAndSwap;
+
+class BreakpadWin {
+ public:
+ BreakpadWin();
+ ~BreakpadWin();
+
+ static BreakpadWin& GetInstance();
+
+ private:
+ // Returns the Custom information to be used for crash reporting.
+ google_breakpad::CustomClientInfo* GetCustomInfo();
+
+ // Checks whether crash dump collection is allowed by the user.
+ bool IsCrashReportingEnabled();
+
+ // This callback is executed when the process has crashed and *before*
+ // the crash dump is created. To prevent duplicate crash reports we
+ // make every thread calling this method, except the very first one,
+ // go to sleep.
+ static bool OnExceptionCallback(void*, EXCEPTION_POINTERS*,
+ MDRawAssertionInfo*);
+
+ // Crashes the process after generating a dump for the provided exception.
+ // Note that the crash reporter should be initialized before calling this
+ // function for it to do anything.
+ static int OnWindowProcedureException(EXCEPTION_POINTERS* info);
+
+ // Breakpad's exception handler.
+ scoped_ptr<google_breakpad::ExceptionHandler> breakpad_;
+
+ // This flag is used to indicate that an exception is already being handled.
+ volatile AtomicWord handling_exception_;
+
+ // The testing hook below allows overriding the crash server pipe name.
+ static const wchar_t* pipe_name_;
+
+ friend void ::remoting::InitializeCrashReportingForTest(const wchar_t*);
+
+ DISALLOW_COPY_AND_ASSIGN(BreakpadWin);
+};
+
+// |LazyInstance| is used to guarantee that the exception handler will be
+// initialized exactly once.
+// N.B. LazyInstance does not allow this to be a static member of the class.
+static base::LazyInstance<BreakpadWin>::Leaky g_instance =
+ LAZY_INSTANCE_INITIALIZER;
+
+const wchar_t* BreakpadWin::pipe_name_ = kGoogleUpdatePipeName;
+
+BreakpadWin::BreakpadWin() : handling_exception_(0) {
+ // Disable the message box for assertions.
+ _CrtSetReportMode(_CRT_ASSERT, 0);
+
+ // Get the alternate dump directory. We use the temp path.
+ wchar_t temp_directory[MAX_PATH + 1] = { 0 };
+ DWORD length = ::GetTempPath(MAX_PATH, temp_directory);
+ if (length == 0)
+ return;
+
+ // Minidump with stacks, PEB, TEB, unloaded module list and memory referenced
+ // from stack.
+ MINIDUMP_TYPE dump_type = static_cast<MINIDUMP_TYPE>(
+ MiniDumpWithProcessThreadData |
+ MiniDumpWithUnloadedModules |
+ MiniDumpWithIndirectlyReferencedMemory);
+ breakpad_.reset(
+ new google_breakpad::ExceptionHandler(
+ temp_directory, &OnExceptionCallback, NULL, NULL,
+ google_breakpad::ExceptionHandler::HANDLER_ALL, dump_type,
+ pipe_name_, GetCustomInfo()));
+
+ if (breakpad_->IsOutOfProcess()) {
+ // Tells breakpad to handle breakpoint and single step exceptions.
+ breakpad_->set_handle_debug_exceptions(true);
+ }
+
+ // Catch exceptions thrown from a window procedure.
+ base::win::WinProcExceptionFilter exception_filter =
+ base::win::SetWinProcExceptionFilter(&OnWindowProcedureException);
+ CHECK(!exception_filter);
+}
+
+BreakpadWin::~BreakpadWin() {
+ // This object should be leaked so that crashes occurred during the process
+ // shutdown will be caught.
+ NOTREACHED();
+}
+
+// static
+BreakpadWin& BreakpadWin::GetInstance() {
+ return g_instance.Get();
+}
+
+// Returns the Custom information to be used for crash reporting.
+google_breakpad::CustomClientInfo* BreakpadWin::GetCustomInfo() {
+ HMODULE binary = base::GetModuleFromAddress(
+ reinterpret_cast<void*>(&remoting::InitializeCrashReporting));
+ scoped_ptr<FileVersionInfo> version_info(
+ FileVersionInfo::CreateFileVersionInfoForModule(binary));
+
+ string16 version;
+ if (version_info.get())
+ version = version_info->product_version();
+ if (version.empty())
+ version = kBreakpadVersionDefault;
+
+ static google_breakpad::CustomInfoEntry ver_entry(
+ kBreakpadVersionEntry, version.c_str());
+ static google_breakpad::CustomInfoEntry prod_entry(
+ kBreakpadProdEntry, kBreakpadProductName);
+ static google_breakpad::CustomInfoEntry plat_entry(
+ kBreakpadPlatformEntry, kBreakpadPlatformWin32);
+ static google_breakpad::CustomInfoEntry entries[] = {
+ ver_entry, prod_entry, plat_entry };
+ static google_breakpad::CustomClientInfo custom_info = {
+ entries, arraysize(entries) };
+ return &custom_info;
+}
+
+// static
+bool BreakpadWin::OnExceptionCallback(
+ void*, EXCEPTION_POINTERS*, MDRawAssertionInfo*) {
+ BreakpadWin& self = BreakpadWin::GetInstance();
+ if (NoBarrier_CompareAndSwap(&self.handling_exception_, 0, 1) != 0) {
+ // Capture every thread except the first one in the sleep. We don't
+ // want multiple threads to concurrently report exceptions.
+ ::Sleep(INFINITE);
+ }
+ return true;
+}
+
+// static
+int BreakpadWin::OnWindowProcedureException(EXCEPTION_POINTERS* info) {
+ BreakpadWin& self = BreakpadWin::GetInstance();
+ if (self.breakpad_.get() != NULL) {
+ self.breakpad_->WriteMinidumpForException(info);
+ ::TerminateProcess(::GetCurrentProcess(),
+ info->ExceptionRecord->ExceptionCode);
+ }
+ return EXCEPTION_CONTINUE_SEARCH;
+}
+
+} // namespace
+
+namespace remoting {
+
+void InitializeCrashReporting() {
+ // Touch the object to make sure it is initialized.
+ BreakpadWin::GetInstance();
+}
+
+void InitializeCrashReportingForTest(const wchar_t* pipe_name) {
+ BreakpadWin::pipe_name_ = pipe_name;
+
+ // Touch the object to make sure it is initialized.
+ BreakpadWin::GetInstance();
+}
+
+} // namespace remoting
diff --git a/remoting/base/breakpad_win_unittest.cc b/remoting/base/breakpad_win_unittest.cc
new file mode 100644
index 0000000..d0b59a0
--- /dev/null
+++ b/remoting/base/breakpad_win_unittest.cc
@@ -0,0 +1,136 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stdio.h>
+
+#include "base/compiler_specific.h"
+#include "base/environment.h"
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/string16.h"
+#include "base/stringprintf.h"
+#include "base/utf_string_conversions.h"
+#include "breakpad/src/client/windows/crash_generation/client_info.h"
+#include "breakpad/src/client/windows/crash_generation/crash_generation_server.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace remoting {
+
+namespace {
+
+// The name of the environment variable used to pass the crash server pipe name
+// to the crashing child process.
+const char kPipeVariableName[] = "REMOTING_BREAKPAD_WIN_DEATH_TEST_PIPE_NAME";
+
+// The prefix string used to generate a unique crash server pipe name.
+// The name has to be unique as multiple test instances can be running
+// simultaneously.
+const wchar_t kPipeNamePrefix[] = L"\\\\.\\pipe\\";
+
+class MockCrashServerCallbacks {
+ public:
+ MockCrashServerCallbacks() {}
+ virtual ~MockCrashServerCallbacks() {}
+
+ // |google_breakpad::CrashGenerationServer| invokes callbacks from artitrary
+ // thread pool threads. |OnClientDumpRequested| is the only one that happened
+ // to be called in synchronous manner. While it is still called on
+ // a thread pool thread, the crashing process will wait until the server
+ // signals an event after |OnClientDumpRequested| completes (or until 15
+ // seconds timeout expires).
+ MOCK_METHOD0(OnClientDumpRequested, void());
+
+ static void OnClientDumpRequestCallback(
+ void* context,
+ const google_breakpad::ClientInfo* client_info,
+ const string16* file_path) {
+ reinterpret_cast<MockCrashServerCallbacks*>(context)->
+ OnClientDumpRequested();
+ }
+};
+
+} // namespace
+
+void InitializeCrashReportingForTest(const wchar_t*);
+
+class BreakpadWinDeathTest : public testing::Test {
+ public:
+ BreakpadWinDeathTest() {}
+ virtual void SetUp() OVERRIDE {
+ scoped_ptr<base::Environment> environment(base::Environment::Create());
+ std::string pipe_name;
+ if (environment->GetVar(kPipeVariableName, &pipe_name)) {
+ // This is a child process. Initialize crash dump reporting to the crash
+ // dump server.
+ pipe_name_ = UTF8ToUTF16(pipe_name);
+ ::remoting::InitializeCrashReportingForTest(pipe_name_.c_str());
+ } else {
+ // This is the parent process. Generate a unique pipe name and setup
+ // a dummy crash dump server.
+ UUID guid = {0};
+ RPC_STATUS status = ::UuidCreate(&guid);
+ EXPECT_TRUE(status == RPC_S_OK || status == RPC_S_UUID_LOCAL_ONLY);
+
+ pipe_name_ = kPipeNamePrefix +
+ base::StringPrintf(
+ L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+ guid.Data1, guid.Data2, guid.Data3,
+ guid.Data4[0], guid.Data4[1], guid.Data4[2],
+ guid.Data4[3], guid.Data4[4], guid.Data4[5],
+ guid.Data4[6], guid.Data4[7]);
+ bool result = environment->SetVar(kPipeVariableName,
+ UTF16ToUTF8(pipe_name_));
+ EXPECT_TRUE(result);
+
+ // Setup a dummy crash dump server.
+ callbacks_.reset(new MockCrashServerCallbacks());
+ crash_server_.reset(
+ new google_breakpad::CrashGenerationServer(
+ pipe_name_, NULL,
+ NULL, 0,
+ MockCrashServerCallbacks::OnClientDumpRequestCallback,
+ callbacks_.get(),
+ NULL, 0,
+ false, NULL));
+
+ result = crash_server_->Start();
+ ASSERT_TRUE(result);
+ }
+ }
+
+ protected:
+ scoped_ptr<google_breakpad::CrashGenerationServer> crash_server_;
+ scoped_ptr<MockCrashServerCallbacks> callbacks_;
+ string16 pipe_name_;
+};
+
+TEST_F(BreakpadWinDeathTest, TestAccessViolation) {
+ if (callbacks_.get()) {
+ EXPECT_CALL(*callbacks_, OnClientDumpRequested());
+ }
+
+ // Generate access violation exception.
+ ASSERT_DEATH(*reinterpret_cast<int*>(0) = 1, "");
+}
+
+TEST_F(BreakpadWinDeathTest, TestInvalidParameter) {
+ if (callbacks_.get()) {
+ EXPECT_CALL(*callbacks_, OnClientDumpRequested());
+ }
+
+ // Cause the invalid parameter callback to be called.
+ ASSERT_EXIT(printf(NULL), ::testing::ExitedWithCode(0), "");
+}
+
+TEST_F(BreakpadWinDeathTest, TestDebugbreak) {
+ if (callbacks_.get()) {
+ EXPECT_CALL(*callbacks_, OnClientDumpRequested());
+ }
+
+ // See if __debugbreak() is intercepted.
+ ASSERT_DEATH(__debugbreak(), "");
+}
+
+} // namespace remoting
diff --git a/remoting/host/breakpad.h b/remoting/host/breakpad.h
new file mode 100644
index 0000000..bd13b98
--- /dev/null
+++ b/remoting/host/breakpad.h
@@ -0,0 +1,15 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_HOST_BREAKPAD_H_
+#define REMOTING_HOST_BREAKPAD_H_
+
+namespace remoting {
+
+// Returns true if the user has agreed to crash dump collection and uploading.
+bool IsCrashReportingEnabled();
+
+} // remoting
+
+#endif // REMOTING_HOST_BREAKPAD_H_
diff --git a/remoting/host/breakpad_win.cc b/remoting/host/breakpad_win.cc
new file mode 100644
index 0000000..a2623eb
--- /dev/null
+++ b/remoting/host/breakpad_win.cc
@@ -0,0 +1,60 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "remoting/host/breakpad.h"
+
+#include <windows.h>
+
+#include "base/string16.h"
+#include "base/stringprintf.h"
+#include "base/win/registry.h"
+#include "remoting/host/constants.h"
+
+namespace {
+
+// The following strings are used to construct the registry key names where
+// the user's consent to collect crash dumps is recorded.
+const wchar_t kOmahaClientStateKeyFormat[] = L"Google\\Update\\%ls\\%ls";
+const wchar_t kOmahaClientState[] = L"ClientState";
+const wchar_t kOmahaClientStateMedium[] = L"ClientStateMedium";
+const wchar_t kOmahaUsagestatsValue[] = L"usagestats";
+
+} // namespace
+
+namespace remoting {
+
+bool IsCrashReportingEnabled() {
+ // The user's consent to collect crash dumps is recored as the "usagestats"
+ // value in the ClientState or ClientStateMedium key. Probe
+ // the ClientStateMedium key first.
+ string16 client_state = StringPrintf(kOmahaClientStateKeyFormat,
+ kOmahaClientStateMedium,
+ remoting::kHostOmahaAppid);
+ base::win::RegKey key;
+ LONG result = key.Open(HKEY_LOCAL_MACHINE, client_state.c_str(), KEY_READ);
+ if (result == ERROR_SUCCESS) {
+ DWORD value = 0;
+ result = key.ReadValueDW(kOmahaUsagestatsValue, &value);
+ if (result == ERROR_SUCCESS) {
+ return value != 0;
+ }
+ }
+
+ client_state = StringPrintf(kOmahaClientStateKeyFormat,
+ kOmahaClientState,
+ remoting::kHostOmahaAppid);
+ result = key.Open(HKEY_LOCAL_MACHINE, client_state.c_str(), KEY_READ);
+ if (result == ERROR_SUCCESS) {
+ DWORD value = 0;
+ result = key.ReadValueDW(kOmahaUsagestatsValue, &value);
+ if (result == ERROR_SUCCESS) {
+ return value != 0;
+ }
+ }
+
+ // Do not collect anything unless the user has explicitly allowed it.
+ return false;
+}
+
+} // namespace remoting
diff --git a/remoting/host/constants.h b/remoting/host/constants.h
index 9654aff..9358583 100644
--- a/remoting/host/constants.h
+++ b/remoting/host/constants.h
@@ -5,6 +5,8 @@
#ifndef REMOTING_HOST_CONSTANTS_H_
#define REMOTING_HOST_CONSTANTS_H_
+#include "base/string16.h"
+
namespace remoting {
// Known host exit codes.
@@ -24,6 +26,13 @@ enum HostExitCodes {
kMaxPermanentErrorExitCode = kInvalidOauthCredentialsExitCode
};
+#if defined(OS_WIN)
+
+// The Omaha Appid of the host.
+extern const char16 kHostOmahaAppid[];
+
+#endif // defined(OS_WIN)
+
} // namespace remoting
#endif // REMOTING_HOST_CONSTANTS_H_
diff --git a/remoting/host/constants_win.cc b/remoting/host/constants_win.cc
new file mode 100644
index 0000000..e13ce81
--- /dev/null
+++ b/remoting/host/constants_win.cc
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "remoting/host/constants.h"
+
+#include "base/stringize_macros.h"
+
+namespace remoting {
+
+#if defined(OS_WIN)
+
+// The Omaha Appid of the host. It should be kept in sync with $(var.OmahaAppid)
+// defined in remoting/host/installer/chromoting.wxs and the Omaha server
+// configuration.
+const char16 kHostOmahaAppid[] =
+ TO_L_STRING("{b210701e-ffc4-49e3-932b-370728c72662}");
+
+#endif // defined(OS_WIN)
+
+} // namespace remoting
diff --git a/remoting/host/elevated_controller_module_win.cc b/remoting/host/elevated_controller_module_win.cc
index 6f7c8a2..80e9233 100644
--- a/remoting/host/elevated_controller_module_win.cc
+++ b/remoting/host/elevated_controller_module_win.cc
@@ -10,7 +10,9 @@
#include "base/command_line.h"
#include "base/file_path.h"
#include "base/logging.h"
+#include "remoting/base/breakpad.h"
#include "remoting/host/branding.h"
+#include "remoting/host/breakpad.h"
// MIDL-generated declarations.
#include "remoting/host/elevated_controller.h"
@@ -29,6 +31,11 @@ class ElevatedControllerModuleWin
remoting::ElevatedControllerModuleWin _AtlModule;
int WINAPI WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int command) {
+ // Initializes the crash dump reports.
+ if (remoting::IsCrashReportingEnabled()) {
+ remoting::InitializeCrashReporting();
+ }
+
CommandLine::Init(0, NULL);
// Register and initialize common controls.
diff --git a/remoting/host/host_service_win.cc b/remoting/host/host_service_win.cc
index 77d8cc7..e9614ba 100644
--- a/remoting/host/host_service_win.cc
+++ b/remoting/host/host_service_win.cc
@@ -23,9 +23,10 @@
#include "base/stringprintf.h"
#include "base/threading/thread.h"
#include "base/win/wrapped_window_proc.h"
-
+#include "remoting/base/breakpad.h"
#include "remoting/base/scoped_sc_handle_win.h"
#include "remoting/host/branding.h"
+#include "remoting/host/breakpad.h"
#include "remoting/host/host_service_resource.h"
#include "remoting/host/wts_console_observer_win.h"
#include "remoting/host/wts_session_process_launcher_win.h"
@@ -410,6 +411,11 @@ LRESULT CALLBACK HostService::SessionChangeNotificationProc(HWND hwnd,
} // namespace remoting
int main(int argc, char** argv) {
+ // Initializes the crash dump reports.
+ if (remoting::IsCrashReportingEnabled()) {
+ remoting::InitializeCrashReporting();
+ }
+
CommandLine::Init(argc, argv);
// This object instance is required by Chrome code (for example,
diff --git a/remoting/host/host_ui.rc b/remoting/host/host_ui.rc
index a15a5cc..d1e2d5a 100644
--- a/remoting/host/host_ui.rc
+++ b/remoting/host/host_ui.rc
@@ -8,7 +8,6 @@
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
-#include "constants.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@@ -36,7 +35,6 @@ END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
- "#include ""constants.h""\r\n"
"\0"
END
diff --git a/remoting/host/plugin/daemon_installer_win.cc b/remoting/host/plugin/daemon_installer_win.cc
index 6eedd96..b502314 100644
--- a/remoting/host/plugin/daemon_installer_win.cc
+++ b/remoting/host/plugin/daemon_installer_win.cc
@@ -24,6 +24,8 @@ namespace omaha {
#include "google_update/google_update_idl.h"
} // namespace omaha
+#include "remoting/host/constants.h"
+
using base::win::ScopedBstr;
using base::win::ScopedComPtr;
@@ -44,10 +46,6 @@ const char16 kGoogleUpdateCommandLineFormat[] =
TO_L_STRING("\"%ls\" /install \"bundlename=Chromoting%%20Host&appguid=%ls&")
TO_L_STRING("appname=Chromoting%%20Host&needsadmin=True&lang=%ls\"");
-// The Omaha Appid of the host.
-const char16 kOmahaAppid[] =
- TO_L_STRING("{b210701e-ffc4-49e3-932b-370728c72662}");
-
// TODO(alexeypa): Get the desired laungage from the web app.
const char16 kOmahaLanguage[] = TO_L_STRING("en");
@@ -143,7 +141,7 @@ void DaemonComInstallerWin::Install() {
}
// Add Chromoting Host to the bundle.
- ScopedBstr appid(kOmahaAppid);
+ ScopedBstr appid(kHostOmahaAppid);
ScopedBstr empty(kOmahaEmpty);
ScopedBstr language(kOmahaLanguage);
hr = bundle_->createApp(appid, empty, language, empty);
@@ -292,7 +290,7 @@ void DaemonCommandLineInstallerWin::Install() {
string16 command_line =
StringPrintf(kGoogleUpdateCommandLineFormat,
google_update.c_str(),
- kOmahaAppid,
+ kHostOmahaAppid,
kOmahaLanguage);
base::LaunchOptions options;
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc
index 30d44dc..739efce 100644
--- a/remoting/host/remoting_me2me_host.cc
+++ b/remoting/host/remoting_me2me_host.cc
@@ -21,8 +21,10 @@
#include "build/build_config.h"
#include "crypto/nss_util.h"
#include "net/base/network_change_notifier.h"
+#include "remoting/base/breakpad.h"
#include "remoting/base/constants.h"
#include "remoting/host/branding.h"
+#include "remoting/host/breakpad.h"
#include "remoting/host/constants.h"
#include "remoting/host/capturer.h"
#include "remoting/host/chromoting_host.h"
@@ -557,6 +559,11 @@ int CALLBACK WinMain(HINSTANCE instance,
HINSTANCE previous_instance,
LPSTR command_line,
int show_command) {
+ // Initializes the crash dump reports.
+ if (remoting::IsCrashReportingEnabled()) {
+ remoting::InitializeCrashReporting();
+ }
+
g_hModule = instance;
// Register and initialize common controls.
diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp
index cd1cd40..dce6863 100644
--- a/remoting/remoting.gyp
+++ b/remoting/remoting.gyp
@@ -501,6 +501,7 @@
],
'dependencies': [
'../base/base.gyp:base',
+ 'remoting_breakpad',
'remoting_elevated_controller',
'remoting_protocol',
'remoting_version_resources',
@@ -508,6 +509,8 @@
'sources': [
'host/branding.cc',
'host/branding.h',
+ 'host/breakpad.h',
+ 'host/breakpad_win.cc',
'host/elevated_controller.rc',
'host/elevated_controller_module_win.cc',
'host/elevated_controller_win.cc',
@@ -546,15 +549,19 @@
'../base/base.gyp:base_static',
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'../ipc/ipc.gyp:ipc',
+ 'remoting_breakpad',
'remoting_version_resources',
],
'sources': [
'base/scoped_sc_handle_win.h',
'host/branding.cc',
'host/branding.h',
+ 'host/breakpad.h',
+ 'host/breakpad_win.cc',
'host/chromoting_messages.cc',
'host/chromoting_messages.h',
'host/constants.h',
+ 'host/constants_win.cc',
'host/host_service.rc',
'host/host_service_resource.h',
'host/host_service_win.cc',
@@ -769,6 +776,30 @@
'targets': [
{
+ 'target_name': 'remoting_breakpad',
+ 'type': 'static_library',
+ 'variables': { 'enable_wexit_time_destructors': 1, },
+ 'dependencies': [
+ '../base/base.gyp:base',
+ ],
+ 'sources': [
+ 'base/breakpad.h',
+ 'base/breakpad_linux.cc',
+ 'base/breakpad_mac.mm',
+ 'base/breakpad_win.cc',
+ 'host/constants.h',
+ 'host/constants_win.cc',
+ ],
+ 'conditions': [
+ ['OS=="win"', {
+ 'dependencies': [
+ '../breakpad/breakpad.gyp:breakpad_handler',
+ ],
+ }],
+ ],
+ }, # end of target 'remoting_breakpad'
+
+ {
'target_name': 'remoting_client_plugin',
'type': 'static_library',
'variables': { 'enable_wexit_time_destructors': 1, },
@@ -1078,6 +1109,7 @@
'host/clipboard_mac.mm',
'host/clipboard_win.cc',
'host/constants.h',
+ 'host/constants_win.cc',
'host/continue_window.h',
'host/continue_window_gtk.cc',
'host/continue_window_mac.mm',
@@ -1289,6 +1321,7 @@
'variables': { 'enable_wexit_time_destructors': 1, },
'dependencies': [
'remoting_base',
+ 'remoting_breakpad',
'remoting_host',
'remoting_jingle_glue',
'../base/base.gyp:base',
@@ -1298,6 +1331,8 @@
'sources': [
'host/branding.cc',
'host/branding.h',
+ 'host/breakpad.h',
+ 'host/breakpad_win.cc',
'host/host_event_logger.h',
'host/sighup_listener_mac.cc',
'host/sighup_listener_mac.h',
@@ -1590,6 +1625,7 @@
'type': 'executable',
'dependencies': [
'remoting_base',
+ 'remoting_breakpad',
'remoting_client',
'remoting_client_plugin',
'remoting_host',
@@ -1610,6 +1646,9 @@
],
'sources': [
'base/auth_token_util_unittest.cc',
+ 'base/base_mock_objects.cc',
+ 'base/base_mock_objects.h',
+ 'base/breakpad_win_unittest.cc',
'base/codec_test.cc',
'base/codec_test.h',
'base/compound_buffer_unittest.cc',
@@ -1619,8 +1658,6 @@
'base/encode_decode_unittest.cc',
'base/encoder_vp8_unittest.cc',
'base/encoder_row_based_unittest.cc',
- 'base/base_mock_objects.cc',
- 'base/base_mock_objects.h',
'base/util_unittest.cc',
'client/key_event_mapper_unittest.cc',
'client/plugin/mac_key_event_processor_unittest.cc',
@@ -1679,9 +1716,17 @@
],
'conditions': [
[ 'OS=="win"', {
+ 'include_dirs': [
+ '../breakpad/src',
+ ],
'dependencies': [
'../ipc/ipc.gyp:ipc'
],
+ 'link_settings': {
+ 'libraries': [
+ '-lrpcrt4.lib',
+ ],
+ },
}],
['chromeos != 0', {
'dependencies!': [