summaryrefslogtreecommitdiffstats
path: root/chrome/browser/shell_integration.cc
diff options
context:
space:
mode:
authormotek@chromium.org <motek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-08 05:07:32 +0000
committermotek@chromium.org <motek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-08 05:07:32 +0000
commitbd046bd4d5d20877e637240e8534fddc975f3d85 (patch)
tree9b442409d10022de3b93c79060b38facf82aca72 /chrome/browser/shell_integration.cc
parent4a9285d7dda331b2c998ecbe92d559f8b2286694 (diff)
downloadchromium_src-bd046bd4d5d20877e637240e8534fddc975f3d85.zip
chromium_src-bd046bd4d5d20877e637240e8534fddc975f3d85.tar.gz
chromium_src-bd046bd4d5d20877e637240e8534fddc975f3d85.tar.bz2
The CL adds to ShellUtil and ShellIntegration and adjusts invocations of the latter whenever necessary.
R=grt@chromium.org, sky@chromium.org BUG=113326, 129232 TEST=N/A Review URL: https://chromiumcodereview.appspot.com/10453041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141172 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/shell_integration.cc')
-rw-r--r--chrome/browser/shell_integration.cc30
1 files changed, 25 insertions, 5 deletions
diff --git a/chrome/browser/shell_integration.cc b/chrome/browser/shell_integration.cc
index 6748679..7375443 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_);
}