summaryrefslogtreecommitdiffstats
path: root/chrome/browser/shell_integration.h
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.h
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.h')
-rw-r--r--chrome/browser/shell_integration.h35
1 files changed, 27 insertions, 8 deletions
diff --git a/chrome/browser/shell_integration.h b/chrome/browser/shell_integration.h
index 2c1ae79..eb7d716 100644
--- a/chrome/browser/shell_integration.h
+++ b/chrome/browser/shell_integration.h
@@ -23,16 +23,32 @@ class ShellIntegration {
// false if this operation fails.
static bool SetAsDefaultBrowser();
+ // Initiates an OS shell flow which (if followed by the user) should set
+ // Chrome as the default browser. Returns false if the flow cannot be
+ // initialized, if it is not supported (introduced for Windows 8) or if the
+ // user cancels the operation. This is a blocking call and requires a FILE
+ // thread.
+ static bool SetAsDefaultBrowserInteractive();
+
// Sets Chrome as the default client application for the given protocol
// (only for the current user). Returns false if this operation fails.
static bool SetAsDefaultProtocolClient(const std::string& protocol);
- // Returns true if the running browser can be set as the default browser.
- static bool CanSetAsDefaultBrowser();
+ // In Windows 8 a browser can be made default-in-metro only in an interactive
+ // flow. We will distinguish between two types of permissions here to avoid
+ // forcing the user into UI interaction when this should not be done.
+ enum DefaultWebClientSetPermission {
+ SET_DEFAULT_NOT_ALLOWED = 0,
+ SET_DEFAULT_UNATTENDED,
+ SET_DEFAULT_INTERACTIVE,
+ };
+
+ // Returns requirements for making the running browser the user's default.
+ static DefaultWebClientSetPermission CanSetAsDefaultBrowser();
- // Returns true if the running browser can be set as the default client
- // application for specific protocols.
- static bool CanSetAsDefaultProtocolClient();
+ // Returns requirements for making the running browser the user's default
+ // client application for specific protocols.
+ static DefaultWebClientSetPermission CanSetAsDefaultProtocolClient();
// On Linux, it may not be possible to determine or set the default browser
// on some desktop environments or configurations. So, we use this enum and
@@ -150,6 +166,9 @@ class ShellIntegration {
// Observer classes that return true to OwnedByWorker are automatically
// freed by the worker when they are no longer needed.
virtual bool IsOwnedByWorker() { return false; }
+ // An observer can permit or decline set-as-default operation if it
+ // requires triggering user interaction.
+ virtual bool IsInteractiveSetDefaultPermitted() { return false; }
};
// Helper objects that handle checking if Chrome is the default browser
@@ -185,7 +204,7 @@ class ShellIntegration {
virtual DefaultWebClientState CheckIsDefault() = 0;
// Function that sets Chrome as the default web client.
- virtual void SetAsDefault() = 0;
+ virtual void SetAsDefault(bool interactive_permitted) = 0;
// Function that handles performing the check on the file thread. This
// function is posted as a task onto the file thread, where it performs
@@ -234,7 +253,7 @@ class ShellIntegration {
virtual DefaultWebClientState CheckIsDefault() OVERRIDE;
// Set Chrome as the default browser.
- virtual void SetAsDefault() OVERRIDE;
+ virtual void SetAsDefault(bool interactive_permitted) OVERRIDE;
DISALLOW_COPY_AND_ASSIGN(DefaultBrowserWorker);
};
@@ -258,7 +277,7 @@ class ShellIntegration {
virtual DefaultWebClientState CheckIsDefault() OVERRIDE;
// Set Chrome as the default handler for this protocol.
- virtual void SetAsDefault() OVERRIDE;
+ virtual void SetAsDefault(bool interactive_permitted) OVERRIDE;
std::string protocol_;