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

Side by Side Diff: trunk/src/chrome/common/logging_chrome.cc

Issue 13590004: Revert 192504 "Re-apply 192420: Move login switches to src/chromeos" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 8 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 | « trunk/src/chrome/common/chrome_switches.cc ('k') | trunk/src/chromeos/chromeos_switches.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 // Need to include this before most other files because it defines 7 // Need to include this before most other files because it defines
8 // IPC_MESSAGE_LOG_ENABLED. We need to use it to define 8 // IPC_MESSAGE_LOG_ENABLED. We need to use it to define
9 // IPC_MESSAGE_MACROS_LOG_ENABLED so render_messages.h will generate the 9 // IPC_MESSAGE_MACROS_LOG_ENABLED so render_messages.h will generate the
10 // ViewMsgLog et al. functions. 10 // ViewMsgLog et al. functions.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "base/threading/thread_restrictions.h" 44 #include "base/threading/thread_restrictions.h"
45 #include "base/time.h" 45 #include "base/time.h"
46 #include "base/utf_string_conversions.h" 46 #include "base/utf_string_conversions.h"
47 #include "chrome/common/chrome_constants.h" 47 #include "chrome/common/chrome_constants.h"
48 #include "chrome/common/chrome_paths.h" 48 #include "chrome/common/chrome_paths.h"
49 #include "chrome/common/chrome_switches.h" 49 #include "chrome/common/chrome_switches.h"
50 #include "chrome/common/dump_without_crashing.h" 50 #include "chrome/common/dump_without_crashing.h"
51 #include "chrome/common/env_vars.h" 51 #include "chrome/common/env_vars.h"
52 #include "ipc/ipc_logging.h" 52 #include "ipc/ipc_logging.h"
53 53
54 #if defined(OS_CHROMEOS)
55 #include "chromeos/chromeos_switches.h"
56 #endif
57
58 #if defined(OS_WIN) 54 #if defined(OS_WIN)
59 #include <initguid.h> 55 #include <initguid.h>
60 #include "base/logging_win.h" 56 #include "base/logging_win.h"
61 #endif 57 #endif
62 58
63 namespace { 59 namespace {
64 60
65 // When true, this means that error dialogs should not be shown. 61 // When true, this means that error dialogs should not be shown.
66 bool dialogs_are_suppressed_ = false; 62 bool dialogs_are_suppressed_ = false;
67 63
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 base::FilePath GetSessionLogFile(const CommandLine& command_line) { 198 base::FilePath GetSessionLogFile(const CommandLine& command_line) {
203 base::FilePath log_dir; 199 base::FilePath log_dir;
204 std::string log_dir_str; 200 std::string log_dir_str;
205 scoped_ptr<base::Environment> env(base::Environment::Create()); 201 scoped_ptr<base::Environment> env(base::Environment::Create());
206 if (env->GetVar(env_vars::kSessionLogDir, &log_dir_str) && 202 if (env->GetVar(env_vars::kSessionLogDir, &log_dir_str) &&
207 !log_dir_str.empty()) { 203 !log_dir_str.empty()) {
208 log_dir = base::FilePath(log_dir_str); 204 log_dir = base::FilePath(log_dir_str);
209 } else { 205 } else {
210 PathService::Get(chrome::DIR_USER_DATA, &log_dir); 206 PathService::Get(chrome::DIR_USER_DATA, &log_dir);
211 base::FilePath login_profile = 207 base::FilePath login_profile =
212 command_line.GetSwitchValuePath(chromeos::switches::kLoginProfile); 208 command_line.GetSwitchValuePath(switches::kLoginProfile);
213 log_dir = log_dir.Append(login_profile); 209 log_dir = log_dir.Append(login_profile);
214 } 210 }
215 return log_dir.Append(GetLogFileName().BaseName()); 211 return log_dir.Append(GetLogFileName().BaseName());
216 } 212 }
217 213
218 void RedirectChromeLogging(const CommandLine& command_line) { 214 void RedirectChromeLogging(const CommandLine& command_line) {
219 DCHECK(!chrome_logging_redirected_) << 215 DCHECK(!chrome_logging_redirected_) <<
220 "Attempted to redirect logging when it was already initialized."; 216 "Attempted to redirect logging when it was already initialized.";
221 217
222 // Redirect logs to the session log directory, if set. Otherwise 218 // Redirect logs to the session log directory, if set. Otherwise
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 // Don't resolve the log path unless we need to. Otherwise we leave an open 261 // Don't resolve the log path unless we need to. Otherwise we leave an open
266 // ALPC handle after sandbox lockdown on Windows. 262 // ALPC handle after sandbox lockdown on Windows.
267 if (logging_dest == LOG_ONLY_TO_FILE || 263 if (logging_dest == LOG_ONLY_TO_FILE ||
268 logging_dest == LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG) { 264 logging_dest == LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG) {
269 log_path = GetLogFileName(); 265 log_path = GetLogFileName();
270 266
271 #if defined(OS_CHROMEOS) 267 #if defined(OS_CHROMEOS)
272 // For BWSI (Incognito) logins, we want to put the logs in the user 268 // For BWSI (Incognito) logins, we want to put the logs in the user
273 // profile directory that is created for the temporary session instead 269 // profile directory that is created for the temporary session instead
274 // of in the system log directory, for privacy reasons. 270 // of in the system log directory, for privacy reasons.
275 if (command_line.HasSwitch(chromeos::switches::kGuestSession)) 271 if (command_line.HasSwitch(switches::kGuestSession))
276 log_path = GetSessionLogFile(command_line); 272 log_path = GetSessionLogFile(command_line);
277 273
278 // On ChromeOS we log to the symlink. We force creation of a new 274 // On ChromeOS we log to the symlink. We force creation of a new
279 // symlink if we've been asked to delete the old log, since that 275 // symlink if we've been asked to delete the old log, since that
280 // indicates the start of a new session. 276 // indicates the start of a new session.
281 target_path = SetUpSymlinkIfNeeded( 277 target_path = SetUpSymlinkIfNeeded(
282 log_path, delete_old_log_file == logging::DELETE_OLD_LOG_FILE); 278 log_path, delete_old_log_file == logging::DELETE_OLD_LOG_FILE);
283 279
284 // Because ChromeOS manages the move to a new session by redirecting 280 // Because ChromeOS manages the move to a new session by redirecting
285 // the link, it shouldn't remove the old file in the logging code, 281 // the link, it shouldn't remove the old file in the logging code,
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 time_deets.year, 441 time_deets.year,
446 time_deets.month, 442 time_deets.month,
447 time_deets.day_of_month, 443 time_deets.day_of_month,
448 time_deets.hour, 444 time_deets.hour,
449 time_deets.minute, 445 time_deets.minute,
450 time_deets.second); 446 time_deets.second);
451 return base_path.InsertBeforeExtensionASCII(suffix); 447 return base_path.InsertBeforeExtensionASCII(suffix);
452 } 448 }
453 449
454 } // namespace logging 450 } // namespace logging
OLDNEW
« no previous file with comments | « trunk/src/chrome/common/chrome_switches.cc ('k') | trunk/src/chromeos/chromeos_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698