| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <shlwapi.h> | 6 #include <shlwapi.h> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/environment.h" | 10 #include "base/environment.h" |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 return base::string16(); | 195 return base::string16(); |
| 196 base::string16 exe_path(path); | 196 base::string16 exe_path(path); |
| 197 return exe_path.append(1, L'\\'); | 197 return exe_path.append(1, L'\\'); |
| 198 } | 198 } |
| 199 | 199 |
| 200 base::string16 GetCurrentModuleVersion() { | 200 base::string16 GetCurrentModuleVersion() { |
| 201 scoped_ptr<FileVersionInfo> file_version_info( | 201 scoped_ptr<FileVersionInfo> file_version_info( |
| 202 FileVersionInfo::CreateFileVersionInfoForCurrentModule()); | 202 FileVersionInfo::CreateFileVersionInfoForCurrentModule()); |
| 203 if (file_version_info.get()) { | 203 if (file_version_info.get()) { |
| 204 base::string16 version_string(file_version_info->file_version()); | 204 base::string16 version_string(file_version_info->file_version()); |
| 205 if (base::Version(WideToASCII(version_string)).IsValid()) | 205 if (Version(WideToASCII(version_string)).IsValid()) |
| 206 return version_string; | 206 return version_string; |
| 207 } | 207 } |
| 208 return base::string16(); | 208 return base::string16(); |
| 209 } | 209 } |
| 210 | 210 |
| 211 //============================================================================= | 211 //============================================================================= |
| 212 | 212 |
| 213 MainDllLoader::MainDllLoader() : dll_(NULL) { | 213 MainDllLoader::MainDllLoader() : dll_(NULL) { |
| 214 } | 214 } |
| 215 | 215 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 231 const base::string16 dir(GetExecutablePath()); | 231 const base::string16 dir(GetExecutablePath()); |
| 232 *out_file = dir; | 232 *out_file = dir; |
| 233 HMODULE dll = LoadChromeWithDirectory(out_file); | 233 HMODULE dll = LoadChromeWithDirectory(out_file); |
| 234 if (!dll) { | 234 if (!dll) { |
| 235 // Loading from same directory (for developers) failed. | 235 // Loading from same directory (for developers) failed. |
| 236 base::string16 version_string; | 236 base::string16 version_string; |
| 237 if (cmd_line.HasSwitch(switches::kChromeVersion)) { | 237 if (cmd_line.HasSwitch(switches::kChromeVersion)) { |
| 238 // This is used to support Chrome Frame, see http://crbug.com/88589. | 238 // This is used to support Chrome Frame, see http://crbug.com/88589. |
| 239 version_string = cmd_line.GetSwitchValueNative(switches::kChromeVersion); | 239 version_string = cmd_line.GetSwitchValueNative(switches::kChromeVersion); |
| 240 | 240 |
| 241 if (!base::Version(WideToASCII(version_string)).IsValid()) { | 241 if (!Version(WideToASCII(version_string)).IsValid()) { |
| 242 // If a bogus command line flag was given, then abort. | 242 // If a bogus command line flag was given, then abort. |
| 243 LOG(ERROR) << "Invalid command line version: " << version_string; | 243 LOG(ERROR) << "Invalid command line version: " << version_string; |
| 244 return NULL; | 244 return NULL; |
| 245 } | 245 } |
| 246 } | 246 } |
| 247 | 247 |
| 248 // If no version on the command line, then look at the version resource in | 248 // If no version on the command line, then look at the version resource in |
| 249 // the current module and try loading that. | 249 // the current module and try loading that. |
| 250 if (version_string.empty()) | 250 if (version_string.empty()) |
| 251 version_string = GetCurrentModuleVersion(); | 251 version_string = GetCurrentModuleVersion(); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 } | 351 } |
| 352 }; | 352 }; |
| 353 | 353 |
| 354 MainDllLoader* MakeMainDllLoader() { | 354 MainDllLoader* MakeMainDllLoader() { |
| 355 #if defined(GOOGLE_CHROME_BUILD) | 355 #if defined(GOOGLE_CHROME_BUILD) |
| 356 return new ChromeDllLoader(); | 356 return new ChromeDllLoader(); |
| 357 #else | 357 #else |
| 358 return new ChromiumDllLoader(); | 358 return new ChromiumDllLoader(); |
| 359 #endif | 359 #endif |
| 360 } | 360 } |
| OLD | NEW |