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

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: Addressed the reviewer's remark. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/shell_integration.h ('k') | chrome/browser/shell_integration_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/shell_integration.cc
diff --git a/chrome/browser/shell_integration.cc b/chrome/browser/shell_integration.cc
index 6748679997286e38e9a46d279f187064e9dd7062..73754439a329da0826fd8123ea9c01e3d5dd5242 100644
--- a/chrome/browser/shell_integration.cc
+++ b/chrome/browser/shell_integration.cc
@@ -18,7 +18,8 @@
using content::BrowserThread;
-bool ShellIntegration::CanSetAsDefaultProtocolClient() {
+ShellIntegration::DefaultWebClientSetPermission
+ 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,19 @@ ShellIntegration::DefaultBrowserWorker::CheckIsDefault() {
return ShellIntegration::IsDefaultBrowser();
}
-void ShellIntegration::DefaultBrowserWorker::SetAsDefault() {
- ShellIntegration::SetAsDefaultBrowser();
+void ShellIntegration::DefaultBrowserWorker::SetAsDefault(
+ bool interactive_permitted) {
+ switch (ShellIntegration::CanSetAsDefaultBrowser()) {
+ case ShellIntegration::SET_DEFAULT_UNATTENDED:
+ ShellIntegration::SetAsDefaultBrowser();
+ break;
+ case ShellIntegration::SET_DEFAULT_INTERACTIVE:
+ if (interactive_permitted)
+ ShellIntegration::SetAsDefaultBrowserInteractive();
+ break;
+ default:
+ NOTREACHED();
+ }
}
///////////////////////////////////////////////////////////////////////////////
@@ -225,6 +244,7 @@ ShellIntegration::DefaultProtocolClientWorker::CheckIsDefault() {
return ShellIntegration::IsDefaultProtocolClient(protocol_);
}
-void ShellIntegration::DefaultProtocolClientWorker::SetAsDefault() {
+void ShellIntegration::DefaultProtocolClientWorker::SetAsDefault(
+ bool interactive_permitted) {
ShellIntegration::SetAsDefaultProtocolClient(protocol_);
}
« no previous file with comments | « chrome/browser/shell_integration.h ('k') | chrome/browser/shell_integration_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698