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

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

Issue 10451074: Always suffix ChromeHTML entries on Windows for user-level installs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 8 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/installer/setup/uninstall.cc » ('j') | chrome/installer/setup/uninstall.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 ShellIntegration::DefaultWebClientState ProbeCurrentDefaultHandlers( 69 ShellIntegration::DefaultWebClientState ProbeCurrentDefaultHandlers(
70 const wchar_t* const* protocols, 70 const wchar_t* const* protocols,
71 size_t num_protocols) { 71 size_t num_protocols) {
72 base::win::ScopedComPtr<IApplicationAssociationRegistration> registration; 72 base::win::ScopedComPtr<IApplicationAssociationRegistration> registration;
73 HRESULT hr = registration.CreateInstance( 73 HRESULT hr = registration.CreateInstance(
74 CLSID_ApplicationAssociationRegistration, NULL, CLSCTX_INPROC); 74 CLSID_ApplicationAssociationRegistration, NULL, CLSCTX_INPROC);
75 if (FAILED(hr)) 75 if (FAILED(hr))
76 return ShellIntegration::UNKNOWN_DEFAULT_WEB_CLIENT; 76 return ShellIntegration::UNKNOWN_DEFAULT_WEB_CLIENT;
77 77
78 string16 prog_id(ShellUtil::kChromeHTMLProgId); 78 string16 prog_id(ShellUtil::kChromeHTMLProgId);
79 79 prog_id += ShellUtil::GetCurrentInstallationSuffix();
80 // If a user specific default browser entry exists, we check for that ProgID
81 // being default. If not, then the ProgID is ChromeHTML or ChromiumHTML so we
82 // do not append a suffix to the ProgID.
83 string16 suffix;
84 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
85 if (ShellUtil::GetUserSpecificDefaultBrowserSuffix(dist, &suffix))
86 prog_id += suffix;
87 80
88 for (size_t i = 0; i < num_protocols; ++i) { 81 for (size_t i = 0; i < num_protocols; ++i) {
89 base::win::ScopedCoMem<wchar_t> current_app; 82 base::win::ScopedCoMem<wchar_t> current_app;
90 hr = registration->QueryCurrentDefault(protocols[i], AT_URLPROTOCOL, 83 hr = registration->QueryCurrentDefault(protocols[i], AT_URLPROTOCOL,
91 AL_EFFECTIVE, &current_app); 84 AL_EFFECTIVE, &current_app);
92 if (FAILED(hr) || prog_id.compare(current_app) != 0) 85 if (FAILED(hr) || prog_id.compare(current_app) != 0)
93 return ShellIntegration::NOT_DEFAULT_WEB_CLIENT; 86 return ShellIntegration::NOT_DEFAULT_WEB_CLIENT;
94 } 87 }
95 88
96 return ShellIntegration::IS_DEFAULT_WEB_CLIENT; 89 return ShellIntegration::IS_DEFAULT_WEB_CLIENT;
97 } 90 }
98 91
99 // Probe using IApplicationAssociationRegistration::QueryAppIsDefault (Vista and 92 // Probe using IApplicationAssociationRegistration::QueryAppIsDefault (Vista and
100 // Windows 7); see ProbeProtocolHandlers. 93 // Windows 7); see ProbeProtocolHandlers.
101 ShellIntegration::DefaultWebClientState ProbeAppIsDefaultHandlers( 94 ShellIntegration::DefaultWebClientState ProbeAppIsDefaultHandlers(
102 const wchar_t* const* protocols, 95 const wchar_t* const* protocols,
103 size_t num_protocols) { 96 size_t num_protocols) {
104 base::win::ScopedComPtr<IApplicationAssociationRegistration> registration; 97 base::win::ScopedComPtr<IApplicationAssociationRegistration> registration;
105 HRESULT hr = registration.CreateInstance( 98 HRESULT hr = registration.CreateInstance(
106 CLSID_ApplicationAssociationRegistration, NULL, CLSCTX_INPROC); 99 CLSID_ApplicationAssociationRegistration, NULL, CLSCTX_INPROC);
107 if (FAILED(hr)) 100 if (FAILED(hr))
108 return ShellIntegration::UNKNOWN_DEFAULT_WEB_CLIENT; 101 return ShellIntegration::UNKNOWN_DEFAULT_WEB_CLIENT;
109 102
110 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); 103 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
111 string16 app_name(dist->GetApplicationName()); 104 string16 app_name(dist->GetApplicationName());
112 105 app_name += ShellUtil::GetCurrentInstallationSuffix();
113 // If a user specific default browser entry exists, we check for that
114 // app name being default. If not, then default browser is just called
115 // Google Chrome or Chromium so we do not append a suffix to the app name.
116 string16 suffix;
117 if (ShellUtil::GetUserSpecificDefaultBrowserSuffix(dist, &suffix))
118 app_name += suffix;
119 106
120 BOOL result; 107 BOOL result;
121 for (size_t i = 0; i < num_protocols; ++i) { 108 for (size_t i = 0; i < num_protocols; ++i) {
122 result = TRUE; 109 result = TRUE;
123 hr = registration->QueryAppIsDefault(protocols[i], AT_URLPROTOCOL, 110 hr = registration->QueryAppIsDefault(protocols[i], AT_URLPROTOCOL,
124 AL_EFFECTIVE, app_name.c_str(), &result); 111 AL_EFFECTIVE, app_name.c_str(), &result);
125 if (FAILED(hr) || result == FALSE) 112 if (FAILED(hr) || result == FALSE)
126 return ShellIntegration::NOT_DEFAULT_WEB_CLIENT; 113 return ShellIntegration::NOT_DEFAULT_WEB_CLIENT;
127 } 114 }
128 115
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 BrowserThread::PostTask( 559 BrowserThread::PostTask(
573 BrowserThread::FILE, FROM_HERE, 560 BrowserThread::FILE, FROM_HERE,
574 base::Bind(&MigrateChromiumShortcutsCallback)); 561 base::Bind(&MigrateChromiumShortcutsCallback));
575 } 562 }
576 563
577 bool ShellIntegration::ActivateMetroChrome() { 564 bool ShellIntegration::ActivateMetroChrome() {
578 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); 565 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
579 const string16 app_id(dist->GetBrowserAppId()); 566 const string16 app_id(dist->GetBrowserAppId());
580 return ActivateApplication(app_id); 567 return ActivateApplication(app_id);
581 } 568 }
OLDNEW
« no previous file with comments | « no previous file | chrome/installer/setup/uninstall.cc » ('j') | chrome/installer/setup/uninstall.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698