| 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 // This file declares methods that are useful for integrating Chrome in | 5 // This file declares methods that are useful for integrating Chrome in |
| 6 // Windows shell. These methods are all static and currently part of | 6 // Windows shell. These methods are all static and currently part of |
| 7 // ShellUtil class. | 7 // ShellUtil class. |
| 8 | 8 |
| 9 #ifndef CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ | 9 #ifndef CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ |
| 10 #define CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ | 10 #define CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // This is a utility class that provides common shell integration methods | 25 // This is a utility class that provides common shell integration methods |
| 26 // that can be used by installer as well as Chrome. | 26 // that can be used by installer as well as Chrome. |
| 27 class ShellUtil { | 27 class ShellUtil { |
| 28 public: | 28 public: |
| 29 // Input to any methods that make changes to OS shell. | 29 // Input to any methods that make changes to OS shell. |
| 30 enum ShellChange { | 30 enum ShellChange { |
| 31 CURRENT_USER = 0x1, // Make any shell changes only at the user level | 31 CURRENT_USER = 0x1, // Make any shell changes only at the user level |
| 32 SYSTEM_LEVEL = 0x2 // Make any shell changes only at the system level | 32 SYSTEM_LEVEL = 0x2 // Make any shell changes only at the system level |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 // Chrome's default handler state for a given protocol. |
| 36 enum DefaultState { |
| 37 UNKNOWN_DEFAULT, |
| 38 NOT_DEFAULT, |
| 39 IS_DEFAULT, |
| 40 }; |
| 41 |
| 35 // Typical shortcut directories. Resolved in GetShortcutPath(). | 42 // Typical shortcut directories. Resolved in GetShortcutPath(). |
| 36 enum ChromeShortcutLocation { | 43 enum ChromeShortcutLocation { |
| 37 SHORTCUT_DESKTOP, | 44 SHORTCUT_DESKTOP, |
| 38 SHORTCUT_QUICK_LAUNCH, | 45 SHORTCUT_QUICK_LAUNCH, |
| 39 SHORTCUT_START_MENU, | 46 SHORTCUT_START_MENU, |
| 40 }; | 47 }; |
| 41 | 48 |
| 42 enum ChromeShortcutOperation { | 49 enum ChromeShortcutOperation { |
| 43 // Create a new shortcut (overwriting if necessary). | 50 // Create a new shortcut (overwriting if necessary). |
| 44 SHORTCUT_CREATE_ALWAYS, | 51 SHORTCUT_CREATE_ALWAYS, |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 // The returned appid is guaranteed to be no longer than | 379 // The returned appid is guaranteed to be no longer than |
| 373 // chrome::kMaxAppModelIdLength (some of the components might have been | 380 // chrome::kMaxAppModelIdLength (some of the components might have been |
| 374 // shortened to enforce this). | 381 // shortened to enforce this). |
| 375 static string16 BuildAppModelId(const std::vector<string16>& components); | 382 static string16 BuildAppModelId(const std::vector<string16>& components); |
| 376 | 383 |
| 377 // Returns true if Chrome can make itself the default browser without relying | 384 // Returns true if Chrome can make itself the default browser without relying |
| 378 // on the Windows shell to prompt the user. This is the case for versions of | 385 // on the Windows shell to prompt the user. This is the case for versions of |
| 379 // Windows prior to Windows 8. | 386 // Windows prior to Windows 8. |
| 380 static bool CanMakeChromeDefaultUnattended(); | 387 static bool CanMakeChromeDefaultUnattended(); |
| 381 | 388 |
| 389 // Returns true if Chrome is the default handler for HTTP and HTTPS. |
| 390 static DefaultState IsChromeDefault(); |
| 391 |
| 392 // Returns true if Chrome is the default handler for |protocol|. |
| 393 static DefaultState IsChromeDefaultProtocolClient(const string16& protocol); |
| 394 |
| 382 // Make Chrome the default browser. This function works by going through | 395 // Make Chrome the default browser. This function works by going through |
| 383 // the url protocols and file associations that are related to general | 396 // the url protocols and file associations that are related to general |
| 384 // browsing, e.g. http, https, .html etc., and requesting to become the | 397 // browsing, e.g. http, https, .html etc., and requesting to become the |
| 385 // default handler for each. If any of these fails the operation will return | 398 // default handler for each. If any of these fails the operation will return |
| 386 // false to indicate failure, which is consistent with the return value of | 399 // false to indicate failure, which is consistent with the return value of |
| 387 // ShellIntegration::IsDefaultBrowser. | 400 // ShellIntegration::IsDefaultBrowser. |
| 388 // | 401 // |
| 389 // In the case of failure any successful changes will be left, however no | 402 // In the case of failure any successful changes will be left, however no |
| 390 // more changes will be attempted. | 403 // more changes will be attempted. |
| 391 // TODO(benwells): Attempt to undo any changes that were successfully made. | 404 // TODO(benwells): Attempt to undo any changes that were successfully made. |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 // required by the base32 standard for inputs that aren't a multiple of 5 | 543 // required by the base32 standard for inputs that aren't a multiple of 5 |
| 531 // bytes. | 544 // bytes. |
| 532 static string16 ByteArrayToBase32(const uint8* bytes, size_t size); | 545 static string16 ByteArrayToBase32(const uint8* bytes, size_t size); |
| 533 | 546 |
| 534 private: | 547 private: |
| 535 DISALLOW_COPY_AND_ASSIGN(ShellUtil); | 548 DISALLOW_COPY_AND_ASSIGN(ShellUtil); |
| 536 }; | 549 }; |
| 537 | 550 |
| 538 | 551 |
| 539 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ | 552 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ |
| OLD | NEW |