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

Side by Side Diff: chrome/installer/util/shell_util.cc

Issue 10539169: Prototype version of the first-run dialog for Windows 8 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed non-windows compilation errors. 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
« chrome/chrome_browser.gypi ('K') | « chrome/common/url_constants.cc ('k') | no next file » | no next file with comments »
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 // This file defines functions that integrate Chrome in Windows shell. These 5 // This file defines functions that integrate Chrome in Windows shell. These
6 // functions can be used by Chrome as well as Chrome installer. All of the 6 // functions can be used by Chrome as well as Chrome installer. All of the
7 // work is done by the local functions defined in anonymous namespace in 7 // work is done by the local functions defined in anonymous namespace in
8 // this class. 8 // this class.
9 9
10 #include "chrome/installer/util/shell_util.h" 10 #include "chrome/installer/util/shell_util.h"
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 } 609 }
610 } 610 }
611 return true; 611 return true;
612 } 612 }
613 613
614 // Launches the Windows 7 and Windows 8 dialog for picking the application to 614 // Launches the Windows 7 and Windows 8 dialog for picking the application to
615 // handle the given protocol. Most importantly, this is used to set the default 615 // handle the given protocol. Most importantly, this is used to set the default
616 // handler for http (and, implicitly with it, https). In that case it is also 616 // handler for http (and, implicitly with it, https). In that case it is also
617 // known as the 'how do you want to open webpages' dialog. 617 // known as the 'how do you want to open webpages' dialog.
618 // It is required that Chrome be already *registered* for the given protocol. 618 // It is required that Chrome be already *registered* for the given protocol.
619 bool LaunchSelectDefaultProtocolHandlerDialog(const wchar_t* protocol) { 619 HRESULT LaunchSelectDefaultProtocolHandlerDialog(const wchar_t* protocol) {
620 DCHECK(protocol); 620 DCHECK(protocol);
621 OPENASINFO open_as_info = {}; 621 OPENASINFO open_as_info = {};
622 open_as_info.pcszFile = protocol; 622 open_as_info.pcszFile = protocol;
623 open_as_info.oaifInFlags = 623 open_as_info.oaifInFlags =
624 OAIF_URL_PROTOCOL | OAIF_FORCE_REGISTRATION | OAIF_REGISTER_EXT; 624 OAIF_URL_PROTOCOL | OAIF_FORCE_REGISTRATION | OAIF_REGISTER_EXT;
625 HRESULT hr = SHOpenWithDialog(NULL, &open_as_info); 625 HRESULT hr = SHOpenWithDialog(NULL, &open_as_info);
626 DLOG_IF(WARNING, FAILED(hr)) << "Failed to set as default " << protocol 626 DLOG_IF(WARNING, FAILED(hr)) << "Failed to set as default " << protocol
627 << " handler; hr=0x" << std::hex << hr; 627 << " handler; hr=0x" << std::hex << hr;
628 return SUCCEEDED(hr); 628 return hr;
629 } 629 }
630 630
631 // Launches the Windows 7 and Windows 8 application association dialog, which 631 // Launches the Windows 7 and Windows 8 application association dialog, which
632 // is the only documented way to make a browser the default browser on 632 // is the only documented way to make a browser the default browser on
633 // Windows 8. 633 // Windows 8.
634 bool LaunchApplicationAssociationDialog(const string16& app_id) { 634 bool LaunchApplicationAssociationDialog(const string16& app_id) {
635 base::win::ScopedComPtr<IApplicationAssociationRegistrationUI> aarui; 635 base::win::ScopedComPtr<IApplicationAssociationRegistrationUI> aarui;
636 HRESULT hr = aarui.CreateInstance(CLSID_ApplicationAssociationRegistrationUI); 636 HRESULT hr = aarui.CreateInstance(CLSID_ApplicationAssociationRegistrationUI);
637 if (FAILED(hr)) 637 if (FAILED(hr))
638 return false; 638 return false;
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 1050
1051 if (!RegisterChromeBrowser(dist, chrome_exe, string16(), true)) 1051 if (!RegisterChromeBrowser(dist, chrome_exe, string16(), true))
1052 return false; 1052 return false;
1053 1053
1054 // On Windows 8, you can't set yourself as the default handler 1054 // On Windows 8, you can't set yourself as the default handler
1055 // programatically. In other words IApplicationAssociationRegistration 1055 // programatically. In other words IApplicationAssociationRegistration
1056 // has been rendered useless. What you can do is to launch 1056 // has been rendered useless. What you can do is to launch
1057 // "Set Program Associations" section of the "Default Programs" 1057 // "Set Program Associations" section of the "Default Programs"
1058 // control panel, which is a mess, or pop the concise "How you want to open 1058 // control panel, which is a mess, or pop the concise "How you want to open
1059 // webpages?" dialog. We choose the latter. 1059 // webpages?" dialog. We choose the latter.
1060 return LaunchSelectDefaultProtocolHandlerDialog(L"http"); 1060 // Return true only when the user took an action and there was no error.
1061 return LaunchSelectDefaultProtocolHandlerDialog(L"http") == S_OK;
grt (UTC plus 2) 2012/06/18 19:19:13 use SUCCEEDED() macro rather than comparing to S_O
motek. 2012/06/19 18:06:44 Yeah, obviously. I am not sure what made me believ
1061 } 1062 }
1062 1063
1063 bool ShellUtil::MakeChromeDefaultProtocolClient(BrowserDistribution* dist, 1064 bool ShellUtil::MakeChromeDefaultProtocolClient(BrowserDistribution* dist,
1064 const string16& chrome_exe, 1065 const string16& chrome_exe,
1065 const string16& protocol) { 1066 const string16& protocol) {
1066 if (!dist->CanSetAsDefault()) 1067 if (!dist->CanSetAsDefault())
1067 return false; 1068 return false;
1068 1069
1069 ShellUtil::RegisterChromeForProtocol(dist, chrome_exe, L"", protocol, true); 1070 ShellUtil::RegisterChromeForProtocol(dist, chrome_exe, L"", protocol, true);
1070 1071
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 chrome_exe.c_str(), 1325 chrome_exe.c_str(),
1325 shortcut.c_str(), 1326 shortcut.c_str(),
1326 chrome_path.c_str(), 1327 chrome_path.c_str(),
1327 arguments.c_str(), 1328 arguments.c_str(),
1328 description.c_str(), 1329 description.c_str(),
1329 icon_path.c_str(), 1330 icon_path.c_str(),
1330 icon_index, 1331 icon_index,
1331 dist->GetBrowserAppId().c_str(), 1332 dist->GetBrowserAppId().c_str(),
1332 ConvertShellUtilShortcutOptionsToFileUtil(options)); 1333 ConvertShellUtilShortcutOptionsToFileUtil(options));
1333 } 1334 }
OLDNEW
« chrome/chrome_browser.gypi ('K') | « chrome/common/url_constants.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698