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 defines functions that integrate Chrome in Windows shell. These | 5 // This file defines functions that integrate Chrome in Windows shell. These |
6 // functions can be used by Chrome as well as Chrome installer. All of the | 6 // functions can be used by Chrome as well as Chrome installer. All of the |
7 // work is done by the local functions defined in anonymous namespace in | 7 // work is done by the local functions defined in anonymous namespace in |
8 // this class. | 8 // this class. |
9 | 9 |
10 #include "chrome/installer/util/shell_util.h" | 10 #include "chrome/installer/util/shell_util.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 if (suffix_.empty()) { | 149 if (suffix_.empty()) { |
150 NOTREACHED(); | 150 NOTREACHED(); |
151 return false; | 151 return false; |
152 } | 152 } |
153 suffix->assign(suffix_); | 153 suffix->assign(suffix_); |
154 return true; | 154 return true; |
155 } | 155 } |
156 | 156 |
157 // This class represents a single registry entry (a key and its value). A | 157 // This class represents a single registry entry (a key and its value). A |
158 // collection of registry entries should be collected into a list and written | 158 // collection of registry entries should be collected into a list and written |
159 // atomically using a WorkItemList. This is preferred to writing to the registry | 159 // transactionally using a WorkItemList. This is preferred to writing to the |
160 // directly, because if anything goes wrong, they can be rolled back atomically. | 160 // registry directly, because if anything goes wrong, they can be rolled back. |
161 class RegistryEntry { | 161 class RegistryEntry { |
162 public: | 162 public: |
163 // A bit-field enum of places to look for this key in the Windows registry. | 163 // A bit-field enum of places to look for this key in the Windows registry. |
164 enum LookForIn { | 164 enum LookForIn { |
165 LOOK_IN_HKCU = 1 << 0, | 165 LOOK_IN_HKCU = 1 << 0, |
166 LOOK_IN_HKLM = 1 << 1, | 166 LOOK_IN_HKLM = 1 << 1, |
167 LOOK_IN_HKCU_THEN_HKLM = LOOK_IN_HKCU | LOOK_IN_HKLM, | 167 LOOK_IN_HKCU_THEN_HKLM = LOOK_IN_HKCU | LOOK_IN_HKLM, |
168 }; | 168 }; |
169 | 169 |
170 // Identifies the type of removal this RegistryEntry is flagged for, if any. | 170 // Identifies the type of removal this RegistryEntry is flagged for, if any. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 base::string16 application_name; | 205 base::string16 application_name; |
206 base::FilePath application_icon_path; | 206 base::FilePath application_icon_path; |
207 int application_icon_index; | 207 int application_icon_index; |
208 base::string16 application_description; | 208 base::string16 application_description; |
209 base::string16 publisher_name; | 209 base::string16 publisher_name; |
210 | 210 |
211 // The CLSID for the application's DelegateExecute handler. May be empty. | 211 // The CLSID for the application's DelegateExecute handler. May be empty. |
212 base::string16 delegate_clsid; | 212 base::string16 delegate_clsid; |
213 }; | 213 }; |
214 | 214 |
215 // Create a object that represent default value of a key | 215 // Create an object that represent default value of a key. |
216 RegistryEntry(const base::string16& key_path, const base::string16& value); | 216 RegistryEntry(const base::string16& key_path, const base::string16& value); |
217 | 217 |
218 // Create a object that represent a key of type REG_SZ | 218 // Create an object that represent a key of type REG_SZ. |
219 RegistryEntry(const base::string16& key_path, | 219 RegistryEntry(const base::string16& key_path, |
220 const base::string16& name, | 220 const base::string16& name, |
221 const base::string16& value); | 221 const base::string16& value); |
222 | 222 |
223 // Create a object that represent a key of integer type | 223 // Create an object that represent a key of integer type. |
224 RegistryEntry(const base::string16& key_path, | 224 RegistryEntry(const base::string16& key_path, |
225 const base::string16& name, | 225 const base::string16& name, |
226 DWORD value); | 226 DWORD value); |
227 | 227 |
228 // Returns the Windows browser client registration key for Chrome. For | 228 // Returns the Windows browser client registration key for Chrome. For |
229 // example: "Software\Clients\StartMenuInternet\Chromium[.user]". Strictly | 229 // example: "Software\Clients\StartMenuInternet\Chromium[.user]". Strictly |
230 // speaking, we should use the name of the executable (e.g., "chrome.exe"), | 230 // speaking, we should use the name of the executable (e.g., "chrome.exe"), |
231 // but that ship has sailed. The cost of switching now is re-prompting users | 231 // but that ship has sailed. The cost of switching now is re-prompting users |
232 // to make Chrome their default browser, which isn't polite. |suffix| is the | 232 // to make Chrome their default browser, which isn't polite. |suffix| is the |
233 // user-specific registration suffix; see GetUserSpecificDefaultBrowserSuffix | 233 // user-specific registration suffix; see GetUserSpecificDefaultBrowserSuffix |
(...skipping 2365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2599 base::string16 key_path(ShellUtil::kRegClasses); | 2599 base::string16 key_path(ShellUtil::kRegClasses); |
2600 key_path.push_back(base::FilePath::kSeparators[0]); | 2600 key_path.push_back(base::FilePath::kSeparators[0]); |
2601 key_path.append(prog_id); | 2601 key_path.append(prog_id); |
2602 return InstallUtil::DeleteRegistryKey( | 2602 return InstallUtil::DeleteRegistryKey( |
2603 HKEY_CURRENT_USER, key_path, WorkItem::kWow64Default); | 2603 HKEY_CURRENT_USER, key_path, WorkItem::kWow64Default); |
2604 | 2604 |
2605 // TODO(mgiuca): Remove the extension association entries. This requires that | 2605 // TODO(mgiuca): Remove the extension association entries. This requires that |
2606 // the extensions associated with a particular prog_id are stored in that | 2606 // the extensions associated with a particular prog_id are stored in that |
2607 // prog_id's key. | 2607 // prog_id's key. |
2608 } | 2608 } |
OLD | NEW |