summaryrefslogtreecommitdiffstats
path: root/chrome/browser/shell_integration.cc
diff options
context:
space:
mode:
authorkoz@chromium.org <koz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-26 07:48:02 +0000
committerkoz@chromium.org <koz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-26 07:48:02 +0000
commit4468a5b324c9e1af0f756ccb4ba5f97a37892eb9 (patch)
tree467daa8d43f65986353d4f1bb5cf82e71cebd3a8 /chrome/browser/shell_integration.cc
parente31d4c246deaefc59fe4f4fa66a74cd827694a41 (diff)
downloadchromium_src-4468a5b324c9e1af0f756ccb4ba5f97a37892eb9.zip
chromium_src-4468a5b324c9e1af0f756ccb4ba5f97a37892eb9.tar.gz
chromium_src-4468a5b324c9e1af0f756ccb4ba5f97a37892eb9.tar.bz2
Allow chrome to become the os default handler for arbitrary protocols on mac/win.
Note this is unused currently, but will be hooked up to navigator.registerProtocolHandler in a subsequent change. BUG=83556 TEST=Manual Review URL: http://codereview.chromium.org/6961013 Patch from Ben Wells <benwells@chromium.org>. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86793 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/shell_integration.cc')
-rw-r--r--chrome/browser/shell_integration.cc115
1 files changed, 80 insertions, 35 deletions
diff --git a/chrome/browser/shell_integration.cc b/chrome/browser/shell_integration.cc
index 0b66d07..fd0e035 100644
--- a/chrome/browser/shell_integration.cc
+++ b/chrome/browser/shell_integration.cc
@@ -61,86 +61,131 @@ CommandLine ShellIntegration::CommandLineArgsForLauncher(
}
///////////////////////////////////////////////////////////////////////////////
-// ShellIntegration::DefaultBrowserWorker
+// ShellIntegration::DefaultWebClientWorker
//
-ShellIntegration::DefaultBrowserWorker::DefaultBrowserWorker(
- DefaultBrowserObserver* observer)
+ShellIntegration::DefaultWebClientWorker::DefaultWebClientWorker(
+ DefaultWebClientObserver* observer)
: observer_(observer) {
}
-void ShellIntegration::DefaultBrowserWorker::StartCheckDefaultBrowser() {
- observer_->SetDefaultBrowserUIState(STATE_PROCESSING);
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
- NewRunnableMethod(
- this, &DefaultBrowserWorker::ExecuteCheckDefaultBrowser));
+void ShellIntegration::DefaultWebClientWorker::StartCheckIsDefault() {
+ if (observer_) {
+ observer_->SetDefaultWebClientUIState(STATE_PROCESSING);
+ BrowserThread::PostTask(
+ BrowserThread::FILE, FROM_HERE,
+ NewRunnableMethod(
+ this, &DefaultWebClientWorker::ExecuteCheckIsDefault));
+ }
}
-void ShellIntegration::DefaultBrowserWorker::StartSetAsDefaultBrowser() {
- observer_->SetDefaultBrowserUIState(STATE_PROCESSING);
+void ShellIntegration::DefaultWebClientWorker::StartSetAsDefault() {
+ if (observer_) {
+ observer_->SetDefaultWebClientUIState(STATE_PROCESSING);
+ }
BrowserThread::PostTask(
BrowserThread::FILE, FROM_HERE,
NewRunnableMethod(
- this, &DefaultBrowserWorker::ExecuteSetAsDefaultBrowser));
+ this, &DefaultWebClientWorker::ExecuteSetAsDefault));
}
-void ShellIntegration::DefaultBrowserWorker::ObserverDestroyed() {
+void ShellIntegration::DefaultWebClientWorker::ObserverDestroyed() {
// Our associated view has gone away, so we shouldn't call back to it if
// our worker thread returns after the view is dead.
observer_ = NULL;
}
///////////////////////////////////////////////////////////////////////////////
-// DefaultBrowserWorker, private:
+// DefaultWebClientWorker, private:
-void ShellIntegration::DefaultBrowserWorker::ExecuteCheckDefaultBrowser() {
+void ShellIntegration::DefaultWebClientWorker::ExecuteCheckIsDefault() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- DefaultBrowserState state = ShellIntegration::IsDefaultBrowser();
+ DefaultWebClientState state = CheckIsDefault();
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
NewRunnableMethod(
- this, &DefaultBrowserWorker::CompleteCheckDefaultBrowser, state));
+ this, &DefaultWebClientWorker::CompleteCheckIsDefault, state));
}
-void ShellIntegration::DefaultBrowserWorker::CompleteCheckDefaultBrowser(
- DefaultBrowserState state) {
+void ShellIntegration::DefaultWebClientWorker::CompleteCheckIsDefault(
+ DefaultWebClientState state) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
UpdateUI(state);
}
-void ShellIntegration::DefaultBrowserWorker::ExecuteSetAsDefaultBrowser() {
+void ShellIntegration::DefaultWebClientWorker::ExecuteSetAsDefault() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- ShellIntegration::SetAsDefaultBrowser();
+ SetAsDefault();
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
NewRunnableMethod(
- this, &DefaultBrowserWorker::CompleteSetAsDefaultBrowser));
+ this, &DefaultWebClientWorker::CompleteSetAsDefault));
}
-void ShellIntegration::DefaultBrowserWorker::CompleteSetAsDefaultBrowser() {
+void ShellIntegration::DefaultWebClientWorker::CompleteSetAsDefault() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (observer_) {
- // Set as default completed, check again to make sure it stuck...
- StartCheckDefaultBrowser();
- }
+ // Set as default completed, check again to make sure it stuck...
+ StartCheckIsDefault();
}
-void ShellIntegration::DefaultBrowserWorker::UpdateUI(
- DefaultBrowserState state) {
+void ShellIntegration::DefaultWebClientWorker::UpdateUI(
+ DefaultWebClientState state) {
if (observer_) {
switch (state) {
- case NOT_DEFAULT_BROWSER:
- observer_->SetDefaultBrowserUIState(STATE_NOT_DEFAULT);
+ case NOT_DEFAULT_WEB_CLIENT:
+ observer_->SetDefaultWebClientUIState(STATE_NOT_DEFAULT);
break;
- case IS_DEFAULT_BROWSER:
- observer_->SetDefaultBrowserUIState(STATE_IS_DEFAULT);
+ case IS_DEFAULT_WEB_CLIENT:
+ observer_->SetDefaultWebClientUIState(STATE_IS_DEFAULT);
break;
- case UNKNOWN_DEFAULT_BROWSER:
- observer_->SetDefaultBrowserUIState(STATE_UNKNOWN);
+ case UNKNOWN_DEFAULT_WEB_CLIENT:
+ observer_->SetDefaultWebClientUIState(STATE_UNKNOWN);
break;
default:
break;
}
}
}
+
+///////////////////////////////////////////////////////////////////////////////
+// ShellIntegration::DefaultBrowserWorker
+//
+
+ShellIntegration::DefaultBrowserWorker::DefaultBrowserWorker(
+ DefaultWebClientObserver* observer)
+ : DefaultWebClientWorker(observer) {
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// DefaultBrowserWorker, private:
+
+ShellIntegration::DefaultWebClientState
+ShellIntegration::DefaultBrowserWorker::CheckIsDefault() {
+ return ShellIntegration::IsDefaultBrowser();
+}
+
+void ShellIntegration::DefaultBrowserWorker::SetAsDefault() {
+ ShellIntegration::SetAsDefaultBrowser();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// ShellIntegration::DefaultProtocolClientWorker
+//
+
+ShellIntegration::DefaultProtocolClientWorker::DefaultProtocolClientWorker(
+ DefaultWebClientObserver* observer, const std::string& protocol)
+ : DefaultWebClientWorker(observer),
+ protocol_(protocol) {
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// DefaultProtocolClientWorker, private:
+
+ShellIntegration::DefaultWebClientState
+ShellIntegration::DefaultProtocolClientWorker::CheckIsDefault() {
+ return ShellIntegration::IsDefaultProtocolClient(protocol_);
+}
+
+void ShellIntegration::DefaultProtocolClientWorker::SetAsDefault() {
+ ShellIntegration::SetAsDefaultProtocolClient(protocol_);
+}