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/lock.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/logging_win.h" | 18 #include "base/logging_win.h" |
19 #include "base/path_service.h" | 19 #include "base/path_service.h" |
20 #include "base/registry.h" | 20 #include "base/registry.h" |
21 #include "base/string_number_conversions.h" | 21 #include "base/string_number_conversions.h" |
22 #include "base/string_piece.h" | 22 #include "base/string_piece.h" |
23 #include "base/string_util.h" | 23 #include "base/string_util.h" |
24 #include "base/sys_string_conversions.h" | 24 #include "base/sys_string_conversions.h" |
25 #include "base/win_util.h" | 25 #include "base/win/windows_version.h" |
26 #include "chrome/common/chrome_constants.h" | 26 #include "chrome/common/chrome_constants.h" |
27 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
28 #include "chrome/installer/util/google_update_settings.h" | 28 #include "chrome/installer/util/google_update_settings.h" |
29 #include "grit/chrome_frame_resources.h" | 29 #include "grit/chrome_frame_resources.h" |
30 #include "chrome_frame/bho.h" | 30 #include "chrome_frame/bho.h" |
31 #include "chrome_frame/chrome_active_document.h" | 31 #include "chrome_frame/chrome_active_document.h" |
32 #include "chrome_frame/chrome_frame_activex.h" | 32 #include "chrome_frame/chrome_frame_activex.h" |
33 #include "chrome_frame/chrome_frame_automation.h" | 33 #include "chrome_frame/chrome_frame_automation.h" |
34 #include "chrome_frame/exception_barrier.h" | 34 #include "chrome_frame/exception_barrier.h" |
35 #include "chrome_frame/chrome_frame_reporting.h" | 35 #include "chrome_frame/chrome_frame_reporting.h" |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 // - Heavy system memory usage after reboot will nullify the benefits | 293 // - Heavy system memory usage after reboot will nullify the benefits |
294 // but the user will still pay the cost. | 294 // but the user will still pay the cost. |
295 // - Overall the time saved will always be less than total time spent | 295 // - Overall the time saved will always be less than total time spent |
296 // paging in chrome | 296 // paging in chrome |
297 // - We are not sure when the chrome 'warm up' will age out from the | 297 // - We are not sure when the chrome 'warm up' will age out from the |
298 // boot prefetch file. | 298 // boot prefetch file. |
299 // | 299 // |
300 // The idea here is to try this out on chrome frame dev channel | 300 // The idea here is to try this out on chrome frame dev channel |
301 // and see if it produces a significant drift in startup numbers. | 301 // and see if it produces a significant drift in startup numbers. |
302 HRESULT SetupRunOnce() { | 302 HRESULT SetupRunOnce() { |
303 if (win_util::GetWinVersion() >= win_util::WINVERSION_VISTA) | 303 if (base::win::GetVersion() >= base::win::VERSION_VISTA) |
304 return S_OK; | 304 return S_OK; |
305 | 305 |
306 std::wstring channel_name; | 306 std::wstring channel_name; |
307 if (!GoogleUpdateSettings::GetChromeChannel(true, &channel_name) || | 307 if (!GoogleUpdateSettings::GetChromeChannel(true, &channel_name) || |
308 (0 != lstrcmpiW(L"dev", channel_name.c_str()))) { | 308 (0 != lstrcmpiW(L"dev", channel_name.c_str()))) { |
309 return S_OK; | 309 return S_OK; |
310 } | 310 } |
311 | 311 |
312 HKEY hive = HKEY_CURRENT_USER; | 312 HKEY hive = HKEY_CURRENT_USER; |
313 if (IsSystemProcess()) { | 313 if (IsSystemProcess()) { |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 result = key.DeleteValue(L"ChromeTab.ChromeActiveDocument"); | 692 result = key.DeleteValue(L"ChromeTab.ChromeActiveDocument"); |
693 result = key.DeleteValue(L"ChromeTab.ChromeActiveDocument.1") && result; | 693 result = key.DeleteValue(L"ChromeTab.ChromeActiveDocument.1") && result; |
694 } | 694 } |
695 | 695 |
696 return result; | 696 return result; |
697 } | 697 } |
698 | 698 |
699 bool RegisterSecuredMimeHandler(bool enable, bool is_system) { | 699 bool RegisterSecuredMimeHandler(bool enable, bool is_system) { |
700 if (!is_system) { | 700 if (!is_system) { |
701 return SetOrDeleteMimeHandlerKey(enable, HKEY_CURRENT_USER); | 701 return SetOrDeleteMimeHandlerKey(enable, HKEY_CURRENT_USER); |
702 } else if (win_util::GetWinVersion() < win_util::WINVERSION_VISTA) { | 702 } else if (base::win::GetVersion() < base::win::VERSION_VISTA) { |
703 return SetOrDeleteMimeHandlerKey(enable, HKEY_LOCAL_MACHINE); | 703 return SetOrDeleteMimeHandlerKey(enable, HKEY_LOCAL_MACHINE); |
704 } | 704 } |
705 | 705 |
706 std::wstring mime_key = kInternetSettings; | 706 std::wstring mime_key = kInternetSettings; |
707 mime_key.append(L"\\Secure Mime Handlers"); | 707 mime_key.append(L"\\Secure Mime Handlers"); |
708 std::wstring backup_key = kInternetSettings; | 708 std::wstring backup_key = kInternetSettings; |
709 backup_key.append(L"\\__backup_SMH__"); | 709 backup_key.append(L"\\__backup_SMH__"); |
710 std::wstring object_name = L"MACHINE\\"; | 710 std::wstring object_name = L"MACHINE\\"; |
711 object_name.append(mime_key); | 711 object_name.append(mime_key); |
712 | 712 |
(...skipping 21 matching lines...) Expand all Loading... |
734 sd.GetDacl(&new_dacl); | 734 sd.GetDacl(&new_dacl); |
735 new_dacl.AddAllowedAce(token_.GetUser(), GENERIC_WRITE | GENERIC_READ); | 735 new_dacl.AddAllowedAce(token_.GetUser(), GENERIC_WRITE | GENERIC_READ); |
736 if (AtlSetDacl(object_name.c_str(), SE_REGISTRY_KEY, new_dacl)) { | 736 if (AtlSetDacl(object_name.c_str(), SE_REGISTRY_KEY, new_dacl)) { |
737 result = SetOrDeleteMimeHandlerKey(enable, HKEY_LOCAL_MACHINE); | 737 result = SetOrDeleteMimeHandlerKey(enable, HKEY_LOCAL_MACHINE); |
738 } | 738 } |
739 } | 739 } |
740 | 740 |
741 backup.RestoreSecurity(object_name.c_str()); | 741 backup.RestoreSecurity(object_name.c_str()); |
742 return result; | 742 return result; |
743 } | 743 } |
OLD | NEW |