OLD | NEW |
1 // Copyright (c) 2011 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 // chrome_tab.cc : Implementation of DLL Exports. | 5 // chrome_tab.cc : Implementation of DLL Exports. |
6 | 6 |
7 // Need to include this before the ATL headers below. | 7 // Need to include this before the ATL headers below. |
8 #include "chrome_frame/chrome_tab.h" | 8 #include "chrome_frame/chrome_tab.h" |
9 | 9 |
10 #include <atlsecurity.h> | 10 #include <atlsecurity.h> |
11 #include <objbase.h> | 11 #include <objbase.h> |
12 | 12 |
13 #include "base/at_exit.h" | 13 #include "base/at_exit.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/file_util.h" | 15 #include "base/file_util.h" |
16 #include "base/file_version_info.h" | 16 #include "base/file_version_info.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/string16.h" | 20 #include "base/string16.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/utf_string_conversions.h" |
25 #include "base/win/registry.h" | 26 #include "base/win/registry.h" |
26 #include "base/win/windows_version.h" | 27 #include "base/win/windows_version.h" |
27 #include "chrome/common/chrome_constants.h" | 28 #include "chrome/common/chrome_constants.h" |
28 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
| 30 #include "chrome/common/env_vars.h" |
29 #include "chrome/installer/util/google_update_settings.h" | 31 #include "chrome/installer/util/google_update_settings.h" |
30 #include "chrome_frame/bho.h" | 32 #include "chrome_frame/bho.h" |
31 #include "chrome_frame/chrome_active_document.h" | 33 #include "chrome_frame/chrome_active_document.h" |
32 #include "chrome_frame/chrome_frame_activex.h" | 34 #include "chrome_frame/chrome_frame_activex.h" |
33 #include "chrome_frame/chrome_frame_automation.h" | 35 #include "chrome_frame/chrome_frame_automation.h" |
34 #include "chrome_frame/chrome_frame_reporting.h" | 36 #include "chrome_frame/chrome_frame_reporting.h" |
35 #include "chrome_frame/chrome_launcher_utils.h" | 37 #include "chrome_frame/chrome_launcher_utils.h" |
36 #include "chrome_frame/chrome_protocol.h" | 38 #include "chrome_frame/chrome_protocol.h" |
37 #include "chrome_frame/dll_redirector.h" | 39 #include "chrome_frame/dll_redirector.h" |
38 #include "chrome_frame/exception_barrier.h" | 40 #include "chrome_frame/exception_barrier.h" |
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 g_exit_manager = new base::AtExitManager(); | 828 g_exit_manager = new base::AtExitManager(); |
827 CommandLine::Init(0, NULL); | 829 CommandLine::Init(0, NULL); |
828 InitializeCrashReporting(); | 830 InitializeCrashReporting(); |
829 logging::InitLogging( | 831 logging::InitLogging( |
830 NULL, | 832 NULL, |
831 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, | 833 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, |
832 logging::LOCK_LOG_FILE, | 834 logging::LOCK_LOG_FILE, |
833 logging::DELETE_OLD_LOG_FILE, | 835 logging::DELETE_OLD_LOG_FILE, |
834 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); | 836 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); |
835 | 837 |
| 838 // Log the same items as Chrome. |
| 839 logging::SetLogItems(true, // enable_process_id |
| 840 true, // enable_thread_id |
| 841 false, // enable_timestamp |
| 842 true); // enable_tickcount |
| 843 |
836 DllRedirector* dll_redirector = DllRedirector::GetInstance(); | 844 DllRedirector* dll_redirector = DllRedirector::GetInstance(); |
837 DCHECK(dll_redirector); | 845 DCHECK(dll_redirector); |
838 | 846 |
839 if (!dll_redirector->RegisterAsFirstCFModule()) { | 847 if (!dll_redirector->RegisterAsFirstCFModule()) { |
840 // Someone else was here first, try and get a pointer to their | 848 // Someone else was here first, try and get a pointer to their |
841 // DllGetClassObject export: | 849 // DllGetClassObject export: |
842 g_dll_get_class_object_redir_ptr = | 850 g_dll_get_class_object_redir_ptr = |
843 dll_redirector->GetDllGetClassObjectPtr(); | 851 dll_redirector->GetDllGetClassObjectPtr(); |
844 DCHECK(g_dll_get_class_object_redir_ptr != NULL) | 852 DCHECK(g_dll_get_class_object_redir_ptr != NULL) |
845 << "Found CF module with no DllGetClassObject export."; | 853 << "Found CF module with no DllGetClassObject export."; |
846 } | 854 } |
847 | 855 |
848 // Enable ETW logging. | 856 // Enable trace control and transport through event tracing for Windows. |
849 logging::LogEventProvider::Initialize(kChromeFrameProvider); | 857 if (::GetEnvironmentVariable(ASCIIToWide(env_vars::kEtwLogging).c_str(), |
| 858 NULL, 0)) { |
| 859 logging::LogEventProvider::Initialize(kChromeFrameProvider); |
| 860 } |
850 } else if (reason == DLL_PROCESS_DETACH) { | 861 } else if (reason == DLL_PROCESS_DETACH) { |
851 DllRedirector* dll_redirector = DllRedirector::GetInstance(); | 862 DllRedirector* dll_redirector = DllRedirector::GetInstance(); |
852 DCHECK(dll_redirector); | 863 DCHECK(dll_redirector); |
853 | 864 |
854 dll_redirector->UnregisterAsFirstCFModule(); | 865 dll_redirector->UnregisterAsFirstCFModule(); |
855 g_patch_helper.UnpatchIfNeeded(); | 866 g_patch_helper.UnpatchIfNeeded(); |
856 delete g_exit_manager; | 867 delete g_exit_manager; |
857 g_exit_manager = NULL; | 868 g_exit_manager = NULL; |
858 ShutdownCrashReporting(); | 869 ShutdownCrashReporting(); |
859 } | 870 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 HRESULT hr = CustomRegistration(ALL, FALSE, false); | 930 HRESULT hr = CustomRegistration(ALL, FALSE, false); |
920 return hr; | 931 return hr; |
921 } | 932 } |
922 | 933 |
923 // Object entries go here instead of with each object, so that we can move | 934 // Object entries go here instead of with each object, so that we can move |
924 // the objects to a lib. Also reduces magic. | 935 // the objects to a lib. Also reduces magic. |
925 OBJECT_ENTRY_AUTO(CLSID_ChromeFrameBHO, Bho) | 936 OBJECT_ENTRY_AUTO(CLSID_ChromeFrameBHO, Bho) |
926 OBJECT_ENTRY_AUTO(__uuidof(ChromeActiveDocument), ChromeActiveDocument) | 937 OBJECT_ENTRY_AUTO(__uuidof(ChromeActiveDocument), ChromeActiveDocument) |
927 OBJECT_ENTRY_AUTO(__uuidof(ChromeFrame), ChromeFrameActivex) | 938 OBJECT_ENTRY_AUTO(__uuidof(ChromeFrame), ChromeFrameActivex) |
928 OBJECT_ENTRY_AUTO(__uuidof(ChromeProtocol), ChromeProtocol) | 939 OBJECT_ENTRY_AUTO(__uuidof(ChromeProtocol), ChromeProtocol) |
OLD | NEW |