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

Side by Side Diff: chrome/installer/util/logging_installer.cc

Issue 5756007: Revert 69165 - Merge the installer, installer_util and setup_util namespaces ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years 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/installer/util/logging_installer.h ('k') | chrome/installer/util/master_preferences.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <windows.h> 5 #include <windows.h>
6 6
7 #include "chrome/installer/util/logging_installer.h" 7 #include "chrome/installer/util/logging_installer.h"
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/logging_win.h" 12 #include "base/logging_win.h"
13 #include "base/path_service.h" 13 #include "base/path_service.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "chrome/installer/util/master_preferences.h" 16 #include "chrome/installer/util/master_preferences.h"
17 #include "chrome/installer/util/master_preferences_constants.h" 17 #include "chrome/installer/util/master_preferences_constants.h"
18 #include "chrome/installer/util/util_constants.h" 18 #include "chrome/installer/util/util_constants.h"
19 19
20 // {93BCE0BF-3FAF-43b1-9E28-BEB6FAB5ECE7} 20 // {93BCE0BF-3FAF-43b1-9E28-BEB6FAB5ECE7}
21 static const GUID kSetupTraceProvider = { 0x93bce0bf, 0x3faf, 0x43b1, 21 static const GUID kSetupTraceProvider = { 0x93bce0bf, 0x3faf, 0x43b1,
22 { 0x9e, 0x28, 0xbe, 0xb6, 0xfa, 0xb5, 0xec, 0xe7 } }; 22 { 0x9e, 0x28, 0xbe, 0xb6, 0xfa, 0xb5, 0xec, 0xe7 } };
23 23
24 namespace installer { 24 namespace installer {
25 25
26 // This should be true for the period between the end of 26 // This should be true for the period between the end of
27 // InitInstallerLogging() and the beginning of EndInstallerLogging(). 27 // InitInstallerLogging() and the beginning of EndInstallerLogging().
28 bool installer_logging_ = false; 28 bool installer_logging_ = false;
29 29
30 void InitInstallerLogging(const installer::MasterPreferences& prefs) { 30 void InitInstallerLogging(const installer_util::MasterPreferences& prefs) {
31 if (installer_logging_) 31 if (installer_logging_)
32 return; 32 return;
33 33
34 bool value = false; 34 bool value = false;
35 if (prefs.GetBool(installer::master_preferences::kDisableLogging, 35 if (prefs.GetBool(installer_util::master_preferences::kDisableLogging,
36 &value) && value) { 36 &value) && value) {
37 installer_logging_ = true; 37 installer_logging_ = true;
38 return; 38 return;
39 } 39 }
40 40
41 logging::InitLogging(GetLogFilePath(prefs).value().c_str(), 41 logging::InitLogging(GetLogFilePath(prefs).value().c_str(),
42 logging::LOG_ONLY_TO_FILE, 42 logging::LOG_ONLY_TO_FILE,
43 logging::LOCK_LOG_FILE, 43 logging::LOCK_LOG_FILE,
44 logging::DELETE_OLD_LOG_FILE); 44 logging::DELETE_OLD_LOG_FILE);
45 45
46 if (prefs.GetBool(installer::master_preferences::kVerboseLogging, 46 if (prefs.GetBool(installer_util::master_preferences::kVerboseLogging,
47 &value) && value) { 47 &value) && value) {
48 logging::SetMinLogLevel(logging::LOG_VERBOSE); 48 logging::SetMinLogLevel(logging::LOG_VERBOSE);
49 } else { 49 } else {
50 logging::SetMinLogLevel(logging::LOG_ERROR); 50 logging::SetMinLogLevel(logging::LOG_ERROR);
51 } 51 }
52 52
53 // Enable ETW logging. 53 // Enable ETW logging.
54 logging::LogEventProvider::Initialize(kSetupTraceProvider); 54 logging::LogEventProvider::Initialize(kSetupTraceProvider);
55 55
56 installer_logging_ = true; 56 installer_logging_ = true;
57 } 57 }
58 58
59 void EndInstallerLogging() { 59 void EndInstallerLogging() {
60 logging::CloseLogFile(); 60 logging::CloseLogFile();
61 61
62 installer_logging_ = false; 62 installer_logging_ = false;
63 } 63 }
64 64
65 FilePath GetLogFilePath(const installer::MasterPreferences& prefs) { 65 FilePath GetLogFilePath(const installer_util::MasterPreferences& prefs) {
66 std::string path; 66 std::string path;
67 prefs.GetString(installer::master_preferences::kLogFile, &path); 67 prefs.GetString(installer_util::master_preferences::kLogFile, &path);
68 if (!path.empty()) { 68 if (!path.empty()) {
69 return FilePath(UTF8ToWide(path)); 69 return FilePath(UTF8ToWide(path));
70 } 70 }
71 71
72 std::wstring log_filename = prefs.install_chrome_frame() ? 72 std::wstring log_filename = prefs.install_chrome_frame() ?
73 L"chrome_frame_installer.log" : L"chrome_installer.log"; 73 L"chrome_frame_installer.log" : L"chrome_installer.log";
74 74
75 FilePath log_path; 75 FilePath log_path;
76 if (PathService::Get(base::DIR_TEMP, &log_path)) { 76 if (PathService::Get(base::DIR_TEMP, &log_path)) {
77 log_path = log_path.Append(log_filename); 77 log_path = log_path.Append(log_filename);
78 return log_path; 78 return log_path;
79 } else { 79 } else {
80 return FilePath(log_filename); 80 return FilePath(log_filename);
81 } 81 }
82 } 82 }
83 83
84 } // namespace installer 84 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/util/logging_installer.h ('k') | chrome/installer/util/master_preferences.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698