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

Side by Side Diff: chrome/install_static/install_util.cc

Issue 2730283002: Cleanups in the wake of various metrics refactorings. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « chrome/install_static/install_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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/install_static/install_util.h" 5 #include "chrome/install_static/install_util.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <assert.h> 8 #include <assert.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 constexpr wchar_t kChromeChannelStableExplicit[] = L"stable"; 54 constexpr wchar_t kChromeChannelStableExplicit[] = L"stable";
55 55
56 // TODO(ananta) 56 // TODO(ananta)
57 // http://crbug.com/604923 57 // http://crbug.com/604923
58 // These constants are defined in the chrome/installer directory as well. We 58 // These constants are defined in the chrome/installer directory as well. We
59 // need to unify them. 59 // need to unify them.
60 constexpr wchar_t kRegValueAp[] = L"ap"; 60 constexpr wchar_t kRegValueAp[] = L"ap";
61 constexpr wchar_t kRegValueUsageStats[] = L"usagestats"; 61 constexpr wchar_t kRegValueUsageStats[] = L"usagestats";
62 constexpr wchar_t kMetricsReportingEnabled[] = L"MetricsReportingEnabled"; 62 constexpr wchar_t kMetricsReportingEnabled[] = L"MetricsReportingEnabled";
63 63
64 constexpr wchar_t kBrowserCrashDumpMetricsSubKey[] =
65 L"\\BrowserCrashDumpAttempts";
66
67 void Trace(const wchar_t* format_string, ...) { 64 void Trace(const wchar_t* format_string, ...) {
68 static const int kMaxLogBufferSize = 1024; 65 static const int kMaxLogBufferSize = 1024;
69 static wchar_t buffer[kMaxLogBufferSize] = {}; 66 static wchar_t buffer[kMaxLogBufferSize] = {};
70 67
71 va_list args = {}; 68 va_list args = {};
72 69
73 va_start(args, format_string); 70 va_start(args, format_string);
74 vswprintf(buffer, kMaxLogBufferSize, format_string, args); 71 vswprintf(buffer, kMaxLogBufferSize, format_string, args);
75 OutputDebugStringW(buffer); 72 OutputDebugStringW(buffer);
76 va_end(args); 73 va_end(args);
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 GetValueFromVersionResource(data.get(), L"SpecialBuild", special_build); 519 GetValueFromVersionResource(data.get(), L"SpecialBuild", special_build);
523 } 520 }
524 } 521 }
525 *channel_name = GetChromeChannelName(); 522 *channel_name = GetChromeChannelName();
526 } 523 }
527 524
528 std::wstring GetChromeChannelName() { 525 std::wstring GetChromeChannelName() {
529 return InstallDetails::Get().channel(); 526 return InstallDetails::Get().channel();
530 } 527 }
531 528
532 std::wstring GetBrowserCrashDumpAttemptsRegistryPath() {
533 return GetChromeInstallRegistryPath().append(kBrowserCrashDumpMetricsSubKey);
534 }
535
536 bool MatchPattern(const std::wstring& source, const std::wstring& pattern) { 529 bool MatchPattern(const std::wstring& source, const std::wstring& pattern) {
537 assert(pattern.find(L"**") == std::wstring::npos); 530 assert(pattern.find(L"**") == std::wstring::npos);
538 return MatchPatternImpl(source, pattern, 0, 0); 531 return MatchPatternImpl(source, pattern, 0, 0);
539 } 532 }
540 533
541 std::string UTF16ToUTF8(const std::wstring& source) { 534 std::string UTF16ToUTF8(const std::wstring& source) {
542 if (source.empty() || 535 if (source.empty() ||
543 static_cast<int>(source.size()) > std::numeric_limits<int>::max()) { 536 static_cast<int>(source.size()) > std::numeric_limits<int>::max()) {
544 return std::string(); 537 return std::string();
545 } 538 }
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 case ChannelStrategy::ADDITIONAL_PARAMETERS: 758 case ChannelStrategy::ADDITIONAL_PARAMETERS:
766 return ChannelFromAdditionalParameters(mode, system_level, from_binaries); 759 return ChannelFromAdditionalParameters(mode, system_level, from_binaries);
767 case ChannelStrategy::FIXED: 760 case ChannelStrategy::FIXED:
768 return mode.default_channel_name; 761 return mode.default_channel_name;
769 } 762 }
770 763
771 return std::wstring(); 764 return std::wstring();
772 } 765 }
773 766
774 } // namespace install_static 767 } // namespace install_static
OLDNEW
« no previous file with comments | « chrome/install_static/install_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698