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

Side by Side Diff: chrome/app/chrome_breakpad_client.cc

Issue 19697015: Move dependency on env_vars.h to breakpad client (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 7 years, 5 months 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 | Annotate | Revision Log
« no previous file with comments | « chrome/app/chrome_breakpad_client.h ('k') | components/breakpad/breakpad_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/app/chrome_breakpad_client.h" 5 #include "chrome/app/chrome_breakpad_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/environment.h" 8 #include "base/environment.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/strings/string_split.h"
13 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
14 #include "chrome/common/chrome_paths.h" 15 #include "chrome/common/chrome_paths.h"
15 #include "chrome/common/chrome_switches.h" 16 #include "chrome/common/chrome_switches.h"
16 #include "chrome/common/crash_keys.h" 17 #include "chrome/common/crash_keys.h"
18 #include "chrome/common/env_vars.h"
17 19
18 #if defined(OS_WIN) 20 #if defined(OS_WIN)
19 #include "base/file_version_info.h" 21 #include "base/file_version_info.h"
20 #endif 22 #endif
21 23
22 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_IOS) 24 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_IOS)
23 #include "chrome/common/chrome_version_info_posix.h" 25 #include "chrome/common/chrome_version_info_posix.h"
24 #endif 26 #endif
25 27
26 #if defined(OS_POSIX) 28 #if defined(OS_POSIX)
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 *product_name = version_info->product_short_name(); 75 *product_name = version_info->product_short_name();
74 } 76 }
75 77
76 *special_build = version_info->special_build(); 78 *special_build = version_info->special_build();
77 } else { 79 } else {
78 // No version info found. Make up the values. 80 // No version info found. Make up the values.
79 *product_name = base::ASCIIToUTF16("Chrome"); 81 *product_name = base::ASCIIToUTF16("Chrome");
80 *version = base::ASCIIToUTF16("0.0.0.0-devel"); 82 *version = base::ASCIIToUTF16("0.0.0.0-devel");
81 } 83 }
82 } 84 }
85
86 bool ChromeBreakpadClient::ShouldShowRestartDialog(base::string16* title,
87 base::string16* message,
88 bool* is_rtl_locale) {
89 scoped_ptr<base::Environment> env(base::Environment::Create());
90 if (!env->HasVar(env_vars::kShowRestart) ||
91 !env->HasVar(env_vars::kRestartInfo)) {
marja 2013/07/19 08:20:33 Nit: no { } for one-line bodies, even if the "if"
jochen (gone - plz use gerrit) 2013/07/19 08:23:51 where's that rule from?
marja 2013/07/19 08:31:56 Hmmh! I might be misinformed! Atm the style guide
92 return false;
93 }
94
95 std::string restart_info;
96 env->GetVar(env_vars::kRestartInfo, &restart_info);
97
98 // The CHROME_RESTART var contains the dialog strings separated by '|'.
99 // See ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment()
100 // for details.
101 std::vector<std::string> dlg_strings;
102 base::SplitString(restart_info, '|', &dlg_strings);
103
104 if (dlg_strings.size() < 3)
105 return false;
106
107 *title = base::ASCIIToUTF16(dlg_strings[0]);
108 *message = base::ASCIIToUTF16(dlg_strings[0]);
109 *is_rtl_locale = dlg_strings[2] == env_vars::kRtlLocale;
110 return true;
111 }
112
113 bool ChromeBreakpadClient::AboutToRestart() {
114 scoped_ptr<base::Environment> env(base::Environment::Create());
115 if (!env->HasVar(env_vars::kRestartInfo))
116 return false;
117
118 env->SetVar(env_vars::kShowRestart, "1");
119 return true;
120 }
83 #endif 121 #endif
84 122
85 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_IOS) 123 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_IOS)
86 void ChromeBreakpadClient::GetProductNameAndVersion(std::string* product_name, 124 void ChromeBreakpadClient::GetProductNameAndVersion(std::string* product_name,
87 std::string* version) { 125 std::string* version) {
88 DCHECK(product_name); 126 DCHECK(product_name);
89 DCHECK(version); 127 DCHECK(version);
90 #if defined(OS_ANDROID) 128 #if defined(OS_ANDROID)
91 *product_name = "Chrome_Android"; 129 *product_name = "Chrome_Android";
92 #elif defined(OS_CHROMEOS) 130 #elif defined(OS_CHROMEOS)
(...skipping 27 matching lines...) Expand all
120 #if defined(OS_POSIX) 158 #if defined(OS_POSIX)
121 void ChromeBreakpadClient::SetDumpWithoutCrashingFunction(void (*function)()) { 159 void ChromeBreakpadClient::SetDumpWithoutCrashingFunction(void (*function)()) {
122 logging::SetDumpWithoutCrashingFunction(function); 160 logging::SetDumpWithoutCrashingFunction(function);
123 } 161 }
124 #endif 162 #endif
125 163
126 size_t ChromeBreakpadClient::RegisterCrashKeys() { 164 size_t ChromeBreakpadClient::RegisterCrashKeys() {
127 return crash_keys::RegisterChromeCrashKeys(); 165 return crash_keys::RegisterChromeCrashKeys();
128 } 166 }
129 167
168 bool ChromeBreakpadClient::IsRunningUnattended() {
169 scoped_ptr<base::Environment> env(base::Environment::Create());
170 return env->HasVar(env_vars::kHeadless);
171 }
172
130 } // namespace chrome 173 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/app/chrome_breakpad_client.h ('k') | components/breakpad/breakpad_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698