Chromium Code Reviews| Index: chrome/browser/shell_integration.h |
| diff --git a/chrome/browser/shell_integration.h b/chrome/browser/shell_integration.h |
| index f2c629a57ae819495dcdee1ce6e4c02b86bcb567..31af722df423d112c0088ec7e776641f16f98e3a 100644 |
| --- a/chrome/browser/shell_integration.h |
| +++ b/chrome/browser/shell_integration.h |
| @@ -201,12 +201,6 @@ class ShellIntegration { |
| // Called to notify the UI of the immediate result of invoking |
| // SetAsDefault. |
| virtual void OnSetAsDefaultConcluded(bool succeeded) {} |
| - // Observer classes that return true to OwnedByWorker are automatically |
| - // freed by the worker when they are no longer needed. False by default. |
| - virtual bool IsOwnedByWorker(); |
| - // An observer can permit or decline set-as-default operation if it |
| - // requires triggering user interaction. By default not allowed. |
| - virtual bool IsInteractiveSetDefaultPermitted(); |
| }; |
| // Helper objects that handle checking if Chrome is the default browser |
| @@ -217,7 +211,9 @@ class ShellIntegration { |
| class DefaultWebClientWorker |
| : public base::RefCountedThreadSafe<DefaultWebClientWorker> { |
| public: |
| - explicit DefaultWebClientWorker(DefaultWebClientObserver* observer); |
| + DefaultWebClientWorker(DefaultWebClientObserver* observer, |
|
grt (UTC plus 2)
2016/02/02 17:28:22
please add a doc comment for this function (and th
Patrick Monette
2016/02/02 22:24:15
Done.
|
| + bool delete_observer, |
| + bool interactive_permitted); |
| // Checks to see if Chrome is the default web client application. The result |
| // will be passed back to the observer via the SetDefaultWebClientUIState |
| @@ -281,6 +277,10 @@ class ShellIntegration { |
| return set_as_default_initialized_; |
| } |
| + // When false, the operation to set as default will fail for interactive |
| + // flows. |
| + bool interactive_permitted_; |
| + |
| // Flag that indicates if the set-as-default operation is in progess to |
| // prevent multiple notifications to the observer. |
| bool set_as_default_in_progress_ = false; |
| @@ -292,10 +292,9 @@ class ShellIntegration { |
| virtual void CheckIsDefault() = 0; |
| // Sets Chrome as the default web client. Always called on the FILE thread. |
| - // |interactive_permitted| will make SetAsDefault() fail if it requires |
| - // interaction with the user. Subclasses are responsible for calling |
| - // OnSetAsDefaultAttemptComplete() on the UI thread. |
| - virtual void SetAsDefault(bool interactive_permitted) = 0; |
| + // Subclasses are responsible for calling OnSetAsDefaultAttemptComplete() on |
| + // the UI thread. |
| + virtual void SetAsDefault() = 0; |
| // Returns the prefix used for metrics to differentiate UMA metrics for |
| // setting the default browser and setting the default protocol client. |
| @@ -325,6 +324,9 @@ class ShellIntegration { |
| DefaultWebClientObserver* observer_; |
| + // Indicates if the the observer will be automatically freed by the worker. |
| + bool delete_observer_; |
| + |
| // Flag that indicates the return value of InitializeSetAsDefault(). If |
| // true, FinalizeSetAsDefault() will be called to clear what was |
| // initialized. |
| @@ -343,7 +345,9 @@ class ShellIntegration { |
| // Worker for checking and setting the default browser. |
| class DefaultBrowserWorker : public DefaultWebClientWorker { |
| public: |
| - explicit DefaultBrowserWorker(DefaultWebClientObserver* observer); |
| + DefaultBrowserWorker(DefaultWebClientObserver* observer, |
| + bool delete_observer, |
| + bool interactive_permitted); |
| private: |
| ~DefaultBrowserWorker() override; |
| @@ -352,7 +356,7 @@ class ShellIntegration { |
| void CheckIsDefault() override; |
| // Set Chrome as the default browser. |
| - void SetAsDefault(bool interactive_permitted) override; |
| + void SetAsDefault() override; |
| // Returns the histogram prefix for DefaultBrowserWorker. |
| const char* GetHistogramPrefix() override; |
| @@ -384,7 +388,9 @@ class ShellIntegration { |
| class DefaultProtocolClientWorker : public DefaultWebClientWorker { |
| public: |
| DefaultProtocolClientWorker(DefaultWebClientObserver* observer, |
| - const std::string& protocol); |
| + const std::string& protocol, |
| + bool delete_observer, |
| + bool interactive_permitted); |
| const std::string& protocol() const { return protocol_; } |
| @@ -396,7 +402,7 @@ class ShellIntegration { |
| void CheckIsDefault() override; |
| // Set Chrome as the default handler for this protocol. |
| - void SetAsDefault(bool interactive_permitted) override; |
| + void SetAsDefault() override; |
| // Returns the histogram prefix for DefaultProtocolClientWorker. |
| const char* GetHistogramPrefix() override; |