Chromium Code Reviews| Index: chrome/browser/shell_integration.h |
| diff --git a/chrome/browser/shell_integration.h b/chrome/browser/shell_integration.h |
| index eb7d716c6e81a1cfdf6b450fbc80e300f657fee4..b14b5694ccaa8211152cd8bc84dec24f8486a894 100644 |
| --- a/chrome/browser/shell_integration.h |
| +++ b/chrome/browser/shell_integration.h |
| @@ -158,11 +158,19 @@ class ShellIntegration { |
| STATE_UNKNOWN |
| }; |
| + enum SetDefaultWebClientResult { |
|
grt (UTC plus 2)
2012/06/18 19:19:13
Please document this.
motek.
2012/06/19 18:06:44
Done.
|
| + RESULT_SET_DEFAULT_OK, |
| + RESULT_SET_DEFAULT_FAILED_OR_CANCELLED, |
| + RESULT_SET_DEFAULT_UNDEFINED, |
| + }; |
| + |
| class DefaultWebClientObserver { |
| public: |
| virtual ~DefaultWebClientObserver() {} |
| // Updates the UI state to reflect the current default browser state. |
| - virtual void SetDefaultWebClientUIState(DefaultWebClientUIState state) = 0; |
| + virtual void SetDefaultWebClientUIState( |
|
grt (UTC plus 2)
2012/06/18 19:19:13
i don't really like this as-is, since it confuses
motek.
2012/06/19 18:06:44
I did consider a similar idea. The trouble is that
grt (UTC plus 2)
2012/06/19 20:43:09
I was interpreting "state" in the sense of a FSM.
|
| + DefaultWebClientUIState state, |
| + SetDefaultWebClientResult call_result) = 0; |
| // Observer classes that return true to OwnedByWorker are automatically |
| // freed by the worker when they are no longer needed. |
| virtual bool IsOwnedByWorker() { return false; } |
| @@ -204,14 +212,19 @@ class ShellIntegration { |
| virtual DefaultWebClientState CheckIsDefault() = 0; |
| // Function that sets Chrome as the default web client. |
| - virtual void SetAsDefault(bool interactive_permitted) = 0; |
| + virtual SetDefaultWebClientResult SetAsDefault( |
| + bool interactive_permitted) = 0; |
| + |
| + // Private version takes a call result to be eventually forwarded to the |
| + // observer. |
| + void StartCheckIsDefault(SetDefaultWebClientResult call_result); |
| // Function that handles performing the check on the file thread. This |
| // function is posted as a task onto the file thread, where it performs |
| // the check. When the check has finished the CompleteCheckIsDefault |
| // function is posted to the UI thread, where the result is sent back to |
| // the observer. |
| - void ExecuteCheckIsDefault(); |
| + void ExecuteCheckIsDefault(SetDefaultWebClientResult call_result); |
| // Function that handles setting Chrome as the default web client on the |
| // file thread. This function is posted as a task onto the file thread. |
| @@ -223,18 +236,20 @@ class ShellIntegration { |
| // Communicate results to the observer. This function is posted as a task |
| // onto the UI thread by the ExecuteCheckIsDefault function running in the |
| // file thread. |
| - void CompleteCheckIsDefault(DefaultWebClientState state); |
| + void CompleteCheckIsDefault(DefaultWebClientState state, |
| + SetDefaultWebClientResult call_result); |
| // When the action to set Chrome as the default has completed this function |
| // is run. It is posted as a task back onto the UI thread by the |
| // ExecuteSetAsDefault function running in the file thread. This function |
| // will the start the check process, which, if an observer is present, |
| // reports to it the new status. |
| - void CompleteSetAsDefault(); |
| + void CompleteSetAsDefault(SetDefaultWebClientResult call_result); |
| // Updates the UI in our associated view with the current default web |
| // client state. |
| - void UpdateUI(DefaultWebClientState state); |
| + void UpdateUI(DefaultWebClientState state, |
| + SetDefaultWebClientResult call_result); |
| DefaultWebClientObserver* observer_; |
| @@ -253,7 +268,8 @@ class ShellIntegration { |
| virtual DefaultWebClientState CheckIsDefault() OVERRIDE; |
| // Set Chrome as the default browser. |
| - virtual void SetAsDefault(bool interactive_permitted) OVERRIDE; |
| + virtual SetDefaultWebClientResult SetAsDefault( |
| + bool interactive_permitted) OVERRIDE; |
| DISALLOW_COPY_AND_ASSIGN(DefaultBrowserWorker); |
| }; |
| @@ -277,7 +293,8 @@ class ShellIntegration { |
| virtual DefaultWebClientState CheckIsDefault() OVERRIDE; |
| // Set Chrome as the default handler for this protocol. |
| - virtual void SetAsDefault(bool interactive_permitted) OVERRIDE; |
| + virtual SetDefaultWebClientResult SetAsDefault( |
| + bool interactive_permitted) OVERRIDE; |
| std::string protocol_; |