blob: 4e49b1cfd3df1a772bf557918a075f81be80a56b [file] [log] [blame]
[email protected]5a20b192012-03-01 06:01:571// Copyright (c) 2012 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commit09911bf2008-07-26 23:55:294
[email protected]4a0765a2009-05-08 23:12:255#include "chrome/browser/shell_integration.h"
6
[email protected]c5efb952011-11-01 01:28:367#include "base/bind.h"
[email protected]28375ae2010-02-05 04:45:508#include "base/command_line.h"
thestig18dfb7a52014-08-26 10:44:049#include "base/files/file_util.h"
pmonettef89ac7c72015-10-06 03:22:0110#include "base/metrics/histogram_macros.h"
[email protected]24a555b62013-06-10 22:01:1711#include "base/strings/string_util.h"
pmonette9c1457f2015-11-19 20:29:3112#include "base/strings/stringprintf.h"
[email protected]e309f312013-06-07 21:50:0813#include "base/strings/utf_string_conversions.h"
[email protected]124901f52013-03-27 14:42:1014#include "base/threading/thread_restrictions.h"
pmonettef89ac7c72015-10-06 03:22:0115#include "base/timer/timer.h"
avi664c07b2015-12-26 02:18:3116#include "build/build_config.h"
[email protected]ba26a442013-02-20 15:32:5517#include "chrome/browser/policy/policy_path_parser.h"
[email protected]b96aa932009-08-12 21:34:4918#include "chrome/common/chrome_paths.h"
[email protected]28375ae2010-02-05 04:45:5019#include "chrome/common/chrome_switches.h"
brettwb1fc1b82016-02-02 00:19:0820#include "components/prefs/pref_service.h"
sdefresne9fb67692015-08-03 18:48:2221#include "components/version_info/version_info.h"
[email protected]c38831a12011-10-28 12:44:4922#include "content/public/browser/browser_thread.h"
initial.commit09911bf2008-07-26 23:55:2923
[email protected]931d1042013-04-05 17:50:4424#if defined(OS_CHROMEOS)
25#include "chromeos/chromeos_switches.h"
26#endif
27
[email protected]2f5bc322013-12-04 08:58:1528#if !defined(OS_WIN)
sdefresne9fb67692015-08-03 18:48:2229#include "chrome/common/channel_info.h"
[email protected]af39f002014-08-22 10:18:1830#include "chrome/grit/chromium_strings.h"
[email protected]2f5bc322013-12-04 08:58:1531#include "ui/base/l10n/l10n_util.h"
32#endif
33
[email protected]631bb742011-11-02 11:29:3934using content::BrowserThread;
35
pmonette9fa59e882016-02-10 00:12:1936namespace shell_integration {
37
pmonette034a03d92015-10-02 21:04:2738namespace {
39
pmonette9fa59e882016-02-10 00:12:1940const struct AppModeInfo* gAppModeInfo = nullptr;
pmonette034a03d92015-10-02 21:04:2741
42} // namespace
43
44#if !defined(OS_WIN)
pmonette9fa59e882016-02-10 00:12:1945bool SetAsDefaultBrowserInteractive() {
pmonette034a03d92015-10-02 21:04:2746 return false;
47}
48
pmonette9fa59e882016-02-10 00:12:1949bool IsSetAsDefaultAsynchronous() {
pmonettef89ac7c72015-10-06 03:22:0150 return false;
51}
52
pmonette9fa59e882016-02-10 00:12:1953bool SetAsDefaultProtocolClientInteractive(const std::string& protocol) {
pmonette034a03d92015-10-02 21:04:2754 return false;
55}
56#endif // !defined(OS_WIN)
57
pmonette9fa59e882016-02-10 00:12:1958DefaultWebClientSetPermission CanSetAsDefaultProtocolClient() {
[email protected]a01481b2011-07-15 04:30:0259 // Allowed as long as the browser can become the operating system default
60 // browser.
pmonettef89ac7c72015-10-06 03:22:0161 DefaultWebClientSetPermission permission = CanSetAsDefaultBrowser();
62
63 // Set as default asynchronous is only supported for default web browser.
64 return (permission == SET_DEFAULT_ASYNCHRONOUS) ? SET_DEFAULT_INTERACTIVE
65 : permission;
[email protected]a01481b2011-07-15 04:30:0266}
67
pmonette034a03d92015-10-02 21:04:2768#if !defined(OS_WIN)
pmonette9fa59e882016-02-10 00:12:1969bool IsElevationNeededForSettingDefaultProtocolClient() {
pmonette034a03d92015-10-02 21:04:2770 return false;
71}
72#endif // !defined(OS_WIN)
[email protected]9561bc912012-03-07 02:41:1673
pmonette9fa59e882016-02-10 00:12:1974void SetAppModeInfo(const struct AppModeInfo* info) {
[email protected]9561bc912012-03-07 02:41:1675 gAppModeInfo = info;
76}
77
pmonette9fa59e882016-02-10 00:12:1978const struct AppModeInfo* AppModeInfo() {
[email protected]9561bc912012-03-07 02:41:1679 return gAppModeInfo;
80}
81
pmonette9fa59e882016-02-10 00:12:1982bool IsRunningInAppMode() {
[email protected]9561bc912012-03-07 02:41:1683 return gAppModeInfo != NULL;
84}
85
pmonette9fa59e882016-02-10 00:12:1986base::CommandLine CommandLineArgsForLauncher(
[email protected]2f1c09d2011-01-14 14:58:1487 const GURL& url,
[email protected]5c93a0c12012-05-02 19:45:2488 const std::string& extension_app_id,
[email protected]650b2d52013-02-10 03:41:4589 const base::FilePath& profile_path) {
[email protected]124901f52013-03-27 14:42:1090 base::ThreadRestrictions::AssertIOAllowed();
avi556c05022014-12-22 23:31:4391 base::CommandLine new_cmd_line(base::CommandLine::NO_PROGRAM);
[email protected]28375ae2010-02-05 04:45:5092
[email protected]fb06aea82014-02-26 15:48:4793 AppendProfileArgs(
94 extension_app_id.empty() ? base::FilePath() : profile_path,
95 &new_cmd_line);
[email protected]28375ae2010-02-05 04:45:5096
97 // If |extension_app_id| is present, we use the kAppId switch rather than
98 // the kApp switch (the launch url will be read from the extension app
99 // during launch.
[email protected]ec5b50d2010-10-09 16:35:18100 if (!extension_app_id.empty()) {
[email protected]b10392932011-03-08 21:28:14101 new_cmd_line.AppendSwitchASCII(switches::kAppId, extension_app_id);
[email protected]64048bd2010-03-08 23:28:58102 } else {
[email protected]28375ae2010-02-05 04:45:50103 // Use '--app=url' instead of just 'url' to launch the browser with minimal
104 // chrome.
105 // Note: Do not change this flag! Old Gears shortcuts will break if you do!
[email protected]b10392932011-03-08 21:28:14106 new_cmd_line.AppendSwitchASCII(switches::kApp, url.spec());
[email protected]28375ae2010-02-05 04:45:50107 }
[email protected]b10392932011-03-08 21:28:14108 return new_cmd_line;
[email protected]28375ae2010-02-05 04:45:50109}
110
pmonette9fa59e882016-02-10 00:12:19111void AppendProfileArgs(const base::FilePath& profile_path,
112 base::CommandLine* command_line) {
[email protected]fb06aea82014-02-26 15:48:47113 DCHECK(command_line);
avi556c05022014-12-22 23:31:43114 const base::CommandLine& cmd_line = *base::CommandLine::ForCurrentProcess();
[email protected]fb06aea82014-02-26 15:48:47115
116 // Use the same UserDataDir for new launches that we currently have set.
117 base::FilePath user_data_dir =
118 cmd_line.GetSwitchValuePath(switches::kUserDataDir);
119#if defined(OS_MACOSX) || defined(OS_WIN)
120 policy::path_parser::CheckUserDataDirPolicy(&user_data_dir);
121#endif
122 if (!user_data_dir.empty()) {
123 // Make sure user_data_dir is an absolute path.
124 user_data_dir = base::MakeAbsoluteFilePath(user_data_dir);
125 if (!user_data_dir.empty() && base::PathExists(user_data_dir))
126 command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir);
127 }
128
129#if defined(OS_CHROMEOS)
130 base::FilePath profile = cmd_line.GetSwitchValuePath(
131 chromeos::switches::kLoginProfile);
132 if (!profile.empty())
133 command_line->AppendSwitchPath(chromeos::switches::kLoginProfile, profile);
134#else
135 if (!profile_path.empty())
136 command_line->AppendSwitchPath(switches::kProfileDirectory,
137 profile_path.BaseName());
138#endif
139}
140
[email protected]bd046bd42012-06-08 05:07:32141#if !defined(OS_WIN)
pmonette9fa59e882016-02-10 00:12:19142base::string16 GetAppShortcutsSubdirName() {
sdefresne9fb67692015-08-03 18:48:22143 if (chrome::GetChannel() == version_info::Channel::CANARY)
[email protected]2f5bc322013-12-04 08:58:15144 return l10n_util::GetStringUTF16(IDS_APP_SHORTCUTS_SUBDIR_NAME_CANARY);
145 return l10n_util::GetStringUTF16(IDS_APP_SHORTCUTS_SUBDIR_NAME);
146}
pmonette868ca642015-09-02 14:34:02147#endif // !defined(OS_WIN)
[email protected]bd046bd42012-06-08 05:07:32148
pmonette034a03d92015-10-02 21:04:27149///////////////////////////////////////////////////////////////////////////////
pmonette9fa59e882016-02-10 00:12:19150// DefaultWebClientWorker
[email protected]d24c4012009-07-28 01:57:31151//
initial.commit09911bf2008-07-26 23:55:29152
pmonette9fa59e882016-02-10 00:12:19153DefaultWebClientWorker::DefaultWebClientWorker(
pmonette586ab5b32016-03-07 19:50:37154 const DefaultWebClientWorkerCallback& callback)
155 : callback_(callback) {}
initial.commit09911bf2008-07-26 23:55:29156
pmonette9fa59e882016-02-10 00:12:19157void DefaultWebClientWorker::StartCheckIsDefault() {
pmonette586ab5b32016-03-07 19:50:37158 RunCallback(STATE_PROCESSING);
pmonette9c1457f2015-11-19 20:29:31159
160 BrowserThread::PostTask(
161 BrowserThread::FILE, FROM_HERE,
162 base::Bind(&DefaultWebClientWorker::CheckIsDefault, this));
[email protected]4468a5b2011-05-26 07:48:02163}
164
pmonette9fa59e882016-02-10 00:12:19165void DefaultWebClientWorker::StartSetAsDefault() {
pmonettef89ac7c72015-10-06 03:22:01166 // Cancel the already running process if another start is requested.
167 if (set_as_default_in_progress_) {
168 if (set_as_default_initialized_) {
169 FinalizeSetAsDefault();
170 set_as_default_initialized_ = false;
171 }
172
173 ReportAttemptResult(AttemptResult::RETRY);
174 }
175
176 set_as_default_in_progress_ = true;
pmonette586ab5b32016-03-07 19:50:37177 RunCallback(STATE_PROCESSING);
pmonettef89ac7c72015-10-06 03:22:01178
pmonette9c1457f2015-11-19 20:29:31179 set_as_default_initialized_ = InitializeSetAsDefault();
180
pmonettef89ac7c72015-10-06 03:22:01181 // Remember the start time.
182 start_time_ = base::TimeTicks::Now();
183
pmonette8db6a8be2016-02-11 01:50:31184 BrowserThread::PostTask(
185 BrowserThread::FILE, FROM_HERE,
186 base::Bind(&DefaultWebClientWorker::SetAsDefault, this));
initial.commit09911bf2008-07-26 23:55:29187}
188
[email protected]d24c4012009-07-28 01:57:31189///////////////////////////////////////////////////////////////////////////////
[email protected]4468a5b2011-05-26 07:48:02190// DefaultWebClientWorker, private:
[email protected]d24c4012009-07-28 01:57:31191
pmonette9fa59e882016-02-10 00:12:19192DefaultWebClientWorker::~DefaultWebClientWorker() {}
[email protected]d24c4012009-07-28 01:57:31193
pmonette9fa59e882016-02-10 00:12:19194void DefaultWebClientWorker::OnCheckIsDefaultComplete(
[email protected]4468a5b2011-05-26 07:48:02195 DefaultWebClientState state) {
thestig00844cea2015-09-08 21:44:52196 DCHECK_CURRENTLY_ON(BrowserThread::UI);
[email protected]264f74d12009-09-04 23:39:58197 UpdateUI(state);
pmonette9c1457f2015-11-19 20:29:31198
199 if (check_default_should_report_success_) {
200 check_default_should_report_success_ = false;
201
202 ReportAttemptResult(state == DefaultWebClientState::IS_DEFAULT
203 ? AttemptResult::SUCCESS
204 : AttemptResult::NO_ERRORS_NOT_DEFAULT);
205 }
[email protected]d24c4012009-07-28 01:57:31206}
207
pmonette9fa59e882016-02-10 00:12:19208void DefaultWebClientWorker::OnSetAsDefaultAttemptComplete(
pmonettef89ac7c72015-10-06 03:22:01209 AttemptResult result) {
thestig00844cea2015-09-08 21:44:52210 DCHECK_CURRENTLY_ON(BrowserThread::UI);
pmonettef89ac7c72015-10-06 03:22:01211 // Hold on to a reference because if this was called via the default browser
212 // callback in StartupBrowserCreator, clearing the callback in
pmonette9c1457f2015-11-19 20:29:31213 // FinalizeSetAsDefault() would otherwise remove the last reference and delete
pmonettef89ac7c72015-10-06 03:22:01214 // us in the middle of this function.
215 scoped_refptr<DefaultWebClientWorker> scoped_ref(this);
216
217 if (set_as_default_in_progress_) {
218 set_as_default_in_progress_ = false;
219
220 if (set_as_default_initialized_) {
221 FinalizeSetAsDefault();
222 set_as_default_initialized_ = false;
223 }
pmonettef89ac7c72015-10-06 03:22:01224
pmonette9c1457f2015-11-19 20:29:31225 // Report failures here. Successes are reported in
226 // OnCheckIsDefaultComplete() after checking that the change is verified.
227 check_default_should_report_success_ = result == AttemptResult::SUCCESS;
228 if (!check_default_should_report_success_)
229 ReportAttemptResult(result);
pmonettef89ac7c72015-10-06 03:22:01230
pmonette586ab5b32016-03-07 19:50:37231 // Start the default browser check. The default state will be reported to
232 // the caller via the |callback_|.
pmonettef89ac7c72015-10-06 03:22:01233 StartCheckIsDefault();
234 }
[email protected]d24c4012009-07-28 01:57:31235}
236
pmonette586ab5b32016-03-07 19:50:37237void DefaultWebClientWorker::RunCallback(DefaultWebClientUIState state) {
238 if (!callback_.is_null())
239 callback_.Run(state);
240}
241
pmonette9fa59e882016-02-10 00:12:19242void DefaultWebClientWorker::ReportAttemptResult(AttemptResult result) {
pmonette9c1457f2015-11-19 20:29:31243 const char* histogram_prefix = GetHistogramPrefix();
pmonettef89ac7c72015-10-06 03:22:01244
pmonette9c1457f2015-11-19 20:29:31245 // Report result.
246 base::LinearHistogram::FactoryGet(
247 base::StringPrintf("%s.SetDefaultResult", histogram_prefix), 1,
248 AttemptResult::NUM_ATTEMPT_RESULT_TYPES,
249 AttemptResult::NUM_ATTEMPT_RESULT_TYPES + 1,
250 base::HistogramBase::kUmaTargetedHistogramFlag)
251 ->Add(result);
pmonettef89ac7c72015-10-06 03:22:01252
pmonette9c1457f2015-11-19 20:29:31253 // Report asynchronous duration.
254 if (IsSetAsDefaultAsynchronous() && ShouldReportDurationForResult(result)) {
255 base::Histogram::FactoryTimeGet(
256 base::StringPrintf("%s.SetDefaultAsyncDuration_%s", histogram_prefix,
257 AttemptResultToString(result)),
258 base::TimeDelta::FromMilliseconds(10), base::TimeDelta::FromMinutes(3),
259 50, base::HistogramBase::kUmaTargetedHistogramFlag)
260 ->AddTime(base::TimeTicks::Now() - start_time_);
pmonettef89ac7c72015-10-06 03:22:01261 }
262}
263
pmonette9fa59e882016-02-10 00:12:19264bool DefaultWebClientWorker::InitializeSetAsDefault() {
pmonettef89ac7c72015-10-06 03:22:01265 return true;
266}
267
pmonette9fa59e882016-02-10 00:12:19268void DefaultWebClientWorker::FinalizeSetAsDefault() {}
pmonettef89ac7c72015-10-06 03:22:01269
pmonette9fa59e882016-02-10 00:12:19270void DefaultWebClientWorker::UpdateUI(DefaultWebClientState state) {
pmonette586ab5b32016-03-07 19:50:37271 switch (state) {
272 case NOT_DEFAULT:
273 RunCallback(STATE_NOT_DEFAULT);
274 break;
275 case IS_DEFAULT:
276 RunCallback(STATE_IS_DEFAULT);
277 break;
278 case UNKNOWN_DEFAULT:
279 RunCallback(STATE_UNKNOWN);
280 break;
281 case NUM_DEFAULT_STATES:
282 break;
[email protected]d24c4012009-07-28 01:57:31283 }
initial.commit09911bf2008-07-26 23:55:29284}
[email protected]4468a5b2011-05-26 07:48:02285
pmonette9fa59e882016-02-10 00:12:19286bool DefaultWebClientWorker::ShouldReportDurationForResult(
pmonette9c1457f2015-11-19 20:29:31287 AttemptResult result) {
pmonette586ab5b32016-03-07 19:50:37288 return result == SUCCESS || result == FAILURE || result == RETRY;
pmonette9c1457f2015-11-19 20:29:31289}
290
pmonette9fa59e882016-02-10 00:12:19291const char* DefaultWebClientWorker::AttemptResultToString(
pmonette9c1457f2015-11-19 20:29:31292 AttemptResult result) {
293 switch (result) {
294 case SUCCESS:
295 return "Success";
296 case ALREADY_DEFAULT:
297 return "AlreadyDefault";
298 case FAILURE:
299 return "Failure";
pmonette9c1457f2015-11-19 20:29:31300 case LAUNCH_FAILURE:
301 return "LaunchFailure";
302 case OTHER_WORKER:
303 return "OtherWorker";
304 case RETRY:
305 return "Retry";
306 case NO_ERRORS_NOT_DEFAULT:
307 return "NoErrorsNotDefault";
308 case NUM_ATTEMPT_RESULT_TYPES:
309 break;
310 }
311 NOTREACHED();
312 return "";
313}
314
[email protected]4468a5b2011-05-26 07:48:02315///////////////////////////////////////////////////////////////////////////////
pmonette9fa59e882016-02-10 00:12:19316// DefaultBrowserWorker
[email protected]4468a5b2011-05-26 07:48:02317//
318
pmonette586ab5b32016-03-07 19:50:37319DefaultBrowserWorker::DefaultBrowserWorker(
320 const DefaultWebClientWorkerCallback& callback)
321 : DefaultWebClientWorker(callback) {}
[email protected]4468a5b2011-05-26 07:48:02322
pmonette9fa59e882016-02-10 00:12:19323DefaultBrowserWorker::~DefaultBrowserWorker() {}
pmonettef89ac7c72015-10-06 03:22:01324
[email protected]4468a5b2011-05-26 07:48:02325///////////////////////////////////////////////////////////////////////////////
326// DefaultBrowserWorker, private:
327
pmonette9fa59e882016-02-10 00:12:19328void DefaultBrowserWorker::CheckIsDefault() {
pmonettef89ac7c72015-10-06 03:22:01329 DefaultWebClientState state = GetDefaultBrowser();
330 BrowserThread::PostTask(
331 BrowserThread::UI, FROM_HERE,
332 base::Bind(&DefaultBrowserWorker::OnCheckIsDefaultComplete, this, state));
[email protected]4468a5b2011-05-26 07:48:02333}
334
pmonette8db6a8be2016-02-11 01:50:31335void DefaultBrowserWorker::SetAsDefault() {
pmonettef89ac7c72015-10-06 03:22:01336 AttemptResult result = AttemptResult::FAILURE;
337 switch (CanSetAsDefaultBrowser()) {
338 case SET_DEFAULT_NOT_ALLOWED:
[email protected]bd046bd42012-06-08 05:07:32339 NOTREACHED();
pmonettef89ac7c72015-10-06 03:22:01340 break;
341 case SET_DEFAULT_UNATTENDED:
342 if (SetAsDefaultBrowser())
343 result = AttemptResult::SUCCESS;
344 break;
345 case SET_DEFAULT_INTERACTIVE:
pmonette8db6a8be2016-02-11 01:50:31346 if (interactive_permitted_ && SetAsDefaultBrowserInteractive())
pmonettef89ac7c72015-10-06 03:22:01347 result = AttemptResult::SUCCESS;
348 break;
349 case SET_DEFAULT_ASYNCHRONOUS:
350#if defined(OS_WIN)
pmonette8db6a8be2016-02-11 01:50:31351 if (!interactive_permitted_)
pmonettef89ac7c72015-10-06 03:22:01352 break;
353 if (GetDefaultBrowser() == IS_DEFAULT) {
354 // Don't start the asynchronous operation since it could result in
355 // losing the default browser status.
356 result = AttemptResult::ALREADY_DEFAULT;
357 break;
358 }
359 // This function will cause OnSetAsDefaultAttemptComplete() to be called
360 // asynchronously via a filter established in InitializeSetAsDefault().
361 if (!SetAsDefaultBrowserAsynchronous()) {
362 result = AttemptResult::LAUNCH_FAILURE;
363 break;
364 }
365 return;
366#else
367 NOTREACHED();
368 break;
369#endif
[email protected]bd046bd42012-06-08 05:07:32370 }
pmonettef89ac7c72015-10-06 03:22:01371 BrowserThread::PostTask(
372 BrowserThread::UI, FROM_HERE,
373 base::Bind(&DefaultBrowserWorker::OnSetAsDefaultAttemptComplete, this,
374 result));
[email protected]4468a5b2011-05-26 07:48:02375}
376
pmonette9fa59e882016-02-10 00:12:19377const char* DefaultBrowserWorker::GetHistogramPrefix() {
pmonette9c1457f2015-11-19 20:29:31378 return "DefaultBrowser";
379}
380
[email protected]4468a5b2011-05-26 07:48:02381///////////////////////////////////////////////////////////////////////////////
pmonette9fa59e882016-02-10 00:12:19382// DefaultProtocolClientWorker
[email protected]4468a5b2011-05-26 07:48:02383//
384
pmonette9fa59e882016-02-10 00:12:19385DefaultProtocolClientWorker::DefaultProtocolClientWorker(
pmonette586ab5b32016-03-07 19:50:37386 const DefaultWebClientWorkerCallback& callback,
387 const std::string& protocol)
388 : DefaultWebClientWorker(callback), protocol_(protocol) {}
[email protected]4468a5b2011-05-26 07:48:02389
390///////////////////////////////////////////////////////////////////////////////
391// DefaultProtocolClientWorker, private:
392
pmonette9fa59e882016-02-10 00:12:19393DefaultProtocolClientWorker::~DefaultProtocolClientWorker() {}
pmonettef89ac7c72015-10-06 03:22:01394
pmonette9fa59e882016-02-10 00:12:19395void DefaultProtocolClientWorker::CheckIsDefault() {
pmonettef89ac7c72015-10-06 03:22:01396 DefaultWebClientState state = IsDefaultProtocolClient(protocol_);
397 BrowserThread::PostTask(
398 BrowserThread::UI, FROM_HERE,
399 base::Bind(&DefaultProtocolClientWorker::OnCheckIsDefaultComplete, this,
400 state));
[email protected]4468a5b2011-05-26 07:48:02401}
402
pmonette8db6a8be2016-02-11 01:50:31403void DefaultProtocolClientWorker::SetAsDefault() {
pmonettef89ac7c72015-10-06 03:22:01404 AttemptResult result = AttemptResult::FAILURE;
405 switch (CanSetAsDefaultProtocolClient()) {
406 case SET_DEFAULT_NOT_ALLOWED:
407 // Not allowed, do nothing.
[email protected]e7f79872013-09-13 01:39:31408 break;
pmonettef89ac7c72015-10-06 03:22:01409 case SET_DEFAULT_UNATTENDED:
410 if (SetAsDefaultProtocolClient(protocol_))
411 result = AttemptResult::SUCCESS;
[email protected]ee9d89d2012-09-25 18:21:03412 break;
pmonettef89ac7c72015-10-06 03:22:01413 case SET_DEFAULT_INTERACTIVE:
pmonette8db6a8be2016-02-11 01:50:31414 if (interactive_permitted_ &&
pmonettef89ac7c72015-10-06 03:22:01415 SetAsDefaultProtocolClientInteractive(protocol_)) {
416 result = AttemptResult::SUCCESS;
[email protected]ee9d89d2012-09-25 18:21:03417 }
418 break;
pmonettef89ac7c72015-10-06 03:22:01419 case SET_DEFAULT_ASYNCHRONOUS:
420 NOTREACHED();
421 break;
[email protected]ee9d89d2012-09-25 18:21:03422 }
pmonettef89ac7c72015-10-06 03:22:01423 BrowserThread::PostTask(
424 BrowserThread::UI, FROM_HERE,
425 base::Bind(&DefaultProtocolClientWorker::OnSetAsDefaultAttemptComplete,
426 this, result));
[email protected]4468a5b2011-05-26 07:48:02427}
pmonette9c1457f2015-11-19 20:29:31428
pmonette9fa59e882016-02-10 00:12:19429const char* DefaultProtocolClientWorker::GetHistogramPrefix() {
pmonette9c1457f2015-11-19 20:29:31430 return "DefaultProtocolClient";
431}
pmonette9fa59e882016-02-10 00:12:19432
433} // namespace shell_integration