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