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

Side by Side Diff: chrome/browser/shell_integration_win.cc

Issue 3817001: CommandLine: remove wstring-based program() accessor (Closed) Base URL: http://src.chromium.org/git/chromium.git
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
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/browser/shell_integration.h" 5 #include "chrome/browser/shell_integration.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <propvarutil.h> 8 #include <propvarutil.h>
9 #include <shlobj.h> 9 #include <shlobj.h>
10 #include <shobjidl.h> 10 #include <shobjidl.h>
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 HKEY root_key = HKEY_CLASSES_ROOT; 339 HKEY root_key = HKEY_CLASSES_ROOT;
340 // Check <protocol>\shell\open\command 340 // Check <protocol>\shell\open\command
341 std::wstring key_path(kChromeProtocols[i] + ShellUtil::kRegShellOpen); 341 std::wstring key_path(kChromeProtocols[i] + ShellUtil::kRegShellOpen);
342 RegKey key(root_key, key_path.c_str(), KEY_READ); 342 RegKey key(root_key, key_path.c_str(), KEY_READ);
343 std::wstring value; 343 std::wstring value;
344 if (!key.Valid() || !key.ReadValue(L"", &value)) 344 if (!key.Valid() || !key.ReadValue(L"", &value))
345 return NOT_DEFAULT_BROWSER; 345 return NOT_DEFAULT_BROWSER;
346 // Need to normalize path in case it's been munged. 346 // Need to normalize path in case it's been munged.
347 CommandLine command_line = CommandLine::FromString(value); 347 CommandLine command_line = CommandLine::FromString(value);
348 std::wstring short_path; 348 std::wstring short_path;
349 GetShortPathName(command_line.program().c_str(), 349 GetShortPathName(command_line.GetProgram().value().c_str(),
350 WriteInto(&short_path, MAX_PATH), MAX_PATH); 350 WriteInto(&short_path, MAX_PATH), MAX_PATH);
351 if (!FilePath::CompareEqualIgnoreCase(short_path, short_app_path)) 351 if (!FilePath::CompareEqualIgnoreCase(short_path, short_app_path))
352 return NOT_DEFAULT_BROWSER; 352 return NOT_DEFAULT_BROWSER;
353 } 353 }
354 } 354 }
355 return IS_DEFAULT_BROWSER; 355 return IS_DEFAULT_BROWSER;
356 } 356 }
357 357
358 // There is no reliable way to say which browser is default on a machine (each 358 // There is no reliable way to say which browser is default on a machine (each
359 // browser can have some of the protocols/shortcuts). So we look for only HTTP 359 // browser can have some of the protocols/shortcuts). So we look for only HTTP
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 profile_path); 406 profile_path);
407 } 407 }
408 408
409 void ShellIntegration::MigrateChromiumShortcuts() { 409 void ShellIntegration::MigrateChromiumShortcuts() {
410 if (win_util::GetWinVersion() < win_util::WINVERSION_WIN7) 410 if (win_util::GetWinVersion() < win_util::WINVERSION_WIN7)
411 return; 411 return;
412 412
413 BrowserThread::PostTask( 413 BrowserThread::PostTask(
414 BrowserThread::FILE, FROM_HERE, new MigrateChromiumShortcutsTask()); 414 BrowserThread::FILE, FROM_HERE, new MigrateChromiumShortcutsTask());
415 } 415 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698