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

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

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

Powered by Google App Engine
This is Rietveld 408576698