Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Windows 8). | |
| 29 static bool StartSetAsDefaultBrowserInteractive(); | |
|
grt (UTC plus 2)
2012/05/28 20:47:02
The name "StartBlaBlah" makes me think that this m
motek.
2012/05/31 21:59:04
Done.
| |
| 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 |
| 30 // Returns true if the running browser can be set as the default browser. | 35 // In Windows 8 a browser can be made default-in-metro only in an interactive |
| 31 static bool CanSetAsDefaultBrowser(); | 36 // flow. We will distinguish between two types of permissions here to avoid |
| 37 // forcing the user into UI interaction when this should not be done. | |
| 38 enum DefaultSettingsChangePermission { | |
| 39 CHANGE_DEFAULT_NOT_ALLOWED = 0, | |
| 40 CHANGE_DEFAULT_UNATTENDED, | |
| 41 CHANGE_DEFAULT_INTERACTIVE, | |
| 42 }; | |
| 32 | 43 |
| 33 // Returns true if the running browser can be set as the default client | 44 // Returns requirements for making the running browser the user's default. |
| 34 // application for specific protocols. | 45 static DefaultSettingsChangePermission CanSetAsDefaultBrowser(); |
| 35 static bool CanSetAsDefaultProtocolClient(); | 46 |
| 47 // Returns requirements for making the running browser the user's default | |
| 48 // client application for specific protocols. | |
| 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 Loading... | |
| 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_ |
| OLD | NEW |