| 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_win.h" | 5 #include "chrome/browser/shell_integration_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shlwapi.h> | 8 #include <shlwapi.h> |
| 9 #include <shobjidl.h> | 9 #include <shobjidl.h> |
| 10 #include <propkey.h> // Needs to come after shobjidl.h. | 10 #include <propkey.h> // Needs to come after shobjidl.h. |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 // Windows 8 and 10 both introduced a new way to set the default web client | 514 // Windows 8 and 10 both introduced a new way to set the default web client |
| 515 // which require user interaction. | 515 // which require user interaction. |
| 516 return SET_DEFAULT_INTERACTIVE; | 516 return SET_DEFAULT_INTERACTIVE; |
| 517 } | 517 } |
| 518 | 518 |
| 519 bool IsElevationNeededForSettingDefaultProtocolClient() { | 519 bool IsElevationNeededForSettingDefaultProtocolClient() { |
| 520 return base::win::GetVersion() < base::win::VERSION_WIN8; | 520 return base::win::GetVersion() < base::win::VERSION_WIN8; |
| 521 } | 521 } |
| 522 | 522 |
| 523 base::string16 GetApplicationNameForProtocol(const GURL& url) { | 523 base::string16 GetApplicationNameForProtocol(const GURL& url) { |
| 524 // Windows 8 or above requires a new protocol association query. | 524 base::string16 application_name; |
| 525 if (base::win::GetVersion() >= base::win::VERSION_WIN8) | 525 // Windows 8 or above has a new protocol association query. |
| 526 return GetAppForProtocolUsingAssocQuery(url); | 526 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { |
| 527 else | 527 application_name = GetAppForProtocolUsingAssocQuery(url); |
| 528 return GetAppForProtocolUsingRegistry(url); | 528 if (!application_name.empty()) |
| 529 return application_name; |
| 530 } |
| 531 |
| 532 return GetAppForProtocolUsingRegistry(url); |
| 529 } | 533 } |
| 530 | 534 |
| 531 DefaultWebClientState GetDefaultBrowser() { | 535 DefaultWebClientState GetDefaultBrowser() { |
| 532 return GetDefaultWebClientStateFromShellUtilDefaultState( | 536 return GetDefaultWebClientStateFromShellUtilDefaultState( |
| 533 ShellUtil::GetChromeDefaultState()); | 537 ShellUtil::GetChromeDefaultState()); |
| 534 } | 538 } |
| 535 | 539 |
| 536 // There is no reliable way to say which browser is default on a machine (each | 540 // There is no reliable way to say which browser is default on a machine (each |
| 537 // browser can have some of the protocols/shortcuts). So we look for only HTTP | 541 // browser can have some of the protocols/shortcuts). So we look for only HTTP |
| 538 // protocol handler. Even this handler is located at different places in | 542 // protocol handler. Even this handler is located at different places in |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 if (base::PathExists(shortcut)) | 853 if (base::PathExists(shortcut)) |
| 850 return shortcut; | 854 return shortcut; |
| 851 } | 855 } |
| 852 | 856 |
| 853 return base::FilePath(); | 857 return base::FilePath(); |
| 854 } | 858 } |
| 855 | 859 |
| 856 } // namespace win | 860 } // namespace win |
| 857 | 861 |
| 858 } // namespace shell_integration | 862 } // namespace shell_integration |
| OLD | NEW |