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

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

Issue 1426663005: Make the histograms for setting the default browser consistent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
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 <shlwapi.h> 8 #include <shlwapi.h>
9 #include <shobjidl.h> 9 #include <shobjidl.h>
10 #include <propkey.h> // Needs to come after shobjidl.h. 10 #include <propkey.h> // Needs to come after shobjidl.h.
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 632
633 shortcut = shortcut.Append(shortcut_name).Append(shortcut_name + 633 shortcut = shortcut.Append(shortcut_name).Append(shortcut_name +
634 installer::kLnkExt); 634 installer::kLnkExt);
635 if (base::PathExists(shortcut)) 635 if (base::PathExists(shortcut))
636 return shortcut; 636 return shortcut;
637 } 637 }
638 638
639 return base::FilePath(); 639 return base::FilePath();
640 } 640 }
641 641
642 // static
643 bool ShellIntegration::DefaultWebClientWorker::ShouldReportAttemptResults() {
644 return base::win::GetVersion() >= base::win::VERSION_WIN10 &&
645 IsSetAsDefaultAsynchronous();
646 }
647
648 bool ShellIntegration::DefaultBrowserWorker::InitializeSetAsDefault() { 642 bool ShellIntegration::DefaultBrowserWorker::InitializeSetAsDefault() {
649 DCHECK_CURRENTLY_ON(BrowserThread::UI); 643 DCHECK_CURRENTLY_ON(BrowserThread::UI);
650 644
651 if (!IsSetAsDefaultAsynchronous()) 645 if (!IsSetAsDefaultAsynchronous())
652 return false; 646 return false;
653 647
654 // On Windows 10+, there is no official way to prompt the user to set a 648 // On Windows 10+, there is no official way to prompt the user to set a
655 // default browser. This is the workaround: 649 // default browser. This is the workaround:
656 // 1. Unregister the default browser. 650 // 1. Unregister the default browser.
657 // 2. Open "How to make Chrome my default browser" link with openwith.exe. 651 // 2. Open "How to make Chrome my default browser" link with openwith.exe.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 // static 698 // static
705 bool ShellIntegration::DefaultBrowserWorker::SetAsDefaultBrowserAsynchronous() { 699 bool ShellIntegration::DefaultBrowserWorker::SetAsDefaultBrowserAsynchronous() {
706 DCHECK(IsSetAsDefaultAsynchronous()); 700 DCHECK(IsSetAsDefaultAsynchronous());
707 701
708 ResetDefaultBrowser(); 702 ResetDefaultBrowser();
709 703
710 base::CommandLine cmdline(base::FilePath(L"openwith.exe")); 704 base::CommandLine cmdline(base::FilePath(L"openwith.exe"));
711 cmdline.AppendArgNative(StartupBrowserCreator::GetDefaultBrowserUrl()); 705 cmdline.AppendArgNative(StartupBrowserCreator::GetDefaultBrowserUrl());
712 return base::LaunchProcess(cmdline, base::LaunchOptions()).IsValid(); 706 return base::LaunchProcess(cmdline, base::LaunchOptions()).IsValid();
713 } 707 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698