OLD | NEW |
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 // chrome_tab.cc : Implementation of DLL Exports. | 5 // chrome_tab.cc : Implementation of DLL Exports. |
6 | 6 |
7 // Include without path to make GYP build see it. | 7 // Include without path to make GYP build see it. |
8 #include "chrome_tab.h" // NOLINT | 8 #include "chrome_tab.h" // NOLINT |
9 | 9 |
10 #include <atlsecurity.h> | 10 #include <atlsecurity.h> |
11 | 11 |
12 #include "base/at_exit.h" | 12 #include "base/at_exit.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
15 #include "base/file_version_info.h" | 15 #include "base/file_version_info.h" |
| 16 #include "base/lock.h" |
16 #include "base/logging.h" | 17 #include "base/logging.h" |
17 #include "base/logging_win.h" | 18 #include "base/logging_win.h" |
18 #include "base/path_service.h" | 19 #include "base/path_service.h" |
19 #include "base/string_number_conversions.h" | 20 #include "base/string_number_conversions.h" |
20 #include "base/string_piece.h" | 21 #include "base/string_piece.h" |
21 #include "base/string_util.h" | 22 #include "base/string_util.h" |
22 #include "base/sys_string_conversions.h" | 23 #include "base/sys_string_conversions.h" |
23 #include "base/win/registry.h" | 24 #include "base/win/registry.h" |
24 #include "base/win/windows_version.h" | 25 #include "base/win/windows_version.h" |
25 #include "chrome/common/chrome_constants.h" | 26 #include "chrome/common/chrome_constants.h" |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 HRESULT result = E_FAIL; | 304 HRESULT result = E_FAIL; |
304 | 305 |
305 std::wstring channel_name; | 306 std::wstring channel_name; |
306 if (base::win::GetVersion() < base::win::VERSION_VISTA && | 307 if (base::win::GetVersion() < base::win::VERSION_VISTA && |
307 GoogleUpdateSettings::GetChromeChannel(true, &channel_name)) { | 308 GoogleUpdateSettings::GetChromeChannel(true, &channel_name)) { |
308 std::transform(channel_name.begin(), channel_name.end(), | 309 std::transform(channel_name.begin(), channel_name.end(), |
309 channel_name.begin(), tolower); | 310 channel_name.begin(), tolower); |
310 // Use this only for the dev channel and CEEE channels. | 311 // Use this only for the dev channel and CEEE channels. |
311 if (channel_name.find(L"dev") != std::wstring::npos || | 312 if (channel_name.find(L"dev") != std::wstring::npos || |
312 channel_name.find(L"ceee") != std::wstring::npos) { | 313 channel_name.find(L"ceee") != std::wstring::npos) { |
| 314 |
313 HKEY hive = HKEY_CURRENT_USER; | 315 HKEY hive = HKEY_CURRENT_USER; |
314 if (IsSystemProcess()) { | 316 if (IsSystemProcess()) { |
315 // For system installs, our updates will be running as SYSTEM which | 317 // For system installs, our updates will be running as SYSTEM which |
316 // makes writing to a RunOnce key under HKCU not so terribly useful. | 318 // makes writing to a RunOnce key under HKCU not so terribly useful. |
317 hive = HKEY_LOCAL_MACHINE; | 319 hive = HKEY_LOCAL_MACHINE; |
318 } | 320 } |
319 | 321 |
320 RegKey run_once; | 322 RegKey run_once; |
321 if (run_once.Create(hive, kRunOnce, KEY_READ | KEY_WRITE)) { | 323 if (run_once.Create(hive, kRunOnce, KEY_READ | KEY_WRITE)) { |
322 CommandLine run_once_cmd(chrome_launcher::GetChromeExecutablePath()); | 324 CommandLine run_once_cmd(chrome_launcher::GetChromeExecutablePath()); |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 sd.GetDacl(&new_dacl); | 748 sd.GetDacl(&new_dacl); |
747 new_dacl.AddAllowedAce(token_.GetUser(), GENERIC_WRITE | GENERIC_READ); | 749 new_dacl.AddAllowedAce(token_.GetUser(), GENERIC_WRITE | GENERIC_READ); |
748 if (AtlSetDacl(object_name.c_str(), SE_REGISTRY_KEY, new_dacl)) { | 750 if (AtlSetDacl(object_name.c_str(), SE_REGISTRY_KEY, new_dacl)) { |
749 result = SetOrDeleteMimeHandlerKey(enable, HKEY_LOCAL_MACHINE); | 751 result = SetOrDeleteMimeHandlerKey(enable, HKEY_LOCAL_MACHINE); |
750 } | 752 } |
751 } | 753 } |
752 | 754 |
753 backup.RestoreSecurity(object_name.c_str()); | 755 backup.RestoreSecurity(object_name.c_str()); |
754 return result; | 756 return result; |
755 } | 757 } |
OLD | NEW |