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

Side by Side Diff: chrome/app/chrome_exe_main_win.cc

Issue 819133004: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years, 12 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/app/chrome_crash_reporter_client_mac.mm ('k') | chrome/app/chrome_main_delegate.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include <malloc.h> 6 #include <malloc.h>
7 #include <shellscalingapi.h> 7 #include <shellscalingapi.h>
8 #include <tchar.h> 8 #include <tchar.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 25 matching lines...) Expand all
36 }; 36 };
37 37
38 bool IsFastStartSwitch(const std::string& command_line_switch) { 38 bool IsFastStartSwitch(const std::string& command_line_switch) {
39 for (size_t i = 0; i < arraysize(kFastStartSwitches); ++i) { 39 for (size_t i = 0; i < arraysize(kFastStartSwitches); ++i) {
40 if (command_line_switch == kFastStartSwitches[i]) 40 if (command_line_switch == kFastStartSwitches[i])
41 return true; 41 return true;
42 } 42 }
43 return false; 43 return false;
44 } 44 }
45 45
46 bool ContainsNonFastStartFlag(const CommandLine& command_line) { 46 bool ContainsNonFastStartFlag(const base::CommandLine& command_line) {
47 const CommandLine::SwitchMap& switches = command_line.GetSwitches(); 47 const base::CommandLine::SwitchMap& switches = command_line.GetSwitches();
48 if (switches.size() > arraysize(kFastStartSwitches)) 48 if (switches.size() > arraysize(kFastStartSwitches))
49 return true; 49 return true;
50 for (CommandLine::SwitchMap::const_iterator it = switches.begin(); 50 for (base::CommandLine::SwitchMap::const_iterator it = switches.begin();
51 it != switches.end(); ++it) { 51 it != switches.end(); ++it) {
52 if (!IsFastStartSwitch(it->first)) 52 if (!IsFastStartSwitch(it->first))
53 return true; 53 return true;
54 } 54 }
55 return false; 55 return false;
56 } 56 }
57 57
58 bool AttemptFastNotify(const CommandLine& command_line) { 58 bool AttemptFastNotify(const base::CommandLine& command_line) {
59 if (ContainsNonFastStartFlag(command_line)) 59 if (ContainsNonFastStartFlag(command_line))
60 return false; 60 return false;
61 61
62 base::FilePath user_data_dir; 62 base::FilePath user_data_dir;
63 if (!chrome::GetDefaultUserDataDirectory(&user_data_dir)) 63 if (!chrome::GetDefaultUserDataDirectory(&user_data_dir))
64 return false; 64 return false;
65 policy::path_parser::CheckUserDataDirPolicy(&user_data_dir); 65 policy::path_parser::CheckUserDataDirPolicy(&user_data_dir);
66 66
67 HWND chrome = chrome::FindRunningChromeWindow(user_data_dir); 67 HWND chrome = chrome::FindRunningChromeWindow(user_data_dir);
68 if (!chrome) 68 if (!chrome)
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 HINSTANCE instance = GetModuleHandle(NULL); 131 HINSTANCE instance = GetModuleHandle(NULL);
132 #endif 132 #endif
133 SwitchToLFHeap(); 133 SwitchToLFHeap();
134 134
135 startup_metric_utils::RecordExeMainEntryTime(); 135 startup_metric_utils::RecordExeMainEntryTime();
136 136
137 // Signal Chrome Elf that Chrome has begun to start. 137 // Signal Chrome Elf that Chrome has begun to start.
138 SignalChromeElf(); 138 SignalChromeElf();
139 139
140 // Initialize the commandline singleton from the environment. 140 // Initialize the commandline singleton from the environment.
141 CommandLine::Init(0, NULL); 141 base::CommandLine::Init(0, NULL);
142 // The exit manager is in charge of calling the dtors of singletons. 142 // The exit manager is in charge of calling the dtors of singletons.
143 base::AtExitManager exit_manager; 143 base::AtExitManager exit_manager;
144 144
145 // We don't want to set DPI awareness on pre-Win7 because we don't support 145 // We don't want to set DPI awareness on pre-Win7 because we don't support
146 // DirectWrite there. GDI fonts are kerned very badly, so better to leave 146 // DirectWrite there. GDI fonts are kerned very badly, so better to leave
147 // DPI-unaware and at effective 1.0. See also ShouldUseDirectWrite(). 147 // DPI-unaware and at effective 1.0. See also ShouldUseDirectWrite().
148 if (base::win::GetVersion() >= base::win::VERSION_WIN7) 148 if (base::win::GetVersion() >= base::win::VERSION_WIN7)
149 EnableHighDPISupport(); 149 EnableHighDPISupport();
150 150
151 if (AttemptFastNotify(*CommandLine::ForCurrentProcess())) 151 if (AttemptFastNotify(*base::CommandLine::ForCurrentProcess()))
152 return 0; 152 return 0;
153 153
154 // Load and launch the chrome dll. *Everything* happens inside. 154 // Load and launch the chrome dll. *Everything* happens inside.
155 VLOG(1) << "About to load main DLL."; 155 VLOG(1) << "About to load main DLL.";
156 MainDllLoader* loader = MakeMainDllLoader(); 156 MainDllLoader* loader = MakeMainDllLoader();
157 int rc = loader->Launch(instance); 157 int rc = loader->Launch(instance);
158 loader->RelaunchChromeBrowserWithNewCommandLineIfNeeded(); 158 loader->RelaunchChromeBrowserWithNewCommandLineIfNeeded();
159 delete loader; 159 delete loader;
160 return rc; 160 return rc;
161 } 161 }
OLDNEW
« no previous file with comments | « chrome/app/chrome_crash_reporter_client_mac.mm ('k') | chrome/app/chrome_main_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698