diff options
author | motek@chromium.org <motek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-22 22:23:38 +0000 |
---|---|---|
committer | motek@chromium.org <motek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-22 22:23:38 +0000 |
commit | 693baa5df24716eb9002c8fb1834a2ee6d185520 (patch) | |
tree | 540281c5f567896d978a162fd95c18c9389995c4 /chrome/browser/shell_integration.cc | |
parent | a0ac8af14b1c6980079cb938dc22e0e82f9a2034 (diff) | |
download | chromium_src-693baa5df24716eb9002c8fb1834a2ee6d185520.zip chromium_src-693baa5df24716eb9002c8fb1834a2ee6d185520.tar.gz chromium_src-693baa5df24716eb9002c8fb1834a2ee6d185520.tar.bz2 |
Prototype version of the first-run dialog for Windows 8.
The new UI supports both dialog and in-tab versions. Its purpose is to
set Chrome as default browser when running first time and to re-launch it
in Metro mode.
R=grt,gab,jhawkins,sky
BUG=131838
TEST=
Review URL: https://chromiumcodereview.appspot.com/10539169
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143729 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/shell_integration.cc')
-rw-r--r-- | chrome/browser/shell_integration.cc | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/chrome/browser/shell_integration.cc b/chrome/browser/shell_integration.cc index fa6dc3f..ee27074 100644 --- a/chrome/browser/shell_integration.cc +++ b/chrome/browser/shell_integration.cc @@ -102,6 +102,15 @@ bool ShellIntegration::SetAsDefaultBrowserInteractive() { } #endif +bool ShellIntegration::DefaultWebClientObserver::IsOwnedByWorker() { + return false; +} + +bool ShellIntegration::DefaultWebClientObserver:: + IsInteractiveSetDefaultPermitted() { + return false; +} + /////////////////////////////////////////////////////////////////////////////// // ShellIntegration::DefaultWebClientWorker // @@ -122,13 +131,15 @@ void ShellIntegration::DefaultWebClientWorker::StartCheckIsDefault() { } void ShellIntegration::DefaultWebClientWorker::StartSetAsDefault() { + bool interactive_permitted = false; if (observer_) { observer_->SetDefaultWebClientUIState(STATE_PROCESSING); + interactive_permitted = observer_->IsInteractiveSetDefaultPermitted(); } BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - base::Bind( - &DefaultWebClientWorker::ExecuteSetAsDefault, this)); + base::Bind(&DefaultWebClientWorker::ExecuteSetAsDefault, this, + interactive_permitted)); } void ShellIntegration::DefaultWebClientWorker::ObserverDestroyed() { @@ -162,17 +173,22 @@ void ShellIntegration::DefaultWebClientWorker::CompleteCheckIsDefault( } } -void ShellIntegration::DefaultWebClientWorker::ExecuteSetAsDefault() { +void ShellIntegration::DefaultWebClientWorker::ExecuteSetAsDefault( + bool interactive_permitted) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - SetAsDefault(observer_ && observer_->IsInteractiveSetDefaultPermitted()); + + bool result = SetAsDefault(interactive_permitted); BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::Bind( - &DefaultWebClientWorker::CompleteSetAsDefault, this)); + base::Bind(&DefaultWebClientWorker::CompleteSetAsDefault, this, result)); } -void ShellIntegration::DefaultWebClientWorker::CompleteSetAsDefault() { +void ShellIntegration::DefaultWebClientWorker::CompleteSetAsDefault( + bool succeeded) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + // First tell the observer what the SetAsDefault call has returned. + if (observer_) + observer_->OnSetAsDefaultConcluded(succeeded); // Set as default completed, check again to make sure it stuck... StartCheckIsDefault(); } @@ -213,19 +229,22 @@ ShellIntegration::DefaultBrowserWorker::CheckIsDefault() { return ShellIntegration::IsDefaultBrowser(); } -void ShellIntegration::DefaultBrowserWorker::SetAsDefault( +bool ShellIntegration::DefaultBrowserWorker::SetAsDefault( bool interactive_permitted) { + bool result = false; switch (ShellIntegration::CanSetAsDefaultBrowser()) { case ShellIntegration::SET_DEFAULT_UNATTENDED: - ShellIntegration::SetAsDefaultBrowser(); + result = ShellIntegration::SetAsDefaultBrowser(); break; case ShellIntegration::SET_DEFAULT_INTERACTIVE: if (interactive_permitted) - ShellIntegration::SetAsDefaultBrowserInteractive(); + result = ShellIntegration::SetAsDefaultBrowserInteractive(); break; default: NOTREACHED(); } + + return result; } /////////////////////////////////////////////////////////////////////////////// @@ -246,7 +265,7 @@ ShellIntegration::DefaultProtocolClientWorker::CheckIsDefault() { return ShellIntegration::IsDefaultProtocolClient(protocol_); } -void ShellIntegration::DefaultProtocolClientWorker::SetAsDefault( +bool ShellIntegration::DefaultProtocolClientWorker::SetAsDefault( bool interactive_permitted) { - ShellIntegration::SetAsDefaultProtocolClient(protocol_); + return ShellIntegration::SetAsDefaultProtocolClient(protocol_); } |