Make Ctrl + T from apps focus the new tab's omnibox on Linux and ChromeOS.
[chromium-blink-merge.git] / chromecast / crash / cast_crash_reporter_client.cc
blob8edbfa6b7b26eb91df051b3801d596a90944609b
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chromecast/crash/cast_crash_reporter_client.h"
7 #include "base/time/time.h"
8 #include "components/crash/app/breakpad_linux.h"
9 #include "content/public/common/content_switches.h"
11 namespace chromecast {
13 namespace {
15 char* g_process_type = NULL;
16 uint64_t g_process_start_time = 0;
18 } // namespace
20 // static
21 void CastCrashReporterClient::InitCrashReporter(
22 const std::string& process_type) {
23 g_process_start_time = (base::TimeTicks::Now() -
24 base::TimeTicks()).InMilliseconds();
26 // Save the process type (leaked).
27 // Note: "browser" process is identified by empty process type string.
28 const std::string& named_process_type(
29 process_type.empty() ? "browser" : process_type);
30 const size_t process_type_len = named_process_type.size() + 1;
31 g_process_type = new char[process_type_len];
32 strncpy(g_process_type, named_process_type.c_str(), process_type_len);
34 // Start up breakpad for this process, if applicable.
35 breakpad::InitCrashReporter(process_type);
38 // static
39 char* CastCrashReporterClient::GetProcessType() {
40 return g_process_type;
43 // static
44 uint64_t CastCrashReporterClient::GetProcessStartTime() {
45 return g_process_start_time;
48 CastCrashReporterClient::CastCrashReporterClient() {}
49 CastCrashReporterClient::~CastCrashReporterClient() {}
51 bool CastCrashReporterClient::EnableBreakpadForProcess(
52 const std::string& process_type) {
53 return process_type == switches::kRendererProcess ||
54 process_type == switches::kZygoteProcess ||
55 process_type == switches::kGpuProcess;
58 } // namespace chromecast