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_ |
11 #pragma once | 11 #pragma once |
12 | 12 |
13 #include <windows.h> | 13 #include <windows.h> |
14 | 14 |
15 #include <map> | 15 #include <map> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
18 #include "base/basictypes.h" | 18 #include "base/basictypes.h" |
| 19 #include "base/md5.h" |
19 #include "base/string16.h" | 20 #include "base/string16.h" |
20 #include "chrome/installer/util/work_item_list.h" | 21 #include "chrome/installer/util/work_item_list.h" |
21 | 22 |
22 class BrowserDistribution; | 23 class BrowserDistribution; |
23 class FilePath; | 24 class FilePath; |
24 | 25 |
25 namespace base { | 26 namespace base { |
26 class DictionaryValue; | 27 class DictionaryValue; |
27 } | 28 } |
28 | 29 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 237 |
237 // Returns the application name of the program under |dist|. | 238 // Returns the application name of the program under |dist|. |
238 // This application name will be suffixed as is appropriate for the current | 239 // This application name will be suffixed as is appropriate for the current |
239 // install. | 240 // install. |
240 // This is the name that is registered with Default Programs on Windows and | 241 // This is the name that is registered with Default Programs on Windows and |
241 // that should thus be used to "make chrome default" and such. | 242 // that should thus be used to "make chrome default" and such. |
242 static string16 GetApplicationName(BrowserDistribution* dist, | 243 static string16 GetApplicationName(BrowserDistribution* dist, |
243 const string16& chrome_exe); | 244 const string16& chrome_exe); |
244 | 245 |
245 // Returns the AppUserModelId for |dist|. This identifier is unconditionally | 246 // Returns the AppUserModelId for |dist|. This identifier is unconditionally |
246 // suffixed with the user id for user-level installs (in contrast to other | 247 // suffixed with a unique id for this user on user-level installs (in contrast |
247 // registration entries which are suffix as described in | 248 // to other registration entries which are suffixed as described in |
248 // GetCurrentInstallationSuffix() above). | 249 // GetCurrentInstallationSuffix() above). |
249 static string16 GetBrowserModelId(BrowserDistribution* dist, | 250 static string16 GetBrowserModelId(BrowserDistribution* dist, |
250 const string16& chrome_exe); | 251 const string16& chrome_exe); |
251 | 252 |
252 // Returns an AppUserModelId composed of each member of |components| separated | 253 // Returns an AppUserModelId composed of each member of |components| separated |
253 // by dots. | 254 // by dots. |
254 // The returned appid is guaranteed to be no longer than | 255 // The returned appid is guaranteed to be no longer than |
255 // chrome::kMaxAppModelIdLength (some of the components might have been | 256 // chrome::kMaxAppModelIdLength (some of the components might have been |
256 // shortened to enforce this). | 257 // shortened to enforce this). |
257 static string16 BuildAppModelId(const std::vector<string16>& components); | 258 static string16 BuildAppModelId(const std::vector<string16>& components); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 // |options|: bitfield for which the options come from ChromeShortcutOptions. | 399 // |options|: bitfield for which the options come from ChromeShortcutOptions. |
399 static bool UpdateChromeShortcut(BrowserDistribution* dist, | 400 static bool UpdateChromeShortcut(BrowserDistribution* dist, |
400 const string16& chrome_exe, | 401 const string16& chrome_exe, |
401 const string16& shortcut, | 402 const string16& shortcut, |
402 const string16& arguments, | 403 const string16& arguments, |
403 const string16& description, | 404 const string16& description, |
404 const string16& icon_path, | 405 const string16& icon_path, |
405 int icon_index, | 406 int icon_index, |
406 uint32 options); | 407 uint32 options); |
407 | 408 |
| 409 // Returns the base32 encoding (using the [A-Z2-7] alphabet) of |digest|. |
| 410 // The returned string will be exactly 26 characters in length. |
| 411 static string16 MD5DigestToBase32(const base::MD5Digest& digest); |
| 412 |
| 413 // Returns the base32 encoding (using the [A-Z2-7] alphabet) of |bytes|. |
| 414 // |size| is the length of |bytes|. |
| 415 // Note: This method does not suffix the output with '=' signs as technically |
| 416 // required by the base32 standard for inputs that aren't a multiple of 5 |
| 417 // bits. |
| 418 static string16 ByteArrayToBase32(const unsigned char bytes[], int size); |
| 419 |
408 private: | 420 private: |
409 DISALLOW_COPY_AND_ASSIGN(ShellUtil); | 421 DISALLOW_COPY_AND_ASSIGN(ShellUtil); |
410 }; | 422 }; |
411 | 423 |
412 | 424 |
413 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ | 425 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ |
OLD | NEW |