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 // 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 237 const string16& chrome_exe, | 237 const string16& chrome_exe, |
| 238 bool elevate_if_not_admin); | 238 bool elevate_if_not_admin); |
| 239 | 239 |
| 240 // Make Chrome the default application for a protocol. | 240 // Make Chrome the default application for a protocol. |
| 241 // chrome_exe: The chrome.exe path to register as default browser. | 241 // chrome_exe: The chrome.exe path to register as default browser. |
| 242 // protocol: The protocol to register as the default handler for. | 242 // protocol: The protocol to register as the default handler for. |
| 243 static bool MakeChromeDefaultProtocolClient(BrowserDistribution* dist, | 243 static bool MakeChromeDefaultProtocolClient(BrowserDistribution* dist, |
| 244 const string16& chrome_exe, | 244 const string16& chrome_exe, |
| 245 const string16& protocol); | 245 const string16& protocol); |
| 246 | 246 |
| 247 // This method adds Chrome to the list that shows up in Add/Remove Programs-> | 247 // This method first checks if Chrome is fully registered (as outlined below) |
|
grt (UTC plus 2)
2012/06/08 18:01:21
Please begin the comment with what the function do
gab
2012/06/11 16:19:55
Done.
| |
| 248 // Set Program Access and Defaults and also creates Chrome ProgIds under | 248 // on Windows. If it is, this method is a no-op; if it isn't, this method |
| 249 // Software\Classes. This method requires write access to HKLM so is just | 249 // registers Chrome so that it shows up in the list of Default Programs with |
| 250 // best effort deal. If write to HKLM fails and elevate_if_not_admin is true, | 250 // the protocols and file types it can handle by default (ref: |
| 251 // this method will: | 251 // ShellUtil::kPotentialProtocolAssociations + ShellUtil::kFileAssociations). |
| 252 // - add the ProgId entries to HKCU on XP. HKCU entries will not make | 252 // TODO(gab): This should be ShellUtil::kBrowserProtocolAssociations (i.e. not |
|
grt (UTC plus 2)
2012/06/08 18:01:21
Avoid implementation details like this in doc comm
gab
2012/06/11 16:19:55
Done.
| |
| 253 // Chrome show in Set Program Access and Defaults but they are still useful | 253 // ShellUtil::kPotentialProtocolAssociations) once http://crbug.com/122756 is |
| 254 // because we can make Chrome run when user clicks on http link or html | 254 // fixed. |
| 255 // file. | 255 // This method requires write access to HKLM so is just a best effort deal. |
| 256 // - will try to launch setup.exe with admin priviledges on Vista to do | 256 // If write to HKLM fails and: |
| 257 // these tasks. Users will see standard Vista elevation prompt and if they | 257 // - elevate_if_not_admin is true (and we are on Vista and above): |
| 258 // enter the right credentials, the write operation will work. | 258 // this method will try to launch setup.exe with admin priviledges (by |
| 259 // prompting the user with a UAC) to do these tasks. | |
| 260 // - elevate_if_not_admin is false (or we are on XP): | |
| 261 // add the ProgId entries to HKCU. These entries will not make Chrome show | |
| 262 // in Set Program Access and Defaults but they are still useful because we | |
| 263 // can make Chrome run when user clicks on http link or html file. | |
| 259 // Currently elevate_if_not_admin is true only when user tries to make Chrome | 264 // Currently elevate_if_not_admin is true only when user tries to make Chrome |
| 260 // default browser (through the UI or through installer options) and Chrome | 265 // default browser (through the UI or through installer options). |
| 261 // is not registered on the machine. | |
| 262 // | 266 // |
| 263 // |chrome_exe| full path to chrome.exe. | 267 // |chrome_exe| full path to chrome.exe. |
| 264 // |unique_suffix| Optional input. If given, this function appends the value | 268 // |unique_suffix| Optional input. If given, this function appends the value |
| 265 // to default browser entries names that it creates in the registry. | 269 // to default browser entries names that it creates in the registry. |
| 270 // Currently, this is only used to continue an install with the same suffix | |
| 271 // when elevating and calling setup.exe with admin privileges as described | |
| 272 // above. | |
| 266 // |elevate_if_not_admin| if true will make this method try alternate methods | 273 // |elevate_if_not_admin| if true will make this method try alternate methods |
| 267 // as described above. | 274 // as described above. |
| 275 // | |
| 276 // Returns true if Chrome is successfully registered (or already registered). | |
| 268 static bool RegisterChromeBrowser(BrowserDistribution* dist, | 277 static bool RegisterChromeBrowser(BrowserDistribution* dist, |
| 269 const string16& chrome_exe, | 278 const string16& chrome_exe, |
| 270 const string16& unique_suffix, | 279 const string16& unique_suffix, |
| 271 bool elevate_if_not_admin); | 280 bool elevate_if_not_admin); |
| 272 | 281 |
| 273 // This method declares to Windows that Chrome is capable of handling the | 282 // This method declares to Windows that Chrome is capable of handling the |
| 274 // given protocol. This function will call the RegisterChromeBrowser function | 283 // given protocol. This function will call the RegisterChromeBrowser function |
| 275 // to register with Windows as capable of handling the protocol, if it isn't | 284 // to register with Windows as capable of handling the protocol, if it isn't |
| 276 // currently registered as capable. | 285 // currently registered as capable. |
| 277 // Declaring the capability of handling a protocol is necessary to register | 286 // Declaring the capability of handling a protocol is necessary to register |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 344 const string16& icon_path, | 353 const string16& icon_path, |
| 345 int icon_index, | 354 int icon_index, |
| 346 uint32 options); | 355 uint32 options); |
| 347 | 356 |
| 348 private: | 357 private: |
| 349 DISALLOW_COPY_AND_ASSIGN(ShellUtil); | 358 DISALLOW_COPY_AND_ASSIGN(ShellUtil); |
| 350 }; | 359 }; |
| 351 | 360 |
| 352 | 361 |
| 353 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ | 362 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ |
| OLD | NEW |