| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 static bool ShowMakeChromeDefaultSystemUI(BrowserDistribution* dist, | 246 static bool ShowMakeChromeDefaultSystemUI(BrowserDistribution* dist, |
| 247 const string16& chrome_exe); | 247 const string16& chrome_exe); |
| 248 | 248 |
| 249 // Make Chrome the default application for a protocol. | 249 // Make Chrome the default application for a protocol. |
| 250 // chrome_exe: The chrome.exe path to register as default browser. | 250 // chrome_exe: The chrome.exe path to register as default browser. |
| 251 // protocol: The protocol to register as the default handler for. | 251 // protocol: The protocol to register as the default handler for. |
| 252 static bool MakeChromeDefaultProtocolClient(BrowserDistribution* dist, | 252 static bool MakeChromeDefaultProtocolClient(BrowserDistribution* dist, |
| 253 const string16& chrome_exe, | 253 const string16& chrome_exe, |
| 254 const string16& protocol); | 254 const string16& protocol); |
| 255 | 255 |
| 256 // This method adds Chrome to the list that shows up in Add/Remove Programs-> | 256 // Registers Chrome as a potential default browser and handler for filetypes |
| 257 // Set Program Access and Defaults and also creates Chrome ProgIds under | 257 // and protocols. |
| 258 // Software\Classes. This method requires write access to HKLM so is just | 258 // If Chrome is already registered, this method is a no-op. |
| 259 // best effort deal. If write to HKLM fails and elevate_if_not_admin is true, | 259 // This method requires write access to HKLM so is just a best effort deal. |
| 260 // this method will: | 260 // If write to HKLM fails and: |
| 261 // - add the ProgId entries to HKCU on XP. HKCU entries will not make | 261 // - |elevate_if_not_admin| is true (and OS is Vista or above): |
| 262 // Chrome show in Set Program Access and Defaults but they are still useful | 262 // tries to launch setup.exe with admin priviledges (by prompting the user |
| 263 // because we can make Chrome run when user clicks on http link or html | 263 // with a UAC) to do these tasks. |
| 264 // file. | 264 // - |elevate_if_not_admin| is false (or OS is XP): |
| 265 // - will try to launch setup.exe with admin priviledges on Vista to do | 265 // adds the ProgId entries to HKCU. These entries will not make Chrome show |
| 266 // these tasks. Users will see standard Vista elevation prompt and if they | 266 // in Default Programs but they are still useful because Chrome can be |
| 267 // enter the right credentials, the write operation will work. | 267 // registered to run when the user clicks on an http link or an html file. |
| 268 // Currently elevate_if_not_admin is true only when user tries to make Chrome | |
| 269 // default browser (through the UI or through installer options) and Chrome | |
| 270 // is not registered on the machine. | |
| 271 // | 268 // |
| 272 // |chrome_exe| full path to chrome.exe. | 269 // |chrome_exe| full path to chrome.exe. |
| 273 // |unique_suffix| Optional input. If given, this function appends the value | 270 // |unique_suffix| Optional input. If given, this function appends the value |
| 274 // to default browser entries names that it creates in the registry. | 271 // to default browser entries names that it creates in the registry. |
| 272 // Currently, this is only used to continue an install with the same suffix |
| 273 // when elevating and calling setup.exe with admin privileges as described |
| 274 // above. |
| 275 // |elevate_if_not_admin| if true will make this method try alternate methods | 275 // |elevate_if_not_admin| if true will make this method try alternate methods |
| 276 // as described above. | 276 // as described above. This should only be true when following a user action |
| 277 // (e.g. "Make Chrome Default") as it allows this method to UAC. |
| 278 // |
| 279 // Returns true if Chrome is successfully registered (or already registered). |
| 277 static bool RegisterChromeBrowser(BrowserDistribution* dist, | 280 static bool RegisterChromeBrowser(BrowserDistribution* dist, |
| 278 const string16& chrome_exe, | 281 const string16& chrome_exe, |
| 279 const string16& unique_suffix, | 282 const string16& unique_suffix, |
| 280 bool elevate_if_not_admin); | 283 bool elevate_if_not_admin); |
| 281 | 284 |
| 282 // This method declares to Windows that Chrome is capable of handling the | 285 // This method declares to Windows that Chrome is capable of handling the |
| 283 // given protocol. This function will call the RegisterChromeBrowser function | 286 // given protocol. This function will call the RegisterChromeBrowser function |
| 284 // to register with Windows as capable of handling the protocol, if it isn't | 287 // to register with Windows as capable of handling the protocol, if it isn't |
| 285 // currently registered as capable. | 288 // currently registered as capable. |
| 286 // Declaring the capability of handling a protocol is necessary to register | 289 // Declaring the capability of handling a protocol is necessary to register |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 const string16& icon_path, | 356 const string16& icon_path, |
| 354 int icon_index, | 357 int icon_index, |
| 355 uint32 options); | 358 uint32 options); |
| 356 | 359 |
| 357 private: | 360 private: |
| 358 DISALLOW_COPY_AND_ASSIGN(ShellUtil); | 361 DISALLOW_COPY_AND_ASSIGN(ShellUtil); |
| 359 }; | 362 }; |
| 360 | 363 |
| 361 | 364 |
| 362 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ | 365 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ |
| OLD | NEW |