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

Side by Side Diff: components/browser_watcher/exit_funnel_win.cc

Issue 1410333006: Enough hacks to make wstring printfs unneeded (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "components/browser_watcher/exit_funnel_win.h" 5 #include "components/browser_watcher/exit_funnel_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 20 matching lines...) Expand all
31 return false; 31 return false;
32 } 32 }
33 33
34 return InitImpl(registry_path, pid, base::Time::FromFileTime(creation_time)); 34 return InitImpl(registry_path, pid, base::Time::FromFileTime(creation_time));
35 } 35 }
36 36
37 bool ExitFunnel::InitImpl(const base::char16* registry_path, 37 bool ExitFunnel::InitImpl(const base::char16* registry_path,
38 base::ProcessId pid, 38 base::ProcessId pid,
39 base::Time creation_time) { 39 base::Time creation_time) {
40 base::string16 key_name = registry_path; 40 base::string16 key_name = registry_path;
41 base::StringAppendF( 41 // Safe
42 &key_name, L"\\%d-%lld", pid, creation_time.ToInternalValue()); 42 //base::StringAppendF(
43 // &key_name, L"\\%d-%lld", pid, creation_time.ToInternalValue());
43 44
44 LONG res = key_.Create(HKEY_CURRENT_USER, key_name.c_str(), KEY_SET_VALUE); 45 LONG res = key_.Create(HKEY_CURRENT_USER, key_name.c_str(), KEY_SET_VALUE);
45 if (res != ERROR_SUCCESS) { 46 if (res != ERROR_SUCCESS) {
46 LOG(ERROR) << "Unable to create key " << key_name << " error " << res; 47 LOG(ERROR) << "Unable to create key " << key_name << " error " << res;
47 return false; 48 return false;
48 } 49 }
49 50
50 return true; 51 return true;
51 } 52 }
52 53
(...skipping 16 matching lines...) Expand all
69 const base::char16* event_name) { 70 const base::char16* event_name) {
70 ExitFunnel funnel; 71 ExitFunnel funnel;
71 72
72 if (!funnel.Init(registry_path, base::GetCurrentProcessHandle())) 73 if (!funnel.Init(registry_path, base::GetCurrentProcessHandle()))
73 return false; 74 return false;
74 75
75 return funnel.RecordEvent(event_name); 76 return funnel.RecordEvent(event_name);
76 } 77 }
77 78
78 } // namespace browser_watcher 79 } // namespace browser_watcher
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698