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

Side by Side Diff: chrome_frame/test/chrome_frame_test_utils.cc

Issue 3836005: Move pe_image and registry from base to base/win and use the namespace. It re... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome_frame/policy_settings.cc ('k') | chrome_frame/test/perf/chrome_frame_perftest.cc » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_frame/test/chrome_frame_test_utils.h" 5 #include "chrome_frame/test/chrome_frame_test_utils.h"
6 6
7 #include <atlbase.h> 7 #include <atlbase.h>
8 #include <atlwin.h> 8 #include <atlwin.h>
9 #include <iepmapi.h> 9 #include <iepmapi.h>
10 #include <sddl.h> 10 #include <sddl.h>
11 11
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/file_path.h" 13 #include "base/file_path.h"
14 #include "base/file_version_info.h" 14 #include "base/file_version_info.h"
15 #include "base/path_service.h" 15 #include "base/path_service.h"
16 #include "base/process_util.h" 16 #include "base/process_util.h"
17 #include "base/registry.h" // to find IE and firefox
18 #include "base/scoped_handle.h" 17 #include "base/scoped_handle.h"
19 #include "base/scoped_ptr.h" 18 #include "base/scoped_ptr.h"
20 #include "base/string_util.h" 19 #include "base/string_util.h"
21 #include "base/stringprintf.h" 20 #include "base/stringprintf.h"
22 #include "base/utf_string_conversions.h" 21 #include "base/utf_string_conversions.h"
23 #include "base/win_util.h" 22 #include "base/win_util.h"
23 #include "base/win/registry.h"
24 #include "base/win/windows_version.h" 24 #include "base/win/windows_version.h"
25 #include "chrome/common/chrome_switches.h" 25 #include "chrome/common/chrome_switches.h"
26 #include "chrome/common/chrome_paths.h" 26 #include "chrome/common/chrome_paths.h"
27 #include "chrome/common/chrome_paths_internal.h" 27 #include "chrome/common/chrome_paths_internal.h"
28 #include "chrome_frame/utils.h" 28 #include "chrome_frame/utils.h"
29 29
30 namespace chrome_frame_test { 30 namespace chrome_frame_test {
31 31
32 const wchar_t kCrashServicePipeName[] = L"\\\\.\\pipe\\ChromeCrashServices"; 32 const wchar_t kCrashServicePipeName[] = L"\\\\.\\pipe\\ChromeCrashServices";
33 33
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 109 }
110 110
111 return window_close_attempts; 111 return window_close_attempts;
112 } 112 }
113 113
114 std::wstring GetExecutableAppPath(const std::wstring& file) { 114 std::wstring GetExecutableAppPath(const std::wstring& file) {
115 std::wstring kAppPathsKey = 115 std::wstring kAppPathsKey =
116 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\"; 116 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\";
117 117
118 std::wstring app_path; 118 std::wstring app_path;
119 RegKey key(HKEY_LOCAL_MACHINE, (kAppPathsKey + file).c_str(), KEY_READ); 119 base::win::RegKey key(HKEY_LOCAL_MACHINE, (kAppPathsKey + file).c_str(),
120 KEY_READ);
120 if (key.Handle()) { 121 if (key.Handle()) {
121 key.ReadValue(NULL, &app_path); 122 key.ReadValue(NULL, &app_path);
122 } 123 }
123 124
124 return app_path; 125 return app_path;
125 } 126 }
126 127
127 std::wstring FormatCommandForApp(const std::wstring& exe_name, 128 std::wstring FormatCommandForApp(const std::wstring& exe_name,
128 const std::wstring& argument) { 129 const std::wstring& argument) {
129 std::wstring reg_path( 130 std::wstring reg_path(
130 base::StringPrintf(L"Applications\\%ls\\shell\\open\\command", 131 base::StringPrintf(L"Applications\\%ls\\shell\\open\\command",
131 exe_name.c_str())); 132 exe_name.c_str()));
132 RegKey key(HKEY_CLASSES_ROOT, reg_path.c_str(), KEY_READ); 133 base::win::RegKey key(HKEY_CLASSES_ROOT, reg_path.c_str(), KEY_READ);
133 134
134 std::wstring command; 135 std::wstring command;
135 if (key.Handle()) { 136 if (key.Handle()) {
136 key.ReadValue(NULL, &command); 137 key.ReadValue(NULL, &command);
137 int found = command.find(L"%1"); 138 int found = command.find(L"%1");
138 if (found >= 0) { 139 if (found >= 0) {
139 command.replace(found, 2, argument); 140 command.replace(found, 2, argument);
140 } 141 }
141 } 142 }
142 return command; 143 return command;
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 // First check to see if it's even still running just to minimize the 590 // First check to see if it's even still running just to minimize the
590 // likelihood of spurious error messages from KillProcess. 591 // likelihood of spurious error messages from KillProcess.
591 if (WAIT_OBJECT_0 != ::WaitForSingleObject(crash_service, 0)) { 592 if (WAIT_OBJECT_0 != ::WaitForSingleObject(crash_service, 0)) {
592 base::KillProcess(crash_service, 0, false); 593 base::KillProcess(crash_service, 0, false);
593 } 594 }
594 return NULL; 595 return NULL;
595 } 596 }
596 } 597 }
597 598
598 } // namespace chrome_frame_test 599 } // namespace chrome_frame_test
OLDNEW
« no previous file with comments | « chrome_frame/policy_settings.cc ('k') | chrome_frame/test/perf/chrome_frame_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698