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

Side by Side Diff: chrome_frame/chrome_launcher_utils.cc

Issue 2278003: Rewrite of chrome_launcher.exe. ETW-based perf tests suggest that this is on ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 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/chrome_launcher_utils.h ('k') | chrome_frame/chrome_tab.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome_frame/chrome_launcher_utils.h"
6
7 #include "base/base_switches.h"
8 #include "base/command_line.h"
9 #include "base/file_util.h"
10 #include "base/logging.h"
11 #include "base/path_service.h"
12 #include "base/win_util.h"
13 #include "chrome/common/chrome_constants.h"
14 #include "chrome/common/chrome_switches.h"
15 #include "chrome_frame/chrome_frame_automation.h"
16
17 namespace chrome_launcher {
18
19 const wchar_t kLauncherExeBaseName[] = L"chrome_launcher.exe";
20
21 CommandLine* CreateLaunchCommandLine() {
22 // Shortcut for OS versions that don't need the integrity broker.
23 if (win_util::GetWinVersion() < win_util::WINVERSION_VISTA) {
24 return new CommandLine(GetChromeExecutablePath());
25 }
26
27 // The launcher EXE will be in the same directory as the Chrome Frame DLL,
28 // so create a full path to it based on this assumption. Since our unit
29 // tests also use this function, and live in the directory above, we test
30 // existence of the file and try the path that includes the /servers/
31 // directory if needed.
32 FilePath module_path;
33 if (PathService::Get(base::FILE_MODULE, &module_path)) {
34 FilePath current_dir = module_path.DirName();
35 FilePath same_dir_path = current_dir.Append(kLauncherExeBaseName);
36 if (file_util::PathExists(same_dir_path)) {
37 return new CommandLine(same_dir_path);
38 } else {
39 FilePath servers_path =
40 current_dir.Append(L"servers").Append(kLauncherExeBaseName);
41 DCHECK(file_util::PathExists(servers_path)) <<
42 "What module is this? It's not in 'servers' or main output dir.";
43 return new CommandLine(servers_path);
44 }
45 } else {
46 NOTREACHED();
47 return NULL;
48 }
49 }
50
51 FilePath GetChromeExecutablePath() {
52 FilePath cur_path;
53 PathService::Get(base::DIR_MODULE, &cur_path);
54 cur_path = cur_path.Append(chrome::kBrowserProcessExecutableName);
55
56 // The installation model for Chrome places the DLLs in a versioned
57 // sub-folder one down from the Chrome executable. If we fail to find
58 // chrome.exe in the current path, try looking one up and launching that
59 // instead.
60 if (!file_util::PathExists(cur_path)) {
61 PathService::Get(base::DIR_MODULE, &cur_path);
62 cur_path = cur_path.DirName().Append(chrome::kBrowserProcessExecutableName);
63 }
64
65 return cur_path;
66 }
67
68 } // namespace chrome_launcher
OLDNEW
« no previous file with comments | « chrome_frame/chrome_launcher_utils.h ('k') | chrome_frame/chrome_tab.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698