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

Unified Diff: chrome/browser/shell_integration.cc

Issue 10453041: Support for interactive set-chrome-as-default in Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed for unittests + a typo or two. Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/shell_integration.cc
diff --git a/chrome/browser/shell_integration.cc b/chrome/browser/shell_integration.cc
index 6748679997286e38e9a46d279f187064e9dd7062..8aa268f8536cddd262c56f29e401ea7d38ace5cd 100644
--- a/chrome/browser/shell_integration.cc
+++ b/chrome/browser/shell_integration.cc
@@ -18,7 +18,8 @@
using content::BrowserThread;
-bool ShellIntegration::CanSetAsDefaultProtocolClient() {
+ShellIntegration::DefaultSettingsChangePermission
+ ShellIntegration::CanSetAsDefaultProtocolClient() {
// Allowed as long as the browser can become the operating system default
// browser.
return CanSetAsDefaultBrowser();
@@ -92,6 +93,13 @@ CommandLine ShellIntegration::CommandLineArgsForLauncher(
return new_cmd_line;
}
+#if !defined(OS_WIN)
+// static
+bool ShellIntegration::SetAsDefaultBrowserInteractive() {
+ return false;
+}
+#endif
+
///////////////////////////////////////////////////////////////////////////////
// ShellIntegration::DefaultWebClientWorker
//
@@ -154,7 +162,7 @@ void ShellIntegration::DefaultWebClientWorker::CompleteCheckIsDefault(
void ShellIntegration::DefaultWebClientWorker::ExecuteSetAsDefault() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- SetAsDefault();
+ SetAsDefault(observer_ && observer_->IsInteractiveSetDefaultPermitted());
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(
@@ -203,8 +211,22 @@ ShellIntegration::DefaultBrowserWorker::CheckIsDefault() {
return ShellIntegration::IsDefaultBrowser();
}
-void ShellIntegration::DefaultBrowserWorker::SetAsDefault() {
- ShellIntegration::SetAsDefaultBrowser();
+void ShellIntegration::DefaultBrowserWorker::SetAsDefault(
+ bool interactive_permitted) {
+ ShellIntegration::DefaultSettingsChangePermission change_permissions =
+ ShellIntegration::CanSetAsDefaultBrowser();
+
+ switch (change_permissions) {
+ case ShellIntegration::CHANGE_DEFAULT_UNATTENDED:
+ ShellIntegration::SetAsDefaultBrowser();
+ break;
+ case ShellIntegration::CHANGE_DEFAULT_INTERACTIVE:
+ if (interactive_permitted)
+ ShellIntegration::SetAsDefaultBrowserInteractive();
+ break;
+ default:
+ NOTREACHED();
+ }
}
///////////////////////////////////////////////////////////////////////////////
@@ -225,6 +247,7 @@ ShellIntegration::DefaultProtocolClientWorker::CheckIsDefault() {
return ShellIntegration::IsDefaultProtocolClient(protocol_);
}
-void ShellIntegration::DefaultProtocolClientWorker::SetAsDefault() {
+void ShellIntegration::DefaultProtocolClientWorker::SetAsDefault(
+ bool interactive_permitted) {
ShellIntegration::SetAsDefaultProtocolClient(protocol_);
}

Powered by Google App Engine
This is Rietveld 408576698