[email protected] | b6b7222 | 2012-02-11 02:04:13 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | d24c401 | 2009-07-28 01:57:31 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
pmonette | 32a5cfb4 | 2016-04-11 22:04:44 | [diff] [blame] | 5 | #include "chrome/browser/shell_integration_win.h" |
[email protected] | d24c401 | 2009-07-28 01:57:31 | [diff] [blame] | 6 | |
| 7 | #include <windows.h> |
robliao | a872e99 | 2017-05-18 06:36:19 | [diff] [blame] | 8 | #include <objbase.h> |
[email protected] | caa0535 | 2014-03-01 00:43:05 | [diff] [blame] | 9 | #include <shlwapi.h> |
[email protected] | d24c401 | 2009-07-28 01:57:31 | [diff] [blame] | 10 | #include <shobjidl.h> |
thestig | 18dfb7a5 | 2014-08-26 10:44:04 | [diff] [blame] | 11 | #include <propkey.h> // Needs to come after shobjidl.h. |
avi | 664c07b | 2015-12-26 02:18:31 | [diff] [blame] | 12 | #include <stddef.h> |
| 13 | #include <stdint.h> |
Robert Liao | b2bc703d | 2017-10-17 20:52:35 | [diff] [blame] | 14 | #include <wrl/client.h> |
[email protected] | d24c401 | 2009-07-28 01:57:31 | [diff] [blame] | 15 | |
pmonette | a9831524 | 2016-11-23 21:39:18 | [diff] [blame] | 16 | #include <memory> |
| 17 | #include <utility> |
pmonette | 32a5cfb4 | 2016-04-11 22:04:44 | [diff] [blame] | 18 | #include <vector> |
| 19 | |
[email protected] | 3a3e72c | 2011-11-29 02:59:38 | [diff] [blame] | 20 | #include "base/bind.h" |
pmonette | 32a5cfb4 | 2016-04-11 22:04:44 | [diff] [blame] | 21 | #include "base/callback.h" |
[email protected] | d24c401 | 2009-07-28 01:57:31 | [diff] [blame] | 22 | #include "base/command_line.h" |
[email protected] | 25a4c1c | 2013-06-08 04:53:36 | [diff] [blame] | 23 | #include "base/files/file_enumerator.h" |
thestig | 18dfb7a5 | 2014-08-26 10:44:04 | [diff] [blame] | 24 | #include "base/files/file_util.h" |
avi | 664c07b | 2015-12-26 02:18:31 | [diff] [blame] | 25 | #include "base/macros.h" |
pmonette | 32a5cfb4 | 2016-04-11 22:04:44 | [diff] [blame] | 26 | #include "base/memory/weak_ptr.h" |
pmonette | 32a5cfb4 | 2016-04-11 22:04:44 | [diff] [blame] | 27 | #include "base/metrics/histogram_macros.h" |
grt | c291eea | 2016-05-26 15:38:48 | [diff] [blame] | 28 | #include "base/metrics/user_metrics.h" |
| 29 | #include "base/metrics/user_metrics_action.h" |
[email protected] | d24c401 | 2009-07-28 01:57:31 | [diff] [blame] | 30 | #include "base/path_service.h" |
[email protected] | 24a555b6 | 2013-06-10 22:01:17 | [diff] [blame] | 31 | #include "base/strings/string_util.h" |
| 32 | #include "base/strings/stringprintf.h" |
[email protected] | e309f31 | 2013-06-07 21:50:08 | [diff] [blame] | 33 | #include "base/strings/utf_string_conversions.h" |
pmonette | b18379f | 2017-06-01 01:18:44 | [diff] [blame] | 34 | #include "base/task_scheduler/post_task.h" |
pmonette | 32a5cfb4 | 2016-04-11 22:04:44 | [diff] [blame] | 35 | #include "base/time/time.h" |
| 36 | #include "base/timer/timer.h" |
[email protected] | 2d650398 | 2010-10-17 04:41:54 | [diff] [blame] | 37 | #include "base/win/registry.h" |
[email protected] | 0798330 | 2013-01-21 19:41:44 | [diff] [blame] | 38 | #include "base/win/scoped_propvariant.h" |
[email protected] | f1024e2 | 2012-09-12 07:14:55 | [diff] [blame] | 39 | #include "base/win/shortcut.h" |
[email protected] | 935aa54 | 2010-10-15 01:59:15 | [diff] [blame] | 40 | #include "base/win/windows_version.h" |
[email protected] | 89d4383 | 2013-06-29 20:25:20 | [diff] [blame] | 41 | #include "chrome/browser/policy/policy_path_parser.h" |
pmonette | 32a5cfb4 | 2016-04-11 22:04:44 | [diff] [blame] | 42 | #include "chrome/browser/shell_integration.h" |
[email protected] | c9bb06f4 | 2010-01-13 23:53:48 | [diff] [blame] | 43 | #include "chrome/browser/web_applications/web_app.h" |
grt | c291eea | 2016-05-26 15:38:48 | [diff] [blame] | 44 | #include "chrome/browser/win/settings_app_monitor.h" |
[email protected] | d24c401 | 2009-07-28 01:57:31 | [diff] [blame] | 45 | #include "chrome/common/chrome_constants.h" |
[email protected] | 12f520c | 2010-01-06 18:11:15 | [diff] [blame] | 46 | #include "chrome/common/chrome_paths_internal.h" |
[email protected] | c9bb06f4 | 2010-01-13 23:53:48 | [diff] [blame] | 47 | #include "chrome/common/chrome_switches.h" |
grt | c9880346 | 2017-03-08 10:05:08 | [diff] [blame] | 48 | #include "chrome/install_static/install_util.h" |
[email protected] | d24c401 | 2009-07-28 01:57:31 | [diff] [blame] | 49 | #include "chrome/installer/util/browser_distribution.h" |
[email protected] | 3f69d6e61 | 2012-08-03 18:52:27 | [diff] [blame] | 50 | #include "chrome/installer/util/install_util.h" |
pmonette | 0c40087a | 2016-04-21 00:05:16 | [diff] [blame] | 51 | #include "chrome/installer/util/scoped_user_protocol_entry.h" |
[email protected] | d24c401 | 2009-07-28 01:57:31 | [diff] [blame] | 52 | #include "chrome/installer/util/shell_util.h" |
Ken Rockot | c74e379 | 2018-02-10 16:31:30 | [diff] [blame] | 53 | #include "chrome/services/util_win/public/mojom/constants.mojom.h" |
| 54 | #include "chrome/services/util_win/public/mojom/shell_util_win.mojom.h" |
pmonette | 2b1dbee | 2016-01-08 20:18:58 | [diff] [blame] | 55 | #include "components/variations/variations_associated_data.h" |
Jay Civelli | d4b8905 | 2017-10-31 17:48:25 | [diff] [blame] | 56 | #include "content/public/common/service_manager_connection.h" |
| 57 | #include "services/service_manager/public/cpp/connector.h" |
[email protected] | d24c401 | 2009-07-28 01:57:31 | [diff] [blame] | 58 | |
pmonette | 9fa59e88 | 2016-02-10 00:12:19 | [diff] [blame] | 59 | namespace shell_integration { |
| 60 | |
[email protected] | 12f520c | 2010-01-06 18:11:15 | [diff] [blame] | 61 | namespace { |
| 62 | |
pmonette | 9fa59e88 | 2016-02-10 00:12:19 | [diff] [blame] | 63 | // Helper function for GetAppId to generates profile id |
[email protected] | 2f1c09d | 2011-01-14 14:58:14 | [diff] [blame] | 64 | // from profile path. "profile_id" is composed of sanitized basenames of |
[email protected] | 12f520c | 2010-01-06 18:11:15 | [diff] [blame] | 65 | // user data dir and profile dir joined by a ".". |
[email protected] | 6a72a63 | 2013-12-12 22:22:00 | [diff] [blame] | 66 | base::string16 GetProfileIdFromPath(const base::FilePath& profile_path) { |
[email protected] | 12f520c | 2010-01-06 18:11:15 | [diff] [blame] | 67 | // Return empty string if profile_path is empty |
| 68 | if (profile_path.empty()) |
[email protected] | 0085863a | 2013-12-06 21:19:03 | [diff] [blame] | 69 | return base::string16(); |
[email protected] | 12f520c | 2010-01-06 18:11:15 | [diff] [blame] | 70 | |
[email protected] | 650b2d5 | 2013-02-10 03:41:45 | [diff] [blame] | 71 | base::FilePath default_user_data_dir; |
[email protected] | 12f520c | 2010-01-06 18:11:15 | [diff] [blame] | 72 | // Return empty string if profile_path is in default user data |
| 73 | // dir and is the default profile. |
| 74 | if (chrome::GetDefaultUserDataDirectory(&default_user_data_dir) && |
| 75 | profile_path.DirName() == default_user_data_dir && |
[email protected] | 162b599 | 2011-03-15 19:40:48 | [diff] [blame] | 76 | profile_path.BaseName().value() == |
[email protected] | f911df5 | 2013-12-24 23:24:23 | [diff] [blame] | 77 | base::ASCIIToUTF16(chrome::kInitialProfile)) { |
[email protected] | 0085863a | 2013-12-06 21:19:03 | [diff] [blame] | 78 | return base::string16(); |
[email protected] | 162b599 | 2011-03-15 19:40:48 | [diff] [blame] | 79 | } |
[email protected] | 12f520c | 2010-01-06 18:11:15 | [diff] [blame] | 80 | |
| 81 | // Get joined basenames of user data dir and profile. |
[email protected] | 0085863a | 2013-12-06 21:19:03 | [diff] [blame] | 82 | base::string16 basenames = profile_path.DirName().BaseName().value() + |
[email protected] | 12f520c | 2010-01-06 18:11:15 | [diff] [blame] | 83 | L"." + profile_path.BaseName().value(); |
| 84 | |
[email protected] | 0085863a | 2013-12-06 21:19:03 | [diff] [blame] | 85 | base::string16 profile_id; |
[email protected] | 12f520c | 2010-01-06 18:11:15 | [diff] [blame] | 86 | profile_id.reserve(basenames.size()); |
| 87 | |
| 88 | // Generate profile_id from sanitized basenames. |
| 89 | for (size_t i = 0; i < basenames.length(); ++i) { |
brettw | b341306 | 2015-06-24 00:39:02 | [diff] [blame] | 90 | if (base::IsAsciiAlpha(basenames[i]) || |
| 91 | base::IsAsciiDigit(basenames[i]) || |
[email protected] | 12f520c | 2010-01-06 18:11:15 | [diff] [blame] | 92 | basenames[i] == L'.') |
| 93 | profile_id += basenames[i]; |
| 94 | } |
| 95 | |
| 96 | return profile_id; |
| 97 | } |
| 98 | |
tapted | c2c690ab | 2016-05-25 02:49:03 | [diff] [blame] | 99 | base::string16 GetAppListAppName() { |
| 100 | static const base::char16 kAppListAppNameSuffix[] = L"AppList"; |
grt | c9880346 | 2017-03-08 10:05:08 | [diff] [blame] | 101 | base::string16 app_name(install_static::GetBaseAppId()); |
tapted | c2c690ab | 2016-05-25 02:49:03 | [diff] [blame] | 102 | app_name.append(kAppListAppNameSuffix); |
| 103 | return app_name; |
| 104 | } |
| 105 | |
[email protected] | 8ea8f1ef | 2013-01-06 18:39:03 | [diff] [blame] | 106 | // Gets expected app id for given Chrome (based on |command_line| and |
| 107 | // |is_per_user_install|). |
avi | 556c0502 | 2014-12-22 23:31:43 | [diff] [blame] | 108 | base::string16 GetExpectedAppId(const base::CommandLine& command_line, |
[email protected] | 6a72a63 | 2013-12-12 22:22:00 | [diff] [blame] | 109 | bool is_per_user_install) { |
[email protected] | b39e32e | 2013-04-24 08:55:54 | [diff] [blame] | 110 | base::FilePath user_data_dir; |
| 111 | if (command_line.HasSwitch(switches::kUserDataDir)) |
| 112 | user_data_dir = command_line.GetSwitchValuePath(switches::kUserDataDir); |
| 113 | else |
| 114 | chrome::GetDefaultUserDataDirectory(&user_data_dir); |
[email protected] | 89d4383 | 2013-06-29 20:25:20 | [diff] [blame] | 115 | // Adjust with any policy that overrides any other way to set the path. |
| 116 | policy::path_parser::CheckUserDataDirPolicy(&user_data_dir); |
[email protected] | b39e32e | 2013-04-24 08:55:54 | [diff] [blame] | 117 | DCHECK(!user_data_dir.empty()); |
[email protected] | c9bb06f4 | 2010-01-13 23:53:48 | [diff] [blame] | 118 | |
[email protected] | b39e32e | 2013-04-24 08:55:54 | [diff] [blame] | 119 | base::FilePath profile_subdir; |
| 120 | if (command_line.HasSwitch(switches::kProfileDirectory)) { |
| 121 | profile_subdir = |
| 122 | command_line.GetSwitchValuePath(switches::kProfileDirectory); |
| 123 | } else { |
[email protected] | f911df5 | 2013-12-24 23:24:23 | [diff] [blame] | 124 | profile_subdir = |
| 125 | base::FilePath(base::ASCIIToUTF16(chrome::kInitialProfile)); |
[email protected] | b39e32e | 2013-04-24 08:55:54 | [diff] [blame] | 126 | } |
| 127 | DCHECK(!profile_subdir.empty()); |
| 128 | |
| 129 | base::FilePath profile_path = user_data_dir.Append(profile_subdir); |
[email protected] | 0085863a | 2013-12-06 21:19:03 | [diff] [blame] | 130 | base::string16 app_name; |
[email protected] | c9bb06f4 | 2010-01-13 23:53:48 | [diff] [blame] | 131 | if (command_line.HasSwitch(switches::kApp)) { |
[email protected] | f911df5 | 2013-12-24 23:24:23 | [diff] [blame] | 132 | app_name = base::UTF8ToUTF16(web_app::GenerateApplicationNameFromURL( |
[email protected] | 57ecc4b | 2010-08-11 03:02:51 | [diff] [blame] | 133 | GURL(command_line.GetSwitchValueASCII(switches::kApp)))); |
[email protected] | 2f1c09d | 2011-01-14 14:58:14 | [diff] [blame] | 134 | } else if (command_line.HasSwitch(switches::kAppId)) { |
[email protected] | f911df5 | 2013-12-24 23:24:23 | [diff] [blame] | 135 | app_name = base::UTF8ToUTF16( |
| 136 | web_app::GenerateApplicationNameFromExtensionId( |
| 137 | command_line.GetSwitchValueASCII(switches::kAppId))); |
tapted | c2c690ab | 2016-05-25 02:49:03 | [diff] [blame] | 138 | } else if (command_line.HasSwitch(switches::kShowAppList)) { |
| 139 | app_name = GetAppListAppName(); |
[email protected] | c9bb06f4 | 2010-01-13 23:53:48 | [diff] [blame] | 140 | } else { |
grt | c9880346 | 2017-03-08 10:05:08 | [diff] [blame] | 141 | app_name = ShellUtil::GetBrowserModelId(is_per_user_install); |
[email protected] | c9bb06f4 | 2010-01-13 23:53:48 | [diff] [blame] | 142 | } |
[email protected] | b39e32e | 2013-04-24 08:55:54 | [diff] [blame] | 143 | DCHECK(!app_name.empty()); |
[email protected] | c9bb06f4 | 2010-01-13 23:53:48 | [diff] [blame] | 144 | |
pmonette | 9e4c1a8 | 2016-04-14 18:15:30 | [diff] [blame] | 145 | return win::GetAppModelIdForProfile(app_name, profile_path); |
[email protected] | c9bb06f4 | 2010-01-13 23:53:48 | [diff] [blame] | 146 | } |
| 147 | |
gab | 88257b6 | 2016-01-15 03:19:19 | [diff] [blame] | 148 | void MigrateTaskbarPinsCallback() { |
Francois Doray | 66bdfd8 | 2017-10-20 13:50:37 | [diff] [blame] | 149 | base::AssertBlockingAllowed(); |
[email protected] | 3a3e72c | 2011-11-29 02:59:38 | [diff] [blame] | 150 | |
| 151 | // Get full path of chrome. |
[email protected] | 650b2d5 | 2013-02-10 03:41:45 | [diff] [blame] | 152 | base::FilePath chrome_exe; |
Avi Drissman | 9098f900 | 2018-05-04 00:11:52 | [diff] [blame] | 153 | if (!base::PathService::Get(base::FILE_EXE, &chrome_exe)) |
[email protected] | 3a3e72c | 2011-11-29 02:59:38 | [diff] [blame] | 154 | return; |
| 155 | |
gab | 88257b6 | 2016-01-15 03:19:19 | [diff] [blame] | 156 | base::FilePath pins_path; |
Avi Drissman | 9098f900 | 2018-05-04 00:11:52 | [diff] [blame] | 157 | if (!base::PathService::Get(base::DIR_TASKBAR_PINS, &pins_path)) { |
gab | 88257b6 | 2016-01-15 03:19:19 | [diff] [blame] | 158 | NOTREACHED(); |
| 159 | return; |
[email protected] | 3a3e72c | 2011-11-29 02:59:38 | [diff] [blame] | 160 | } |
gab | 88257b6 | 2016-01-15 03:19:19 | [diff] [blame] | 161 | |
pmonette | 9e4c1a8 | 2016-04-14 18:15:30 | [diff] [blame] | 162 | win::MigrateShortcutsInPathInternal(chrome_exe, pins_path); |
[email protected] | 3a3e72c | 2011-11-29 02:59:38 | [diff] [blame] | 163 | } |
| 164 | |
[email protected] | caa0535 | 2014-03-01 00:43:05 | [diff] [blame] | 165 | // Windows 8 introduced a new protocol->executable binding system which cannot |
| 166 | // be retrieved in the HKCR registry subkey method implemented below. We call |
| 167 | // AssocQueryString with the new Win8-only flag ASSOCF_IS_PROTOCOL instead. |
| 168 | base::string16 GetAppForProtocolUsingAssocQuery(const GURL& url) { |
thestig | 11bf74d | 2014-11-24 20:14:42 | [diff] [blame] | 169 | base::string16 url_scheme = base::ASCIIToUTF16(url.scheme()); |
[email protected] | caa0535 | 2014-03-01 00:43:05 | [diff] [blame] | 170 | // Don't attempt to query protocol association on an empty string. |
[email protected] | 6e84d37 | 2014-05-29 23:36:39 | [diff] [blame] | 171 | if (url_scheme.empty()) |
[email protected] | caa0535 | 2014-03-01 00:43:05 | [diff] [blame] | 172 | return base::string16(); |
| 173 | |
[email protected] | caa0535 | 2014-03-01 00:43:05 | [diff] [blame] | 174 | // Query AssocQueryString for a human-readable description of the program |
| 175 | // that will be invoked given the provided URL spec. This is used only to |
| 176 | // populate the external protocol dialog box the user sees when invoking |
| 177 | // an unknown external protocol. |
| 178 | wchar_t out_buffer[1024]; |
| 179 | DWORD buffer_size = arraysize(out_buffer); |
| 180 | HRESULT hr = AssocQueryString(ASSOCF_IS_PROTOCOL, |
| 181 | ASSOCSTR_FRIENDLYAPPNAME, |
[email protected] | 6e84d37 | 2014-05-29 23:36:39 | [diff] [blame] | 182 | url_scheme.c_str(), |
[email protected] | caa0535 | 2014-03-01 00:43:05 | [diff] [blame] | 183 | NULL, |
| 184 | out_buffer, |
| 185 | &buffer_size); |
| 186 | if (FAILED(hr)) { |
| 187 | DLOG(WARNING) << "AssocQueryString failed!"; |
| 188 | return base::string16(); |
| 189 | } |
| 190 | return base::string16(out_buffer); |
| 191 | } |
| 192 | |
| 193 | base::string16 GetAppForProtocolUsingRegistry(const GURL& url) { |
dominickn | 0c9a506 | 2016-10-06 20:49:00 | [diff] [blame] | 194 | base::string16 command_to_launch; |
| 195 | |
| 196 | // First, try and extract the application's display name. |
| 197 | base::string16 cmd_key_path = base::ASCIIToUTF16(url.scheme()); |
| 198 | base::win::RegKey cmd_key_name(HKEY_CLASSES_ROOT, cmd_key_path.c_str(), |
| 199 | KEY_READ); |
| 200 | if (cmd_key_name.ReadValue(NULL, &command_to_launch) == ERROR_SUCCESS && |
| 201 | !command_to_launch.empty()) { |
| 202 | return command_to_launch; |
[email protected] | caa0535 | 2014-03-01 00:43:05 | [diff] [blame] | 203 | } |
dominickn | 0c9a506 | 2016-10-06 20:49:00 | [diff] [blame] | 204 | |
| 205 | // Otherwise, parse the command line in the registry, and return the basename |
| 206 | // of the program path if it exists. |
| 207 | cmd_key_path = base::ASCIIToUTF16(url.scheme() + "\\shell\\open\\command"); |
| 208 | base::win::RegKey cmd_key_exe(HKEY_CLASSES_ROOT, cmd_key_path.c_str(), |
| 209 | KEY_READ); |
| 210 | if (cmd_key_exe.ReadValue(NULL, &command_to_launch) == ERROR_SUCCESS) { |
| 211 | base::CommandLine command_line( |
| 212 | base::CommandLine::FromString(command_to_launch)); |
| 213 | return command_line.GetProgram().BaseName().value(); |
| 214 | } |
| 215 | |
[email protected] | caa0535 | 2014-03-01 00:43:05 | [diff] [blame] | 216 | return base::string16(); |
| 217 | } |
| 218 | |
pmonette | 9fa59e88 | 2016-02-10 00:12:19 | [diff] [blame] | 219 | DefaultWebClientState GetDefaultWebClientStateFromShellUtilDefaultState( |
| 220 | ShellUtil::DefaultState default_state) { |
[email protected] | eb63da7 | 2012-10-15 20:39:48 | [diff] [blame] | 221 | switch (default_state) { |
Greg Thompson | 75b1c8e | 2017-08-16 13:36:28 | [diff] [blame] | 222 | case ShellUtil::UNKNOWN_DEFAULT: |
| 223 | return DefaultWebClientState::UNKNOWN_DEFAULT; |
[email protected] | eb63da7 | 2012-10-15 20:39:48 | [diff] [blame] | 224 | case ShellUtil::NOT_DEFAULT: |
pmonette | 9fa59e88 | 2016-02-10 00:12:19 | [diff] [blame] | 225 | return DefaultWebClientState::NOT_DEFAULT; |
[email protected] | eb63da7 | 2012-10-15 20:39:48 | [diff] [blame] | 226 | case ShellUtil::IS_DEFAULT: |
pmonette | 9fa59e88 | 2016-02-10 00:12:19 | [diff] [blame] | 227 | return DefaultWebClientState::IS_DEFAULT; |
Greg Thompson | 75b1c8e | 2017-08-16 13:36:28 | [diff] [blame] | 228 | case ShellUtil::OTHER_MODE_IS_DEFAULT: |
| 229 | return DefaultWebClientState::OTHER_MODE_IS_DEFAULT; |
[email protected] | eb63da7 | 2012-10-15 20:39:48 | [diff] [blame] | 230 | } |
Greg Thompson | 75b1c8e | 2017-08-16 13:36:28 | [diff] [blame] | 231 | NOTREACHED(); |
| 232 | return DefaultWebClientState::UNKNOWN_DEFAULT; |
[email protected] | eb63da7 | 2012-10-15 20:39:48 | [diff] [blame] | 233 | } |
| 234 | |
grt | c291eea | 2016-05-26 15:38:48 | [diff] [blame] | 235 | // A recorder of user actions in the Windows Settings app. |
Patrick Monette | 7ff99e0 | 2018-02-19 17:30:12 | [diff] [blame] | 236 | class DefaultBrowserActionRecorder : public SettingsAppMonitor::Delegate { |
grt | c291eea | 2016-05-26 15:38:48 | [diff] [blame] | 237 | public: |
| 238 | // Creates the recorder and the monitor that drives it. |continuation| will be |
| 239 | // run once the monitor's initialization completes (regardless of success or |
| 240 | // failure). |
| 241 | explicit DefaultBrowserActionRecorder(base::Closure continuation) |
| 242 | : continuation_(std::move(continuation)), settings_app_monitor_(this) {} |
| 243 | |
| 244 | private: |
| 245 | // win::SettingsAppMonitor::Delegate: |
| 246 | void OnInitialized(HRESULT result) override { |
| 247 | UMA_HISTOGRAM_BOOLEAN("SettingsAppMonitor.InitializationResult", |
| 248 | SUCCEEDED(result)); |
| 249 | if (SUCCEEDED(result)) { |
| 250 | base::RecordAction( |
| 251 | base::UserMetricsAction("SettingsAppMonitor.Initialized")); |
| 252 | } |
| 253 | continuation_.Run(); |
| 254 | continuation_ = base::Closure(); |
| 255 | } |
| 256 | |
| 257 | void OnAppFocused() override { |
| 258 | base::RecordAction( |
| 259 | base::UserMetricsAction("SettingsAppMonitor.AppFocused")); |
| 260 | } |
| 261 | |
| 262 | void OnChooserInvoked() override { |
| 263 | base::RecordAction( |
| 264 | base::UserMetricsAction("SettingsAppMonitor.ChooserInvoked")); |
| 265 | } |
| 266 | |
| 267 | void OnBrowserChosen(const base::string16& browser_name) override { |
| 268 | if (browser_name == |
| 269 | BrowserDistribution::GetDistribution()->GetDisplayName()) { |
| 270 | base::RecordAction( |
| 271 | base::UserMetricsAction("SettingsAppMonitor.ChromeBrowserChosen")); |
| 272 | } else { |
| 273 | base::RecordAction( |
| 274 | base::UserMetricsAction("SettingsAppMonitor.OtherBrowserChosen")); |
| 275 | } |
| 276 | } |
| 277 | |
pmonette | b66514b4 | 2016-12-07 20:28:39 | [diff] [blame] | 278 | void OnPromoFocused() override { |
| 279 | base::RecordAction( |
| 280 | base::UserMetricsAction("SettingsAppMonitor.PromoFocused")); |
| 281 | } |
| 282 | |
| 283 | void OnPromoChoiceMade(bool accept_promo) override { |
| 284 | if (accept_promo) { |
| 285 | base::RecordAction( |
| 286 | base::UserMetricsAction("SettingsAppMonitor.CheckItOut")); |
| 287 | } else { |
| 288 | base::RecordAction( |
| 289 | base::UserMetricsAction("SettingsAppMonitor.SwitchAnyway")); |
| 290 | } |
| 291 | } |
| 292 | |
grt | c291eea | 2016-05-26 15:38:48 | [diff] [blame] | 293 | // A closure to be run once initialization completes. |
| 294 | base::Closure continuation_; |
| 295 | |
| 296 | // Monitors user interaction with the Windows Settings app for the sake of |
| 297 | // reporting user actions. |
Patrick Monette | 7ff99e0 | 2018-02-19 17:30:12 | [diff] [blame] | 298 | SettingsAppMonitor settings_app_monitor_; |
grt | c291eea | 2016-05-26 15:38:48 | [diff] [blame] | 299 | |
| 300 | DISALLOW_COPY_AND_ASSIGN(DefaultBrowserActionRecorder); |
| 301 | }; |
| 302 | |
| 303 | // A function bound up in a callback with a DefaultBrowserActionRecorder and |
| 304 | // a closure to keep the former alive until the time comes to run the latter. |
| 305 | void OnSettingsAppFinished( |
| 306 | std::unique_ptr<DefaultBrowserActionRecorder> recorder, |
| 307 | const base::Closure& on_finished_callback) { |
| 308 | recorder.reset(); |
| 309 | on_finished_callback.Run(); |
| 310 | } |
| 311 | |
pmonette | 32a5cfb4 | 2016-04-11 22:04:44 | [diff] [blame] | 312 | // There is no way to make sure the user is done with the system settings, but a |
| 313 | // signal that the interaction is finished is needed for UMA. A timer of 2 |
| 314 | // minutes is used as a substitute. The registry keys for the protocol |
| 315 | // association with an app are also monitored to signal the end of the |
| 316 | // interaction early when it is clear that the user made a choice (e.g. http |
| 317 | // and https for default browser). |
| 318 | // |
| 319 | // This helper class manages both the timer and the registry watchers and makes |
| 320 | // sure the callback for the end of the settings interaction is only run once. |
| 321 | // This class also manages its own lifetime. |
| 322 | class OpenSystemSettingsHelper { |
| 323 | public: |
| 324 | // Begin the monitoring and will call |on_finished_callback| when done. |
| 325 | // Takes in a null-terminated array of |protocols| whose registry keys must be |
pmonette | 0c40087a | 2016-04-21 00:05:16 | [diff] [blame] | 326 | // watched. The array must contain at least one element. |
pmonette | 32a5cfb4 | 2016-04-11 22:04:44 | [diff] [blame] | 327 | static void Begin(const wchar_t* const protocols[], |
| 328 | const base::Closure& on_finished_callback) { |
Francois Doray | 66bdfd8 | 2017-10-20 13:50:37 | [diff] [blame] | 329 | base::AssertBlockingAllowed(); |
pmonette | c541d94 | 2016-06-15 22:08:32 | [diff] [blame] | 330 | |
| 331 | delete instance_; |
| 332 | instance_ = new OpenSystemSettingsHelper(protocols, on_finished_callback); |
pmonette | 32a5cfb4 | 2016-04-11 22:04:44 | [diff] [blame] | 333 | } |
| 334 | |
| 335 | private: |
| 336 | // The reason the settings interaction concluded. Do not modify the ordering |
| 337 | // because it is used for UMA. |
| 338 | enum ConcludeReason { REGISTRY_WATCHER, TIMEOUT, NUM_CONCLUDE_REASON_TYPES }; |
| 339 | |
| 340 | OpenSystemSettingsHelper(const wchar_t* const protocols[], |
| 341 | const base::Closure& on_finished_callback) |
pmonette | 0c40087a | 2016-04-21 00:05:16 | [diff] [blame] | 342 | : scoped_user_protocol_entry_(protocols[0]), |
| 343 | on_finished_callback_(on_finished_callback), |
| 344 | weak_ptr_factory_(this) { |
pmonette | 32a5cfb4 | 2016-04-11 22:04:44 | [diff] [blame] | 345 | static const wchar_t kUrlAssociationFormat[] = |
| 346 | L"SOFTWARE\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\" |
| 347 | L"%ls\\UserChoice"; |
| 348 | |
| 349 | // Remember the start time. |
| 350 | start_time_ = base::TimeTicks::Now(); |
| 351 | |
| 352 | for (const wchar_t* const* scan = &protocols[0]; *scan != nullptr; ++scan) { |
| 353 | AddRegistryKeyWatcher( |
| 354 | base::StringPrintf(kUrlAssociationFormat, *scan).c_str()); |
| 355 | } |
| 356 | // Only the watchers that were succesfully initialized are counted. |
| 357 | registry_watcher_count_ = registry_key_watchers_.size(); |
| 358 | |
| 359 | timer_.Start( |
| 360 | FROM_HERE, base::TimeDelta::FromMinutes(2), |
| 361 | base::Bind(&OpenSystemSettingsHelper::ConcludeInteraction, |
| 362 | weak_ptr_factory_.GetWeakPtr(), ConcludeReason::TIMEOUT)); |
| 363 | } |
| 364 | |
pmonette | b18379f | 2017-06-01 01:18:44 | [diff] [blame] | 365 | ~OpenSystemSettingsHelper() { |
| 366 | DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 367 | } |
| 368 | |
pmonette | 32a5cfb4 | 2016-04-11 22:04:44 | [diff] [blame] | 369 | // Called when a change is detected on one of the registry keys being watched. |
| 370 | // Note: All types of modification to the registry key will trigger this |
| 371 | // function even if the value change is the only one that matters. This |
| 372 | // is good enough for now. |
| 373 | void OnRegistryKeyChanged() { |
pmonette | b18379f | 2017-06-01 01:18:44 | [diff] [blame] | 374 | DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
pmonette | 32a5cfb4 | 2016-04-11 22:04:44 | [diff] [blame] | 375 | // Make sure all the registry watchers have fired. |
| 376 | if (--registry_watcher_count_ == 0) { |
| 377 | UMA_HISTOGRAM_MEDIUM_TIMES( |
| 378 | "DefaultBrowser.SettingsInteraction.RegistryWatcherDuration", |
| 379 | base::TimeTicks::Now() - start_time_); |
| 380 | |
| 381 | ConcludeInteraction(ConcludeReason::REGISTRY_WATCHER); |
| 382 | } |
| 383 | } |
| 384 | |
| 385 | // Ends the monitoring with the system settings. Will call |
| 386 | // |on_finished_callback_| and then dispose of this class instance to make |
| 387 | // sure the callback won't get called subsequently. |
| 388 | void ConcludeInteraction(ConcludeReason conclude_reason) { |
pmonette | b18379f | 2017-06-01 01:18:44 | [diff] [blame] | 389 | DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
pmonette | 32a5cfb4 | 2016-04-11 22:04:44 | [diff] [blame] | 390 | |
| 391 | UMA_HISTOGRAM_ENUMERATION( |
| 392 | "DefaultBrowser.SettingsInteraction.ConcludeReason", conclude_reason, |
| 393 | NUM_CONCLUDE_REASON_TYPES); |
| 394 | on_finished_callback_.Run(); |
pmonette | c541d94 | 2016-06-15 22:08:32 | [diff] [blame] | 395 | delete instance_; |
| 396 | instance_ = nullptr; |
pmonette | 32a5cfb4 | 2016-04-11 22:04:44 | [diff] [blame] | 397 | } |
| 398 | |
| 399 | // Helper function to create a registry watcher for a given |key_path|. Do |
| 400 | // nothing on initialization failure. |
| 401 | void AddRegistryKeyWatcher(const wchar_t* key_path) { |
pmonette | b18379f | 2017-06-01 01:18:44 | [diff] [blame] | 402 | DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 403 | |
Jeremy Roman | ec48d7a | 2018-03-01 17:35:09 | [diff] [blame] | 404 | auto reg_key = std::make_unique<base::win::RegKey>(HKEY_CURRENT_USER, |
ricea | 86fa1dd | 2016-09-13 05:59:45 | [diff] [blame] | 405 | key_path, KEY_NOTIFY); |
pmonette | 32a5cfb4 | 2016-04-11 22:04:44 | [diff] [blame] | 406 | |
| 407 | if (reg_key->Valid() && |
| 408 | reg_key->StartWatching( |
| 409 | base::Bind(&OpenSystemSettingsHelper::OnRegistryKeyChanged, |
| 410 | weak_ptr_factory_.GetWeakPtr()))) { |
| 411 | registry_key_watchers_.push_back(std::move(reg_key)); |
| 412 | } |
| 413 | } |
| 414 | |
pmonette | c541d94 | 2016-06-15 22:08:32 | [diff] [blame] | 415 | // Used to make sure only one instance is alive at the same time. |
| 416 | static OpenSystemSettingsHelper* instance_; |
| 417 | |
pmonette | 0c40087a | 2016-04-21 00:05:16 | [diff] [blame] | 418 | // This is needed to make sure that Windows displays an entry for the protocol |
| 419 | // inside the "Choose default apps by protocol" settings page. |
| 420 | ScopedUserProtocolEntry scoped_user_protocol_entry_; |
| 421 | |
pmonette | 32a5cfb4 | 2016-04-11 22:04:44 | [diff] [blame] | 422 | // The function to call when the interaction with the system settings is |
| 423 | // finished. |
| 424 | base::Closure on_finished_callback_; |
| 425 | |
| 426 | // The number of time the registry key watchers must fire. |
| 427 | int registry_watcher_count_ = 0; |
| 428 | |
| 429 | // There can be multiple registry key watchers as some settings modify |
| 430 | // multiple protocol associations. e.g. Changing the default browser modifies |
| 431 | // the http and https associations. |
dcheng | 4af4858 | 2016-04-19 00:29:35 | [diff] [blame] | 432 | std::vector<std::unique_ptr<base::win::RegKey>> registry_key_watchers_; |
pmonette | 32a5cfb4 | 2016-04-11 22:04:44 | [diff] [blame] | 433 | |
| 434 | base::OneShotTimer timer_; |
| 435 | |
| 436 | // Records the time it takes for the final registry watcher to get signaled. |
| 437 | base::TimeTicks start_time_; |
| 438 | |
pmonette | b18379f | 2017-06-01 01:18:44 | [diff] [blame] | 439 | SEQUENCE_CHECKER(sequence_checker_); |
| 440 | |
pmonette | 32a5cfb4 | 2016-04-11 22:04:44 | [diff] [blame] | 441 | // Weak ptrs are used to bind this class to the callbacks of the timer and the |
| 442 | // registry watcher. This makes it possible to self-delete after one of the |
| 443 | // callbacks is executed to cancel the remaining ones. |
| 444 | base::WeakPtrFactory<OpenSystemSettingsHelper> weak_ptr_factory_; |
| 445 | |
| 446 | DISALLOW_COPY_AND_ASSIGN(OpenSystemSettingsHelper); |
| 447 | }; |
| 448 | |
pmonette | c541d94 | 2016-06-15 22:08:32 | [diff] [blame] | 449 | OpenSystemSettingsHelper* OpenSystemSettingsHelper::instance_ = nullptr; |
| 450 | |
pmonette | a9831524 | 2016-11-23 21:39:18 | [diff] [blame] | 451 | // Helper class to determine if Chrome is pinned to the taskbar. Hides the |
Jay Civelli | d4b8905 | 2017-10-31 17:48:25 | [diff] [blame] | 452 | // complexity of managing the lifetime of the connection to the ChromeWinUtil |
| 453 | // service. |
pmonette | a9831524 | 2016-11-23 21:39:18 | [diff] [blame] | 454 | class IsPinnedToTaskbarHelper { |
| 455 | public: |
| 456 | using ResultCallback = win::IsPinnedToTaskbarCallback; |
| 457 | using ErrorCallback = win::ConnectionErrorCallback; |
Jay Civelli | d4b8905 | 2017-10-31 17:48:25 | [diff] [blame] | 458 | static void GetState(std::unique_ptr<service_manager::Connector> connector, |
| 459 | const ErrorCallback& error_callback, |
pmonette | a9831524 | 2016-11-23 21:39:18 | [diff] [blame] | 460 | const ResultCallback& result_callback); |
| 461 | |
| 462 | private: |
Jay Civelli | d4b8905 | 2017-10-31 17:48:25 | [diff] [blame] | 463 | IsPinnedToTaskbarHelper(std::unique_ptr<service_manager::Connector> connector, |
| 464 | const ErrorCallback& error_callback, |
pmonette | a9831524 | 2016-11-23 21:39:18 | [diff] [blame] | 465 | const ResultCallback& result_callback); |
| 466 | |
| 467 | void OnConnectionError(); |
| 468 | void OnIsPinnedToTaskbarResult(bool succeeded, bool is_pinned_to_taskbar); |
| 469 | |
Jay Civelli | d4b8905 | 2017-10-31 17:48:25 | [diff] [blame] | 470 | chrome::mojom::ShellUtilWinPtr shell_util_win_ptr_; |
| 471 | // The connector used to retrieve the Patch service. We can't simply use |
| 472 | // content::ServiceManagerConnection::GetForProcess()->GetConnector() as this |
| 473 | // is called on a background thread. |
| 474 | std::unique_ptr<service_manager::Connector> connector_; |
pmonette | a9831524 | 2016-11-23 21:39:18 | [diff] [blame] | 475 | |
| 476 | ErrorCallback error_callback_; |
| 477 | ResultCallback result_callback_; |
| 478 | |
pmonette | b18379f | 2017-06-01 01:18:44 | [diff] [blame] | 479 | SEQUENCE_CHECKER(sequence_checker_); |
| 480 | |
pmonette | a9831524 | 2016-11-23 21:39:18 | [diff] [blame] | 481 | DISALLOW_COPY_AND_ASSIGN(IsPinnedToTaskbarHelper); |
| 482 | }; |
| 483 | |
| 484 | // static |
Jay Civelli | d4b8905 | 2017-10-31 17:48:25 | [diff] [blame] | 485 | void IsPinnedToTaskbarHelper::GetState( |
| 486 | std::unique_ptr<service_manager::Connector> connector, |
| 487 | const ErrorCallback& error_callback, |
| 488 | const ResultCallback& result_callback) { |
pmonette | a9831524 | 2016-11-23 21:39:18 | [diff] [blame] | 489 | // Self-deleting when the ShellHandler completes. |
Jay Civelli | d4b8905 | 2017-10-31 17:48:25 | [diff] [blame] | 490 | new IsPinnedToTaskbarHelper(std::move(connector), error_callback, |
| 491 | result_callback); |
pmonette | 5057ca3b | 2016-07-04 16:48:40 | [diff] [blame] | 492 | } |
| 493 | |
pmonette | a9831524 | 2016-11-23 21:39:18 | [diff] [blame] | 494 | IsPinnedToTaskbarHelper::IsPinnedToTaskbarHelper( |
Jay Civelli | d4b8905 | 2017-10-31 17:48:25 | [diff] [blame] | 495 | std::unique_ptr<service_manager::Connector> connector, |
pmonette | a9831524 | 2016-11-23 21:39:18 | [diff] [blame] | 496 | const ErrorCallback& error_callback, |
| 497 | const ResultCallback& result_callback) |
Jay Civelli | d4b8905 | 2017-10-31 17:48:25 | [diff] [blame] | 498 | : connector_(std::move(connector)), |
pmonette | a9831524 | 2016-11-23 21:39:18 | [diff] [blame] | 499 | error_callback_(error_callback), |
| 500 | result_callback_(result_callback) { |
pmonette | 83edc1e | 2016-12-15 17:36:44 | [diff] [blame] | 501 | DCHECK(error_callback_); |
| 502 | DCHECK(result_callback_); |
| 503 | |
Jay Civelli | d4b8905 | 2017-10-31 17:48:25 | [diff] [blame] | 504 | connector_->BindInterface(chrome::mojom::kUtilWinServiceName, |
| 505 | &shell_util_win_ptr_); |
| 506 | // |shell_util_win_ptr_| owns the callbacks and is guaranteed to be destroyed |
pmonette | a9831524 | 2016-11-23 21:39:18 | [diff] [blame] | 507 | // before |this|, therefore making base::Unretained() safe to use. |
Jay Civelli | d4b8905 | 2017-10-31 17:48:25 | [diff] [blame] | 508 | shell_util_win_ptr_.set_connection_error_handler(base::Bind( |
pmonette | a9831524 | 2016-11-23 21:39:18 | [diff] [blame] | 509 | &IsPinnedToTaskbarHelper::OnConnectionError, base::Unretained(this))); |
Jay Civelli | d4b8905 | 2017-10-31 17:48:25 | [diff] [blame] | 510 | shell_util_win_ptr_->IsPinnedToTaskbar( |
pmonette | a9831524 | 2016-11-23 21:39:18 | [diff] [blame] | 511 | base::Bind(&IsPinnedToTaskbarHelper::OnIsPinnedToTaskbarResult, |
| 512 | base::Unretained(this))); |
| 513 | } |
| 514 | |
| 515 | void IsPinnedToTaskbarHelper::OnConnectionError() { |
pmonette | b18379f | 2017-06-01 01:18:44 | [diff] [blame] | 516 | DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
pmonette | a9831524 | 2016-11-23 21:39:18 | [diff] [blame] | 517 | error_callback_.Run(); |
| 518 | delete this; |
| 519 | } |
| 520 | |
| 521 | void IsPinnedToTaskbarHelper::OnIsPinnedToTaskbarResult( |
pmonette | 5057ca3b | 2016-07-04 16:48:40 | [diff] [blame] | 522 | bool succeeded, |
| 523 | bool is_pinned_to_taskbar) { |
pmonette | b18379f | 2017-06-01 01:18:44 | [diff] [blame] | 524 | DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 525 | |
pmonette | a9831524 | 2016-11-23 21:39:18 | [diff] [blame] | 526 | result_callback_.Run(succeeded, is_pinned_to_taskbar); |
| 527 | delete this; |
pmonette | 5057ca3b | 2016-07-04 16:48:40 | [diff] [blame] | 528 | } |
| 529 | |
[email protected] | 3a3e72c | 2011-11-29 02:59:38 | [diff] [blame] | 530 | } // namespace |
[email protected] | 12f520c | 2010-01-06 18:11:15 | [diff] [blame] | 531 | |
pmonette | 9fa59e88 | 2016-02-10 00:12:19 | [diff] [blame] | 532 | bool SetAsDefaultBrowser() { |
Francois Doray | 66bdfd8 | 2017-10-20 13:50:37 | [diff] [blame] | 533 | base::AssertBlockingAllowed(); |
pmonette | b18379f | 2017-06-01 01:18:44 | [diff] [blame] | 534 | |
[email protected] | 650b2d5 | 2013-02-10 03:41:45 | [diff] [blame] | 535 | base::FilePath chrome_exe; |
Avi Drissman | 9098f900 | 2018-05-04 00:11:52 | [diff] [blame] | 536 | if (!base::PathService::Get(base::FILE_EXE, &chrome_exe)) { |
[email protected] | d24c401 | 2009-07-28 01:57:31 | [diff] [blame] | 537 | LOG(ERROR) << "Error getting app exe path"; |
| 538 | return false; |
| 539 | } |
| 540 | |
| 541 | // From UI currently we only allow setting default browser for current user. |
[email protected] | bf6117c7e | 2010-12-01 06:00:25 | [diff] [blame] | 542 | BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
grt | e76ca285 | 2014-12-05 16:42:10 | [diff] [blame] | 543 | if (!ShellUtil::MakeChromeDefault(dist, ShellUtil::CURRENT_USER, chrome_exe, |
| 544 | true /* elevate_if_not_admin */)) { |
[email protected] | d24c401 | 2009-07-28 01:57:31 | [diff] [blame] | 545 | LOG(ERROR) << "Chrome could not be set as default browser."; |
| 546 | return false; |
| 547 | } |
| 548 | |
[email protected] | 8e96e50 | 2010-10-21 20:57:12 | [diff] [blame] | 549 | VLOG(1) << "Chrome registered as default browser."; |
[email protected] | d24c401 | 2009-07-28 01:57:31 | [diff] [blame] | 550 | return true; |
| 551 | } |
| 552 | |
pmonette | 9fa59e88 | 2016-02-10 00:12:19 | [diff] [blame] | 553 | bool SetAsDefaultProtocolClient(const std::string& protocol) { |
Francois Doray | 66bdfd8 | 2017-10-20 13:50:37 | [diff] [blame] | 554 | base::AssertBlockingAllowed(); |
pmonette | b18379f | 2017-06-01 01:18:44 | [diff] [blame] | 555 | |
[email protected] | 4468a5b | 2011-05-26 07:48:02 | [diff] [blame] | 556 | if (protocol.empty()) |
| 557 | return false; |
| 558 | |
[email protected] | 650b2d5 | 2013-02-10 03:41:45 | [diff] [blame] | 559 | base::FilePath chrome_exe; |
Avi Drissman | 9098f900 | 2018-05-04 00:11:52 | [diff] [blame] | 560 | if (!base::PathService::Get(base::FILE_EXE, &chrome_exe)) { |
[email protected] | 4468a5b | 2011-05-26 07:48:02 | [diff] [blame] | 561 | LOG(ERROR) << "Error getting app exe path"; |
| 562 | return false; |
| 563 | } |
| 564 | |
[email protected] | f911df5 | 2013-12-24 23:24:23 | [diff] [blame] | 565 | base::string16 wprotocol(base::UTF8ToUTF16(protocol)); |
[email protected] | 4468a5b | 2011-05-26 07:48:02 | [diff] [blame] | 566 | BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
grt | e76ca285 | 2014-12-05 16:42:10 | [diff] [blame] | 567 | if (!ShellUtil::MakeChromeDefaultProtocolClient(dist, chrome_exe, |
| 568 | wprotocol)) { |
[email protected] | 4468a5b | 2011-05-26 07:48:02 | [diff] [blame] | 569 | LOG(ERROR) << "Chrome could not be set as default handler for " |
| 570 | << protocol << "."; |
| 571 | return false; |
| 572 | } |
| 573 | |
| 574 | VLOG(1) << "Chrome registered as default handler for " << protocol << "."; |
| 575 | return true; |
| 576 | } |
| 577 | |
pmonette | 32a5cfb4 | 2016-04-11 22:04:44 | [diff] [blame] | 578 | DefaultWebClientSetPermission GetDefaultWebClientSetPermission() { |
grt | 509bc94 | 2017-03-25 08:43:21 | [diff] [blame] | 579 | if (!install_static::SupportsSetAsDefaultBrowser()) |
pmonette | 034a03d9 | 2015-10-02 21:04:27 | [diff] [blame] | 580 | return SET_DEFAULT_NOT_ALLOWED; |
pmonette | 034a03d9 | 2015-10-02 21:04:27 | [diff] [blame] | 581 | if (ShellUtil::CanMakeChromeDefaultUnattended()) |
| 582 | return SET_DEFAULT_UNATTENDED; |
pmonette | 32a5cfb4 | 2016-04-11 22:04:44 | [diff] [blame] | 583 | // Windows 8 and 10 both introduced a new way to set the default web client |
| 584 | // which require user interaction. |
pmonette | f89ac7c7 | 2015-10-06 03:22:01 | [diff] [blame] | 585 | return SET_DEFAULT_INTERACTIVE; |
pmonette | 034a03d9 | 2015-10-02 21:04:27 | [diff] [blame] | 586 | } |
| 587 | |
pmonette | 9fa59e88 | 2016-02-10 00:12:19 | [diff] [blame] | 588 | bool IsElevationNeededForSettingDefaultProtocolClient() { |
pmonette | 868ca64 | 2015-09-02 14:34:02 | [diff] [blame] | 589 | return base::win::GetVersion() < base::win::VERSION_WIN8; |
| 590 | } |
| 591 | |
pmonette | 9fa59e88 | 2016-02-10 00:12:19 | [diff] [blame] | 592 | base::string16 GetApplicationNameForProtocol(const GURL& url) { |
benwells | d0c67aa | 2016-07-28 02:57:20 | [diff] [blame] | 593 | base::string16 application_name; |
| 594 | // Windows 8 or above has a new protocol association query. |
| 595 | if (base::win::GetVersion() >= base::win::VERSION_WIN8) { |
| 596 | application_name = GetAppForProtocolUsingAssocQuery(url); |
| 597 | if (!application_name.empty()) |
| 598 | return application_name; |
| 599 | } |
| 600 | |
| 601 | return GetAppForProtocolUsingRegistry(url); |
[email protected] | 42dc940 | 2013-01-30 07:54:20 | [diff] [blame] | 602 | } |
| 603 | |
pmonette | 9fa59e88 | 2016-02-10 00:12:19 | [diff] [blame] | 604 | DefaultWebClientState GetDefaultBrowser() { |
pmonette | 034a03d9 | 2015-10-02 21:04:27 | [diff] [blame] | 605 | return GetDefaultWebClientStateFromShellUtilDefaultState( |
| 606 | ShellUtil::GetChromeDefaultState()); |
| 607 | } |
| 608 | |
[email protected] | d24c401 | 2009-07-28 01:57:31 | [diff] [blame] | 609 | // There is no reliable way to say which browser is default on a machine (each |
| 610 | // browser can have some of the protocols/shortcuts). So we look for only HTTP |
| 611 | // protocol handler. Even this handler is located at different places in |
| 612 | // registry on XP and Vista: |
| 613 | // - HKCR\http\shell\open\command (XP) |
| 614 | // - HKCU\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\ |
| 615 | // http\UserChoice (Vista) |
thakis | e4a02ff3 | 2016-09-20 17:00:42 | [diff] [blame] | 616 | // This method checks if Firefox is default browser by checking these |
[email protected] | d24c401 | 2009-07-28 01:57:31 | [diff] [blame] | 617 | // locations and returns true if Firefox traces are found there. In case of |
| 618 | // error (or if Firefox is not found)it returns the default value which |
| 619 | // is false. |
pmonette | 9fa59e88 | 2016-02-10 00:12:19 | [diff] [blame] | 620 | bool IsFirefoxDefaultBrowser() { |
Patrick Monette | ab240ec | 2017-07-13 22:49:14 | [diff] [blame] | 621 | base::string16 app_cmd; |
| 622 | base::win::RegKey key(HKEY_CURRENT_USER, ShellUtil::kRegVistaUrlPrefs, |
| 623 | KEY_READ); |
| 624 | return key.Valid() && key.ReadValue(L"Progid", &app_cmd) == ERROR_SUCCESS && |
| 625 | app_cmd == L"FirefoxURL"; |
[email protected] | d24c401 | 2009-07-28 01:57:31 | [diff] [blame] | 626 | } |
[email protected] | 12f520c | 2010-01-06 18:11:15 | [diff] [blame] | 627 | |
pmonette | 9fa59e88 | 2016-02-10 00:12:19 | [diff] [blame] | 628 | DefaultWebClientState IsDefaultProtocolClient(const std::string& protocol) { |
pmonette | 034a03d9 | 2015-10-02 21:04:27 | [diff] [blame] | 629 | return GetDefaultWebClientStateFromShellUtilDefaultState( |
| 630 | ShellUtil::GetChromeDefaultProtocolClientState( |
| 631 | base::UTF8ToUTF16(protocol))); |
| 632 | } |
| 633 | |
pmonette | 9e4c1a8 | 2016-04-14 18:15:30 | [diff] [blame] | 634 | namespace win { |
| 635 | |
| 636 | bool SetAsDefaultBrowserUsingIntentPicker() { |
Francois Doray | 66bdfd8 | 2017-10-20 13:50:37 | [diff] [blame] | 637 | base::AssertBlockingAllowed(); |
pmonette | b18379f | 2017-06-01 01:18:44 | [diff] [blame] | 638 | |
pmonette | 9e4c1a8 | 2016-04-14 18:15:30 | [diff] [blame] | 639 | base::FilePath chrome_exe; |
Avi Drissman | 9098f900 | 2018-05-04 00:11:52 | [diff] [blame] | 640 | if (!base::PathService::Get(base::FILE_EXE, &chrome_exe)) { |
pmonette | 9e4c1a8 | 2016-04-14 18:15:30 | [diff] [blame] | 641 | NOTREACHED() << "Error getting app exe path"; |
| 642 | return false; |
| 643 | } |
| 644 | |
| 645 | BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 646 | if (!ShellUtil::ShowMakeChromeDefaultSystemUI(dist, chrome_exe)) { |
| 647 | LOG(ERROR) << "Failed to launch the set-default-browser Windows UI."; |
| 648 | return false; |
| 649 | } |
| 650 | |
| 651 | VLOG(1) << "Set-default-browser Windows UI completed."; |
| 652 | return true; |
| 653 | } |
| 654 | |
| 655 | void SetAsDefaultBrowserUsingSystemSettings( |
| 656 | const base::Closure& on_finished_callback) { |
Francois Doray | 66bdfd8 | 2017-10-20 13:50:37 | [diff] [blame] | 657 | base::AssertBlockingAllowed(); |
pmonette | 9e4c1a8 | 2016-04-14 18:15:30 | [diff] [blame] | 658 | |
| 659 | base::FilePath chrome_exe; |
Avi Drissman | 9098f900 | 2018-05-04 00:11:52 | [diff] [blame] | 660 | if (!base::PathService::Get(base::FILE_EXE, &chrome_exe)) { |
pmonette | 9e4c1a8 | 2016-04-14 18:15:30 | [diff] [blame] | 661 | NOTREACHED() << "Error getting app exe path"; |
| 662 | on_finished_callback.Run(); |
| 663 | return; |
| 664 | } |
| 665 | |
grt | c291eea | 2016-05-26 15:38:48 | [diff] [blame] | 666 | // Create an action recorder that will open the settings app once it has |
| 667 | // initialized. |
| 668 | std::unique_ptr<DefaultBrowserActionRecorder> recorder( |
| 669 | new DefaultBrowserActionRecorder(base::Bind( |
| 670 | base::IgnoreResult(&ShellUtil::ShowMakeChromeDefaultSystemUI), |
| 671 | base::Unretained(BrowserDistribution::GetDistribution()), |
| 672 | chrome_exe))); |
pmonette | 9e4c1a8 | 2016-04-14 18:15:30 | [diff] [blame] | 673 | |
grt | c291eea | 2016-05-26 15:38:48 | [diff] [blame] | 674 | // The helper manages its own lifetime. Bind the action recorder |
| 675 | // into the finished callback to keep it alive throughout the |
| 676 | // interaction. |
| 677 | static const wchar_t* const kProtocols[] = {L"http", L"https", nullptr}; |
| 678 | OpenSystemSettingsHelper::Begin( |
| 679 | kProtocols, base::Bind(&OnSettingsAppFinished, base::Passed(&recorder), |
| 680 | on_finished_callback)); |
pmonette | 9e4c1a8 | 2016-04-14 18:15:30 | [diff] [blame] | 681 | } |
| 682 | |
| 683 | bool SetAsDefaultProtocolClientUsingIntentPicker(const std::string& protocol) { |
Francois Doray | 66bdfd8 | 2017-10-20 13:50:37 | [diff] [blame] | 684 | base::AssertBlockingAllowed(); |
pmonette | b18379f | 2017-06-01 01:18:44 | [diff] [blame] | 685 | |
pmonette | 9e4c1a8 | 2016-04-14 18:15:30 | [diff] [blame] | 686 | base::FilePath chrome_exe; |
Avi Drissman | 9098f900 | 2018-05-04 00:11:52 | [diff] [blame] | 687 | if (!base::PathService::Get(base::FILE_EXE, &chrome_exe)) { |
pmonette | 9e4c1a8 | 2016-04-14 18:15:30 | [diff] [blame] | 688 | NOTREACHED() << "Error getting app exe path"; |
| 689 | return false; |
| 690 | } |
| 691 | |
| 692 | BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 693 | base::string16 wprotocol(base::UTF8ToUTF16(protocol)); |
| 694 | if (!ShellUtil::ShowMakeChromeDefaultProtocolClientSystemUI(dist, chrome_exe, |
| 695 | wprotocol)) { |
| 696 | LOG(ERROR) << "Failed to launch the set-default-client Windows UI."; |
| 697 | return false; |
| 698 | } |
| 699 | |
| 700 | VLOG(1) << "Set-default-client Windows UI completed."; |
| 701 | return true; |
| 702 | } |
| 703 | |
pmonette | 0c40087a | 2016-04-21 00:05:16 | [diff] [blame] | 704 | void SetAsDefaultProtocolClientUsingSystemSettings( |
| 705 | const std::string& protocol, |
| 706 | const base::Closure& on_finished_callback) { |
Francois Doray | 66bdfd8 | 2017-10-20 13:50:37 | [diff] [blame] | 707 | base::AssertBlockingAllowed(); |
pmonette | 0c40087a | 2016-04-21 00:05:16 | [diff] [blame] | 708 | |
| 709 | base::FilePath chrome_exe; |
Avi Drissman | 9098f900 | 2018-05-04 00:11:52 | [diff] [blame] | 710 | if (!base::PathService::Get(base::FILE_EXE, &chrome_exe)) { |
pmonette | 0c40087a | 2016-04-21 00:05:16 | [diff] [blame] | 711 | NOTREACHED() << "Error getting app exe path"; |
| 712 | on_finished_callback.Run(); |
| 713 | return; |
| 714 | } |
| 715 | |
| 716 | // The helper manages its own lifetime. |
| 717 | base::string16 wprotocol(base::UTF8ToUTF16(protocol)); |
| 718 | const wchar_t* const kProtocols[] = {wprotocol.c_str(), nullptr}; |
| 719 | OpenSystemSettingsHelper::Begin(kProtocols, on_finished_callback); |
| 720 | |
| 721 | BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 722 | ShellUtil::ShowMakeChromeDefaultProtocolClientSystemUI(dist, chrome_exe, |
| 723 | wprotocol); |
| 724 | } |
| 725 | |
pmonette | 9fa59e88 | 2016-02-10 00:12:19 | [diff] [blame] | 726 | base::string16 GetAppModelIdForProfile(const base::string16& app_name, |
| 727 | const base::FilePath& profile_path) { |
[email protected] | d2065e06 | 2013-12-12 23:49:52 | [diff] [blame] | 728 | std::vector<base::string16> components; |
[email protected] | a044800 | 2012-06-19 04:32:10 | [diff] [blame] | 729 | components.push_back(app_name); |
[email protected] | 0085863a | 2013-12-06 21:19:03 | [diff] [blame] | 730 | const base::string16 profile_id(GetProfileIdFromPath(profile_path)); |
[email protected] | a044800 | 2012-06-19 04:32:10 | [diff] [blame] | 731 | if (!profile_id.empty()) |
| 732 | components.push_back(profile_id); |
| 733 | return ShellUtil::BuildAppModelId(components); |
[email protected] | 12f520c | 2010-01-06 18:11:15 | [diff] [blame] | 734 | } |
| 735 | |
pmonette | 9fa59e88 | 2016-02-10 00:12:19 | [diff] [blame] | 736 | base::string16 GetChromiumModelIdForProfile( |
[email protected] | 650b2d5 | 2013-02-10 03:41:45 | [diff] [blame] | 737 | const base::FilePath& profile_path) { |
[email protected] | a044800 | 2012-06-19 04:32:10 | [diff] [blame] | 738 | return GetAppModelIdForProfile( |
grt | c9880346 | 2017-03-08 10:05:08 | [diff] [blame] | 739 | ShellUtil::GetBrowserModelId(InstallUtil::IsPerUserInstall()), |
[email protected] | 78679969 | 2012-09-26 14:16:48 | [diff] [blame] | 740 | profile_path); |
[email protected] | 12f520c | 2010-01-06 18:11:15 | [diff] [blame] | 741 | } |
[email protected] | c9bb06f4 | 2010-01-13 23:53:48 | [diff] [blame] | 742 | |
pmonette | 9fa59e88 | 2016-02-10 00:12:19 | [diff] [blame] | 743 | void MigrateTaskbarPins() { |
pmonette | b18379f | 2017-06-01 01:18:44 | [diff] [blame] | 744 | // This needs to happen (e.g. so that the appid is fixed and the |
| 745 | // run-time Chrome icon is merged with the taskbar shortcut), but it is not an |
| 746 | // urgent task. |
Robert Liao | e9450f8c | 2017-06-15 17:23:57 | [diff] [blame] | 747 | base::CreateCOMSTATaskRunnerWithTraits( |
| 748 | {base::MayBlock(), base::TaskPriority::BACKGROUND}) |
| 749 | ->PostTask(FROM_HERE, base::Bind(&MigrateTaskbarPinsCallback)); |
[email protected] | c9bb06f4 | 2010-01-13 23:53:48 | [diff] [blame] | 750 | } |
[email protected] | 43903b8 | 2012-06-01 05:26:23 | [diff] [blame] | 751 | |
pmonette | a9831524 | 2016-11-23 21:39:18 | [diff] [blame] | 752 | void GetIsPinnedToTaskbarState( |
Jay Civelli | d4b8905 | 2017-10-31 17:48:25 | [diff] [blame] | 753 | std::unique_ptr<service_manager::Connector> connector, |
pmonette | a9831524 | 2016-11-23 21:39:18 | [diff] [blame] | 754 | const ConnectionErrorCallback& on_error_callback, |
| 755 | const IsPinnedToTaskbarCallback& result_callback) { |
Jay Civelli | d4b8905 | 2017-10-31 17:48:25 | [diff] [blame] | 756 | IsPinnedToTaskbarHelper::GetState(std::move(connector), on_error_callback, |
| 757 | result_callback); |
pmonette | 5057ca3b | 2016-07-04 16:48:40 | [diff] [blame] | 758 | } |
| 759 | |
pmonette | 9fa59e88 | 2016-02-10 00:12:19 | [diff] [blame] | 760 | int MigrateShortcutsInPathInternal(const base::FilePath& chrome_exe, |
| 761 | const base::FilePath& path) { |
[email protected] | 8ea8f1ef | 2013-01-06 18:39:03 | [diff] [blame] | 762 | // Enumerate all pinned shortcuts in the given path directly. |
[email protected] | 25a4c1c | 2013-06-08 04:53:36 | [diff] [blame] | 763 | base::FileEnumerator shortcuts_enum( |
[email protected] | 8ea8f1ef | 2013-01-06 18:39:03 | [diff] [blame] | 764 | path, false, // not recursive |
[email protected] | 25a4c1c | 2013-06-08 04:53:36 | [diff] [blame] | 765 | base::FileEnumerator::FILES, FILE_PATH_LITERAL("*.lnk")); |
[email protected] | 8ea8f1ef | 2013-01-06 18:39:03 | [diff] [blame] | 766 | |
grt | 973412f | 2017-02-25 08:04:21 | [diff] [blame] | 767 | bool is_per_user_install = InstallUtil::IsPerUserInstall(); |
[email protected] | 8ea8f1ef | 2013-01-06 18:39:03 | [diff] [blame] | 768 | |
| 769 | int shortcuts_migrated = 0; |
[email protected] | 650b2d5 | 2013-02-10 03:41:45 | [diff] [blame] | 770 | base::FilePath target_path; |
[email protected] | 0085863a | 2013-12-06 21:19:03 | [diff] [blame] | 771 | base::string16 arguments; |
[email protected] | 0798330 | 2013-01-21 19:41:44 | [diff] [blame] | 772 | base::win::ScopedPropVariant propvariant; |
[email protected] | 650b2d5 | 2013-02-10 03:41:45 | [diff] [blame] | 773 | for (base::FilePath shortcut = shortcuts_enum.Next(); !shortcut.empty(); |
[email protected] | 8ea8f1ef | 2013-01-06 18:39:03 | [diff] [blame] | 774 | shortcut = shortcuts_enum.Next()) { |
| 775 | // TODO(gab): Use ProgramCompare instead of comparing FilePaths below once |
| 776 | // it is fixed to work with FilePaths with spaces. |
| 777 | if (!base::win::ResolveShortcut(shortcut, &target_path, &arguments) || |
| 778 | chrome_exe != target_path) { |
| 779 | continue; |
| 780 | } |
avi | 556c0502 | 2014-12-22 23:31:43 | [diff] [blame] | 781 | base::CommandLine command_line( |
| 782 | base::CommandLine::FromString(base::StringPrintf( |
| 783 | L"\"%ls\" %ls", target_path.value().c_str(), arguments.c_str()))); |
[email protected] | 8ea8f1ef | 2013-01-06 18:39:03 | [diff] [blame] | 784 | |
| 785 | // Get the expected AppId for this Chrome shortcut. |
[email protected] | 0085863a | 2013-12-06 21:19:03 | [diff] [blame] | 786 | base::string16 expected_app_id( |
[email protected] | 8ea8f1ef | 2013-01-06 18:39:03 | [diff] [blame] | 787 | GetExpectedAppId(command_line, is_per_user_install)); |
| 788 | if (expected_app_id.empty()) |
| 789 | continue; |
| 790 | |
| 791 | // Load the shortcut. |
Robert Liao | b2bc703d | 2017-10-17 20:52:35 | [diff] [blame] | 792 | Microsoft::WRL::ComPtr<IShellLink> shell_link; |
| 793 | Microsoft::WRL::ComPtr<IPersistFile> persist_file; |
robliao | a872e99 | 2017-05-18 06:36:19 | [diff] [blame] | 794 | if (FAILED(::CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, |
| 795 | IID_PPV_ARGS(&shell_link))) || |
robliao | a7956aa | 2017-05-17 19:10:54 | [diff] [blame] | 796 | FAILED(shell_link.CopyTo(persist_file.GetAddressOf())) || |
[email protected] | 8ea8f1ef | 2013-01-06 18:39:03 | [diff] [blame] | 797 | FAILED(persist_file->Load(shortcut.value().c_str(), STGM_READ))) { |
| 798 | DLOG(WARNING) << "Failed loading shortcut at " << shortcut.value(); |
| 799 | continue; |
| 800 | } |
| 801 | |
| 802 | // Any properties that need to be updated on the shortcut will be stored in |
| 803 | // |updated_properties|. |
| 804 | base::win::ShortcutProperties updated_properties; |
| 805 | |
| 806 | // Validate the existing app id for the shortcut. |
Robert Liao | b2bc703d | 2017-10-17 20:52:35 | [diff] [blame] | 807 | Microsoft::WRL::ComPtr<IPropertyStore> property_store; |
[email protected] | 0798330 | 2013-01-21 19:41:44 | [diff] [blame] | 808 | propvariant.Reset(); |
robliao | a7956aa | 2017-05-17 19:10:54 | [diff] [blame] | 809 | if (FAILED(shell_link.CopyTo(property_store.GetAddressOf())) || |
dcheng | 81762e0 | 2014-11-21 21:22:28 | [diff] [blame] | 810 | property_store->GetValue(PKEY_AppUserModel_ID, propvariant.Receive()) != |
| 811 | S_OK) { |
[email protected] | 8ea8f1ef | 2013-01-06 18:39:03 | [diff] [blame] | 812 | // When in doubt, prefer not updating the shortcut. |
| 813 | NOTREACHED(); |
| 814 | continue; |
[email protected] | 8ea8f1ef | 2013-01-06 18:39:03 | [diff] [blame] | 815 | } else { |
[email protected] | 0798330 | 2013-01-21 19:41:44 | [diff] [blame] | 816 | switch (propvariant.get().vt) { |
| 817 | case VT_EMPTY: |
| 818 | // If there is no app_id set, set our app_id if one is expected. |
| 819 | if (!expected_app_id.empty()) |
| 820 | updated_properties.set_app_id(expected_app_id); |
| 821 | break; |
| 822 | case VT_LPWSTR: |
[email protected] | 0085863a | 2013-12-06 21:19:03 | [diff] [blame] | 823 | if (expected_app_id != base::string16(propvariant.get().pwszVal)) |
[email protected] | 0798330 | 2013-01-21 19:41:44 | [diff] [blame] | 824 | updated_properties.set_app_id(expected_app_id); |
| 825 | break; |
| 826 | default: |
| 827 | NOTREACHED(); |
| 828 | continue; |
[email protected] | 8ea8f1ef | 2013-01-06 18:39:03 | [diff] [blame] | 829 | } |
| 830 | } |
| 831 | |
gab | 88257b6 | 2016-01-15 03:19:19 | [diff] [blame] | 832 | // Clear dual_mode property from any shortcuts that previously had it (it |
| 833 | // was only ever installed on shortcuts with the |
| 834 | // |default_chromium_model_id|). |
[email protected] | 0085863a | 2013-12-06 21:19:03 | [diff] [blame] | 835 | base::string16 default_chromium_model_id( |
grt | c9880346 | 2017-03-08 10:05:08 | [diff] [blame] | 836 | ShellUtil::GetBrowserModelId(is_per_user_install)); |
gab | 88257b6 | 2016-01-15 03:19:19 | [diff] [blame] | 837 | if (expected_app_id == default_chromium_model_id) { |
[email protected] | 0798330 | 2013-01-21 19:41:44 | [diff] [blame] | 838 | propvariant.Reset(); |
[email protected] | 8ea8f1ef | 2013-01-06 18:39:03 | [diff] [blame] | 839 | if (property_store->GetValue(PKEY_AppUserModel_IsDualMode, |
[email protected] | 0798330 | 2013-01-21 19:41:44 | [diff] [blame] | 840 | propvariant.Receive()) != S_OK) { |
[email protected] | 8ea8f1ef | 2013-01-06 18:39:03 | [diff] [blame] | 841 | // When in doubt, prefer to not update the shortcut. |
| 842 | NOTREACHED(); |
| 843 | continue; |
gab | 38d242d4d | 2016-01-14 20:38:12 | [diff] [blame] | 844 | } |
| 845 | if (propvariant.get().vt == VT_BOOL && |
| 846 | !!propvariant.get().boolVal) { |
| 847 | updated_properties.set_dual_mode(false); |
[email protected] | 8ea8f1ef | 2013-01-06 18:39:03 | [diff] [blame] | 848 | } |
| 849 | } |
| 850 | |
robliao | 9212cb4 | 2017-04-06 17:43:39 | [diff] [blame] | 851 | persist_file.Reset(); |
| 852 | shell_link.Reset(); |
[email protected] | 8ea8f1ef | 2013-01-06 18:39:03 | [diff] [blame] | 853 | |
| 854 | // Update the shortcut if some of its properties need to be updated. |
| 855 | if (updated_properties.options && |
| 856 | base::win::CreateOrUpdateShortcutLink( |
| 857 | shortcut, updated_properties, |
| 858 | base::win::SHORTCUT_UPDATE_EXISTING)) { |
| 859 | ++shortcuts_migrated; |
| 860 | } |
| 861 | } |
| 862 | return shortcuts_migrated; |
| 863 | } |
| 864 | |
pmonette | 32a5cfb4 | 2016-04-11 22:04:44 | [diff] [blame] | 865 | } // namespace win |
| 866 | |
pmonette | 9fa59e88 | 2016-02-10 00:12:19 | [diff] [blame] | 867 | } // namespace shell_integration |