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" |
11 | 11 |
12 #include <windows.h> | 12 #include <windows.h> |
13 #include <shlobj.h> | 13 #include <shlobj.h> |
14 #include <shobjidl.h> | 14 #include <shobjidl.h> |
15 | 15 |
16 #include <limits> | 16 #include <limits> |
17 #include <string> | 17 #include <string> |
| 18 #include <utility> |
18 | 19 |
19 #include "base/bind.h" | 20 #include "base/bind.h" |
20 #include "base/command_line.h" | 21 #include "base/command_line.h" |
21 #include "base/files/file_enumerator.h" | 22 #include "base/files/file_enumerator.h" |
22 #include "base/files/file_path.h" | 23 #include "base/files/file_path.h" |
23 #include "base/files/file_util.h" | 24 #include "base/files/file_util.h" |
24 #include "base/lazy_instance.h" | 25 #include "base/lazy_instance.h" |
25 #include "base/logging.h" | 26 #include "base/logging.h" |
26 #include "base/macros.h" | 27 #include "base/macros.h" |
27 #include "base/md5.h" | 28 #include "base/md5.h" |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 268 |
268 sub_path.push_back(base::FilePath::kSeparators[0]); | 269 sub_path.push_back(base::FilePath::kSeparators[0]); |
269 sub_path.append(ShellUtil::kRegCommand); | 270 sub_path.append(ShellUtil::kRegCommand); |
270 | 271 |
271 // <root hkey>\Software\Classes\<app_id>\.exe\shell\<verb>\command | 272 // <root hkey>\Software\Classes\<app_id>\.exe\shell\<verb>\command |
272 entries.push_back(new RegistryEntry(sub_path, delegate_command)); | 273 entries.push_back(new RegistryEntry(sub_path, delegate_command)); |
273 entries.push_back(new RegistryEntry( | 274 entries.push_back(new RegistryEntry( |
274 sub_path, ShellUtil::kRegDelegateExecute, app_info.delegate_clsid)); | 275 sub_path, ShellUtil::kRegDelegateExecute, app_info.delegate_clsid)); |
275 } | 276 } |
276 | 277 |
277 return entries.Pass(); | 278 return std::move(entries); |
278 } | 279 } |
279 | 280 |
280 // Gets the registry entries to register an application in the Windows registry. | 281 // Gets the registry entries to register an application in the Windows registry. |
281 // |app_info| provides all of the information needed. | 282 // |app_info| provides all of the information needed. |
282 void GetProgIdEntries(const ApplicationInfo& app_info, | 283 void GetProgIdEntries(const ApplicationInfo& app_info, |
283 ScopedVector<RegistryEntry>* entries) { | 284 ScopedVector<RegistryEntry>* entries) { |
284 // Basic sanity checks. | 285 // Basic sanity checks. |
285 DCHECK(!app_info.prog_id.empty()); | 286 DCHECK(!app_info.prog_id.empty()); |
286 DCHECK_NE(L'.', app_info.prog_id[0]); | 287 DCHECK_NE(L'.', app_info.prog_id[0]); |
287 | 288 |
(...skipping 2049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2337 itr != entries.end(); ++itr) | 2338 itr != entries.end(); ++itr) |
2338 (*itr)->AddToWorkItemList(root, items.get()); | 2339 (*itr)->AddToWorkItemList(root, items.get()); |
2339 | 2340 |
2340 // Apply all the registry changes and if there is a problem, rollback | 2341 // Apply all the registry changes and if there is a problem, rollback |
2341 if (!items->Do()) { | 2342 if (!items->Do()) { |
2342 items->Rollback(); | 2343 items->Rollback(); |
2343 return false; | 2344 return false; |
2344 } | 2345 } |
2345 return true; | 2346 return true; |
2346 } | 2347 } |
OLD | NEW |