Chromium Code Reviews| 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 "chrome/browser/shell_integration.h" | 5 #include "chrome/browser/shell_integration.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shobjidl.h> | 8 #include <shobjidl.h> |
| 9 #include <propkey.h> | 9 #include <propkey.h> |
| 10 #include <propvarutil.h> | 10 #include <propvarutil.h> |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 454 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 454 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 455 if (!ShellUtil::ShowMakeChromeDefaultSystemUI(dist, chrome_exe.value())) { | 455 if (!ShellUtil::ShowMakeChromeDefaultSystemUI(dist, chrome_exe.value())) { |
| 456 LOG(ERROR) << "Failed to launch the set-default-browser Windows UI."; | 456 LOG(ERROR) << "Failed to launch the set-default-browser Windows UI."; |
| 457 return false; | 457 return false; |
| 458 } | 458 } |
| 459 | 459 |
| 460 VLOG(1) << "Set-as-default Windows UI triggered."; | 460 VLOG(1) << "Set-as-default Windows UI triggered."; |
| 461 return true; | 461 return true; |
| 462 } | 462 } |
| 463 | 463 |
| 464 bool ShellIntegration::SetAsDefaultProtocolClientInteractive( | |
| 465 const std::string& protocol) { | |
| 466 FilePath chrome_exe; | |
| 467 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { | |
| 468 NOTREACHED() << "Error getting app exe path"; | |
| 469 return false; | |
| 470 } | |
| 471 | |
| 472 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | |
| 473 string16 wprotocol = UTF8ToUTF16(protocol); | |
|
grt (UTC plus 2)
2012/09/20 13:10:13
nit: string16 wprotocol(UTF8ToUTF16(protocol));
benwells
2012/09/21 01:15:20
Done.
| |
| 474 if (!ShellUtil::ShowMakeChromeDefaultProtocolClientSystemUI( | |
| 475 dist, chrome_exe.value(), wprotocol)) { | |
|
grt (UTC plus 2)
2012/09/20 13:10:13
nit: indent four additional spaces.
benwells
2012/09/21 01:15:20
Done.
| |
| 476 LOG(ERROR) << "Failed to launch the set-default Windows UI."; | |
| 477 return false; | |
| 478 } | |
| 479 | |
| 480 VLOG(1) << "Set-as-default Windows UI triggered."; | |
|
grt (UTC plus 2)
2012/09/20 13:10:13
I think it's more informative for "triggered" to b
benwells
2012/09/21 01:15:20
Done.
| |
| 481 return true; | |
| 482 } | |
| 483 | |
| 464 ShellIntegration::DefaultWebClientState ShellIntegration::IsDefaultBrowser() { | 484 ShellIntegration::DefaultWebClientState ShellIntegration::IsDefaultBrowser() { |
| 465 // When we check for default browser we don't necessarily want to count file | 485 // When we check for default browser we don't necessarily want to count file |
| 466 // type handlers and icons as having changed the default browser status, | 486 // type handlers and icons as having changed the default browser status, |
| 467 // since the user may have changed their shell settings to cause HTML files | 487 // since the user may have changed their shell settings to cause HTML files |
| 468 // to open with a text editor for example. We also don't want to aggressively | 488 // to open with a text editor for example. We also don't want to aggressively |
| 469 // claim FTP, since the user may have a separate FTP client. It is an open | 489 // claim FTP, since the user may have a separate FTP client. It is an open |
| 470 // question as to how to "heal" these settings. Perhaps the user should just | 490 // question as to how to "heal" these settings. Perhaps the user should just |
| 471 // re-run the installer or run with the --set-default-browser command line | 491 // re-run the installer or run with the --set-default-browser command line |
| 472 // flag. There is doubtless some other key we can hook into to cause "Repair" | 492 // flag. There is doubtless some other key we can hook into to cause "Repair" |
| 473 // to show up in Add/Remove programs for us. | 493 // to show up in Add/Remove programs for us. |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 586 continue; | 606 continue; |
| 587 } | 607 } |
| 588 | 608 |
| 589 shortcut = shortcut.Append(shortcut_name).Append(shortcut_name + L".lnk"); | 609 shortcut = shortcut.Append(shortcut_name).Append(shortcut_name + L".lnk"); |
| 590 if (file_util::PathExists(shortcut)) | 610 if (file_util::PathExists(shortcut)) |
| 591 return shortcut; | 611 return shortcut; |
| 592 } | 612 } |
| 593 | 613 |
| 594 return FilePath(); | 614 return FilePath(); |
| 595 } | 615 } |
| OLD | NEW |