Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: chrome/installer/util/shell_util.cc

Issue 3836005: Move pe_image and registry from base to base/win and use the namespace. It re... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 14
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/file_path.h" 16 #include "base/file_path.h"
17 #include "base/file_util.h" 17 #include "base/file_util.h"
18 #include "base/logging.h" 18 #include "base/logging.h"
19 #include "base/registry.h"
20 #include "base/scoped_ptr.h" 19 #include "base/scoped_ptr.h"
21 #include "base/stl_util-inl.h" 20 #include "base/stl_util-inl.h"
22 #include "base/string_number_conversions.h" 21 #include "base/string_number_conversions.h"
23 #include "base/string_split.h" 22 #include "base/string_split.h"
24 #include "base/string_util.h" 23 #include "base/string_util.h"
25 #include "base/utf_string_conversions.h" 24 #include "base/utf_string_conversions.h"
26 #include "base/values.h" 25 #include "base/values.h"
26 #include "base/win/registry.h"
27 #include "base/win/windows_version.h" 27 #include "base/win/windows_version.h"
28 #include "chrome/common/chrome_constants.h" 28 #include "chrome/common/chrome_constants.h"
29 #include "chrome/common/chrome_switches.h" 29 #include "chrome/common/chrome_switches.h"
30 #include "chrome/installer/util/browser_distribution.h" 30 #include "chrome/installer/util/browser_distribution.h"
31 #include "chrome/installer/util/install_util.h" 31 #include "chrome/installer/util/install_util.h"
32 #include "chrome/installer/util/master_preferences.h" 32 #include "chrome/installer/util/master_preferences.h"
33 33
34 #include "installer_util_strings.h" 34 #include "installer_util_strings.h"
35 35
36 using base::win::RegKey;
37
36 namespace { 38 namespace {
37 39
38 // This class represents a single registry entry. The objective is to 40 // This class represents a single registry entry. The objective is to
39 // encapsulate all the registry entries required for registering Chrome at one 41 // encapsulate all the registry entries required for registering Chrome at one
40 // place. This class can not be instantiated outside the class and the objects 42 // place. This class can not be instantiated outside the class and the objects
41 // of this class type can be obtained only by calling a static method of this 43 // of this class type can be obtained only by calling a static method of this
42 // class. 44 // class.
43 class RegistryEntry { 45 class RegistryEntry {
44 public: 46 public:
45 // This method returns a list of all the registry entries that 47 // This method returns a list of all the registry entries that
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 *path = qlaunch; 565 *path = qlaunch;
564 } 566 }
565 file_util::AppendToPath(path, kQuickLaunchPath); 567 file_util::AppendToPath(path, kQuickLaunchPath);
566 return true; 568 return true;
567 } 569 }
568 570
569 void ShellUtil::GetRegisteredBrowsers(std::map<std::wstring, 571 void ShellUtil::GetRegisteredBrowsers(std::map<std::wstring,
570 std::wstring>* browsers) { 572 std::wstring>* browsers) {
571 std::wstring base_key(ShellUtil::kRegStartMenuInternet); 573 std::wstring base_key(ShellUtil::kRegStartMenuInternet);
572 HKEY root = HKEY_LOCAL_MACHINE; 574 HKEY root = HKEY_LOCAL_MACHINE;
573 for (RegistryKeyIterator iter(root, base_key.c_str()); iter.Valid(); ++iter) { 575 for (base::win::RegistryKeyIterator iter(root, base_key.c_str());
576 iter.Valid(); ++iter) {
574 std::wstring key = base_key + L"\\" + iter.Name(); 577 std::wstring key = base_key + L"\\" + iter.Name();
575 RegKey capabilities(root, (key + L"\\Capabilities").c_str(), KEY_READ); 578 RegKey capabilities(root, (key + L"\\Capabilities").c_str(), KEY_READ);
576 std::wstring name; 579 std::wstring name;
577 if (!capabilities.Valid() || 580 if (!capabilities.Valid() ||
578 !capabilities.ReadValue(L"ApplicationName", &name)) { 581 !capabilities.ReadValue(L"ApplicationName", &name)) {
579 RegKey base_key(root, key.c_str(), KEY_READ); 582 RegKey base_key(root, key.c_str(), KEY_READ);
580 if (!base_key.ReadValue(L"", &name)) 583 if (!base_key.ReadValue(L"", &name))
581 continue; 584 continue;
582 } 585 }
583 RegKey install_info(root, (key + L"\\InstallInfo").c_str(), KEY_READ); 586 RegKey install_info(root, (key + L"\\InstallInfo").c_str(), KEY_READ);
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 chrome_exe.c_str(), // target 803 chrome_exe.c_str(), // target
801 shortcut.c_str(), // shortcut 804 shortcut.c_str(), // shortcut
802 chrome_path.c_str(), // working dir 805 chrome_path.c_str(), // working dir
803 NULL, // arguments 806 NULL, // arguments
804 description.c_str(), // description 807 description.c_str(), // description
805 chrome_exe.c_str(), // icon file 808 chrome_exe.c_str(), // icon file
806 icon_index, // icon index 809 icon_index, // icon index
807 dist->GetBrowserAppId().c_str()); // app id 810 dist->GetBrowserAppId().c_str()); // app id
808 } 811 }
809 } 812 }
OLDNEW
« no previous file with comments | « chrome/installer/util/set_reg_value_work_item_unittest.cc ('k') | chrome/installer/util/work_item_list_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698