Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(428)

Side by Side Diff: chrome/browser/shell_integration.h

Issue 10453041: Support for interactive set-chrome-as-default in Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_SHELL_INTEGRATION_H_ 5 #ifndef CHROME_BROWSER_SHELL_INTEGRATION_H_
6 #define CHROME_BROWSER_SHELL_INTEGRATION_H_ 6 #define CHROME_BROWSER_SHELL_INTEGRATION_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/string16.h" 14 #include "base/string16.h"
15 #include "googleurl/src/gurl.h" 15 #include "googleurl/src/gurl.h"
16 #include "ui/gfx/image/image.h" 16 #include "ui/gfx/image/image.h"
17 17
18 class CommandLine; 18 class CommandLine;
19 19
20 class ShellIntegration { 20 class ShellIntegration {
21 public: 21 public:
22 // Sets Chrome as the default browser (only for the current user). Returns 22 // Sets Chrome as the default browser (only for the current user). Returns
23 // false if this operation fails. 23 // false if this operation fails.
24 static bool SetAsDefaultBrowser(); 24 static bool SetAsDefaultBrowser();
25 25
26 // Initializes an OS shell flow which (if followed by the user) should set
27 // Chrome as the default browser. Returns false if the flow cannot be
28 // initialized or if it is not supported (introduced for Windows8).
grt (UTC plus 2) 2012/05/25 20:27:38 Windows8 -> Windows 8
motek. 2012/05/28 17:40:33 Done.
29 static bool StartSetAsDefaultBrowserInteractive();
30
26 // Sets Chrome as the default client application for the given protocol 31 // Sets Chrome as the default client application for the given protocol
27 // (only for the current user). Returns false if this operation fails. 32 // (only for the current user). Returns false if this operation fails.
28 static bool SetAsDefaultProtocolClient(const std::string& protocol); 33 static bool SetAsDefaultProtocolClient(const std::string& protocol);
29 34
35 // In Windows 8 a browser can be made default-in-metro only in an interactive
36 // flow. We will distinguish between two types of permissions here to avoid
37 // forcing user into UI interaction when this should not be done.
grt (UTC plus 2) 2012/05/25 20:27:38 user -> the user
motek. 2012/05/28 17:40:33 Done.
38 enum DefaultSettingsChangePermission {
39 CHANGE_DEFAULT_NOT_ALLOWED = 0,
40 CHANGE_DEFAULT_UNATTENDED,
41 CHANGE_DEFAULT_INTERACTIVE,
42 };
43
30 // Returns true if the running browser can be set as the default browser. 44 // Returns true if the running browser can be set as the default browser.
grt (UTC plus 2) 2012/05/25 20:27:38 update comment. suggest something like: "Returns
motek. 2012/05/28 17:40:33 Done.
31 static bool CanSetAsDefaultBrowser(); 45 static DefaultSettingsChangePermission CanSetAsDefaultBrowser();
32 46
33 // Returns true if the running browser can be set as the default client 47 // Returns true if the running browser can be set as the default client
grt (UTC plus 2) 2012/05/25 20:27:38 here, too
motek. 2012/05/28 17:40:33 Done.
34 // application for specific protocols. 48 // application for specific protocols.
35 static bool CanSetAsDefaultProtocolClient(); 49 static DefaultSettingsChangePermission CanSetAsDefaultProtocolClient();
36 50
37 // On Linux, it may not be possible to determine or set the default browser 51 // On Linux, it may not be possible to determine or set the default browser
38 // on some desktop environments or configurations. So, we use this enum and 52 // on some desktop environments or configurations. So, we use this enum and
39 // not a plain bool. (Note however that if used like a bool, this enum will 53 // not a plain bool. (Note however that if used like a bool, this enum will
40 // have reasonable behavior.) 54 // have reasonable behavior.)
41 enum DefaultWebClientState { 55 enum DefaultWebClientState {
42 NOT_DEFAULT_WEB_CLIENT = 0, 56 NOT_DEFAULT_WEB_CLIENT = 0,
43 IS_DEFAULT_WEB_CLIENT, 57 IS_DEFAULT_WEB_CLIENT,
44 UNKNOWN_DEFAULT_WEB_CLIENT = -1 58 UNKNOWN_DEFAULT_WEB_CLIENT = -1
45 }; 59 };
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 // Set Chrome as the default handler for this protocol. 269 // Set Chrome as the default handler for this protocol.
256 virtual void SetAsDefault() OVERRIDE; 270 virtual void SetAsDefault() OVERRIDE;
257 271
258 std::string protocol_; 272 std::string protocol_;
259 273
260 DISALLOW_COPY_AND_ASSIGN(DefaultProtocolClientWorker); 274 DISALLOW_COPY_AND_ASSIGN(DefaultProtocolClientWorker);
261 }; 275 };
262 }; 276 };
263 277
264 #endif // CHROME_BROWSER_SHELL_INTEGRATION_H_ 278 #endif // CHROME_BROWSER_SHELL_INTEGRATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698