| 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 // 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/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/file_util.h" | 16 #include "base/file_util.h" |
| 17 #include "base/file_version_info.h" | 17 #include "base/file_version_info.h" |
| 18 #include "base/logging.h" | 18 #include "base/logging.h" |
| 19 #include "base/logging_win.h" | 19 #include "base/logging_win.h" |
| 20 #include "base/metrics/field_trial.h" | |
| 21 #include "base/path_service.h" | 20 #include "base/path_service.h" |
| 22 #include "base/string16.h" | 21 #include "base/string16.h" |
| 23 #include "base/string_number_conversions.h" | 22 #include "base/string_number_conversions.h" |
| 24 #include "base/string_piece.h" | 23 #include "base/string_piece.h" |
| 25 #include "base/string_util.h" | 24 #include "base/string_util.h" |
| 26 #include "base/strings/sys_string_conversions.h" | 25 #include "base/strings/sys_string_conversions.h" |
| 27 #include "base/utf_string_conversions.h" | 26 #include "base/utf_string_conversions.h" |
| 28 #include "base/win/registry.h" | 27 #include "base/win/registry.h" |
| 29 #include "base/win/windows_version.h" | 28 #include "base/win/windows_version.h" |
| 30 #include "chrome/common/chrome_constants.h" | 29 #include "chrome/common/chrome_constants.h" |
| 31 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
| 32 #include "chrome/common/metrics/entropy_provider.h" | 31 #include "chrome/common/metrics/entropy_provider.h" |
| 33 #include "chrome/installer/util/google_update_settings.h" | 32 #include "chrome/installer/util/google_update_settings.h" |
| 34 #include "chrome_frame/bho.h" | 33 #include "chrome_frame/bho.h" |
| 35 #include "chrome_frame/chrome_active_document.h" | 34 #include "chrome_frame/chrome_active_document.h" |
| 36 #include "chrome_frame/chrome_frame_activex.h" | 35 #include "chrome_frame/chrome_frame_activex.h" |
| 37 #include "chrome_frame/chrome_frame_automation.h" | 36 #include "chrome_frame/chrome_frame_automation.h" |
| 38 #include "chrome_frame/chrome_frame_reporting.h" | 37 #include "chrome_frame/chrome_frame_reporting.h" |
| 39 #include "chrome_frame/chrome_launcher_utils.h" | 38 #include "chrome_frame/chrome_launcher_utils.h" |
| 40 #include "chrome_frame/chrome_protocol.h" | 39 #include "chrome_frame/chrome_protocol.h" |
| 41 #include "chrome_frame/dll_redirector.h" | 40 #include "chrome_frame/dll_redirector.h" |
| 42 #include "chrome_frame/exception_barrier.h" | 41 #include "chrome_frame/exception_barrier.h" |
| 43 #include "chrome_frame/metrics_service.h" | |
| 44 #include "chrome_frame/pin_module.h" | 42 #include "chrome_frame/pin_module.h" |
| 45 #include "chrome_frame/resource.h" | 43 #include "chrome_frame/resource.h" |
| 46 #include "chrome_frame/utils.h" | 44 #include "chrome_frame/utils.h" |
| 47 #include "googleurl/src/url_util.h" | 45 #include "googleurl/src/url_util.h" |
| 48 #include "grit/chrome_frame_resources.h" | 46 #include "grit/chrome_frame_resources.h" |
| 49 | 47 |
| 50 using base::win::RegKey; | 48 using base::win::RegKey; |
| 51 | 49 |
| 52 namespace { | 50 namespace { |
| 53 | 51 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 // A scoper created when the module is initially locked and destroyed when it | 224 // A scoper created when the module is initially locked and destroyed when it |
| 227 // is finally unlocked. This is not a scoped_ptr since that could cause | 225 // is finally unlocked. This is not a scoped_ptr since that could cause |
| 228 // reporting to shut down at exit, which would lead to problems with the | 226 // reporting to shut down at exit, which would lead to problems with the |
| 229 // loader lock. | 227 // loader lock. |
| 230 chrome_frame::ScopedCrashReporting* crash_reporting_; | 228 chrome_frame::ScopedCrashReporting* crash_reporting_; |
| 231 }; | 229 }; |
| 232 | 230 |
| 233 ChromeTabModule _AtlModule; | 231 ChromeTabModule _AtlModule; |
| 234 | 232 |
| 235 base::AtExitManager* g_exit_manager = NULL; | 233 base::AtExitManager* g_exit_manager = NULL; |
| 236 base::FieldTrialList* g_field_trial_list = NULL; | |
| 237 | 234 |
| 238 HRESULT RefreshElevationPolicy() { | 235 HRESULT RefreshElevationPolicy() { |
| 239 const wchar_t kIEFrameDll[] = L"ieframe.dll"; | 236 const wchar_t kIEFrameDll[] = L"ieframe.dll"; |
| 240 const char kIERefreshPolicy[] = "IERefreshElevationPolicy"; | 237 const char kIERefreshPolicy[] = "IERefreshElevationPolicy"; |
| 241 HRESULT hr = E_NOTIMPL; | 238 HRESULT hr = E_NOTIMPL; |
| 242 | 239 |
| 243 // Stick an SEH in the chain to prevent the VEH from picking up on first | 240 // Stick an SEH in the chain to prevent the VEH from picking up on first |
| 244 // chance exceptions caused by loading ieframe.dll. Use the vanilla | 241 // chance exceptions caused by loading ieframe.dll. Use the vanilla |
| 245 // ExceptionBarrier to report any exceptions that do make their way to us | 242 // ExceptionBarrier to report any exceptions that do make their way to us |
| 246 // though. | 243 // though. |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 // DllGetClassObject export: | 889 // DllGetClassObject export: |
| 893 g_dll_get_class_object_redir_ptr = | 890 g_dll_get_class_object_redir_ptr = |
| 894 dll_redirector->GetDllGetClassObjectPtr(); | 891 dll_redirector->GetDllGetClassObjectPtr(); |
| 895 DCHECK(g_dll_get_class_object_redir_ptr != NULL) | 892 DCHECK(g_dll_get_class_object_redir_ptr != NULL) |
| 896 << "Found CF module with no DllGetClassObject export."; | 893 << "Found CF module with no DllGetClassObject export."; |
| 897 } | 894 } |
| 898 | 895 |
| 899 // Enable trace control and transport through event tracing for Windows. | 896 // Enable trace control and transport through event tracing for Windows. |
| 900 logging::LogEventProvider::Initialize(kChromeFrameProvider); | 897 logging::LogEventProvider::Initialize(kChromeFrameProvider); |
| 901 | 898 |
| 902 // Initialize the field test infrastructure. Must be done somewhere that | |
| 903 // can only get called once. For Chrome Frame, that is here. | |
| 904 g_field_trial_list = new base::FieldTrialList( | |
| 905 new metrics::SHA1EntropyProvider(MetricsService::GetClientID())); | |
| 906 | |
| 907 // Set a callback so that crash reporting can be pinned when the module is | 899 // Set a callback so that crash reporting can be pinned when the module is |
| 908 // pinned. | 900 // pinned. |
| 909 chrome_frame::SetPinModuleCallback(&OnPinModule); | 901 chrome_frame::SetPinModuleCallback(&OnPinModule); |
| 910 } else if (reason == DLL_PROCESS_DETACH) { | 902 } else if (reason == DLL_PROCESS_DETACH) { |
| 911 delete g_field_trial_list; | |
| 912 g_field_trial_list = NULL; | |
| 913 | |
| 914 DllRedirector* dll_redirector = DllRedirector::GetInstance(); | 903 DllRedirector* dll_redirector = DllRedirector::GetInstance(); |
| 915 DCHECK(dll_redirector); | 904 DCHECK(dll_redirector); |
| 916 dll_redirector->UnregisterAsFirstCFModule(); | 905 dll_redirector->UnregisterAsFirstCFModule(); |
| 917 | 906 |
| 918 g_patch_helper.UnpatchIfNeeded(); | 907 g_patch_helper.UnpatchIfNeeded(); |
| 919 | 908 |
| 920 delete g_exit_manager; | 909 delete g_exit_manager; |
| 921 g_exit_manager = NULL; | 910 g_exit_manager = NULL; |
| 922 } | 911 } |
| 923 return _AtlModule.DllMain(reason, reserved); | 912 return _AtlModule.DllMain(reason, reserved); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 HRESULT hr = CustomRegistration(ALL, FALSE, false); | 977 HRESULT hr = CustomRegistration(ALL, FALSE, false); |
| 989 return hr; | 978 return hr; |
| 990 } | 979 } |
| 991 | 980 |
| 992 // Object entries go here instead of with each object, so that we can move | 981 // Object entries go here instead of with each object, so that we can move |
| 993 // the objects to a lib. Also reduces magic. | 982 // the objects to a lib. Also reduces magic. |
| 994 OBJECT_ENTRY_AUTO(CLSID_ChromeFrameBHO, Bho) | 983 OBJECT_ENTRY_AUTO(CLSID_ChromeFrameBHO, Bho) |
| 995 OBJECT_ENTRY_AUTO(__uuidof(ChromeActiveDocument), ChromeActiveDocument) | 984 OBJECT_ENTRY_AUTO(__uuidof(ChromeActiveDocument), ChromeActiveDocument) |
| 996 OBJECT_ENTRY_AUTO(__uuidof(ChromeFrame), ChromeFrameActivex) | 985 OBJECT_ENTRY_AUTO(__uuidof(ChromeFrame), ChromeFrameActivex) |
| 997 OBJECT_ENTRY_AUTO(__uuidof(ChromeProtocol), ChromeProtocol) | 986 OBJECT_ENTRY_AUTO(__uuidof(ChromeProtocol), ChromeProtocol) |
| OLD | NEW |