| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_FRAME_MODULE_UTILS_H_ | 5 #ifndef CHROME_FRAME_DLL_REDIRECTOR_H_ |
| 6 #define CHROME_FRAME_MODULE_UTILS_H_ | 6 #define CHROME_FRAME_DLL_REDIRECTOR_H_ |
| 7 | 7 |
| 8 #include <ObjBase.h> | 8 #include <ObjBase.h> |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #include <string> |
| 10 | 11 |
| 11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/singleton.h" | 14 #include "base/memory/singleton.h" |
| 14 #include "base/shared_memory.h" | 15 #include "base/shared_memory.h" |
| 15 | 16 |
| 16 // Forward | 17 // Forward |
| 17 namespace ATL { | 18 namespace ATL { |
| 18 class CSecurityAttributes; | 19 class CSecurityAttributes; |
| 19 } | 20 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 42 // on the system. If this succeeds, return true. If it fails, it returns | 43 // on the system. If this succeeds, return true. If it fails, it returns |
| 43 // false meaning that there is another version already loaded somewhere and | 44 // false meaning that there is another version already loaded somewhere and |
| 44 // the caller should delegate to that version instead. | 45 // the caller should delegate to that version instead. |
| 45 bool DllRedirector::RegisterAsFirstCFModule(); | 46 bool DllRedirector::RegisterAsFirstCFModule(); |
| 46 | 47 |
| 47 // Unregisters the well known window class if we registered it earlier. | 48 // Unregisters the well known window class if we registered it earlier. |
| 48 // This is intended to be called from DllMain under PROCESS_DETACH. | 49 // This is intended to be called from DllMain under PROCESS_DETACH. |
| 49 void DllRedirector::UnregisterAsFirstCFModule(); | 50 void DllRedirector::UnregisterAsFirstCFModule(); |
| 50 | 51 |
| 51 // Helper function to return the DllGetClassObject function pointer from | 52 // Helper function to return the DllGetClassObject function pointer from |
| 52 // the given module. On success, the return value is non-null and module | 53 // the given module. This function will return NULL unless |
| 53 // will have had its reference count incremented. | 54 // RegisterAsFirstCFModule has been called first and returned false |
| 55 // indicating that another module was first in. |
| 56 // |
| 57 // On success, the return value is non-null and the first-in module will have |
| 58 // had its reference count incremented. |
| 54 LPFNGETCLASSOBJECT GetDllGetClassObjectPtr(); | 59 LPFNGETCLASSOBJECT GetDllGetClassObjectPtr(); |
| 55 | 60 |
| 56 protected: | 61 protected: |
| 57 DllRedirector(); | 62 DllRedirector(); |
| 58 friend struct DefaultSingletonTraits<DllRedirector>; | 63 friend struct DefaultSingletonTraits<DllRedirector>; |
| 59 | 64 |
| 60 // Constructor used for tests. | 65 // Constructor used for tests. |
| 61 explicit DllRedirector(const char* shared_memory_name); | 66 explicit DllRedirector(const char* shared_memory_name); |
| 62 | 67 |
| 63 // Returns an HMODULE to the version of the module that should be loaded. | 68 // Returns an HMODULE to the version of the module that should be loaded. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 94 HMODULE first_module_handle_; | 99 HMODULE first_module_handle_; |
| 95 | 100 |
| 96 // Used for tests to override the name of the shared memory segment. | 101 // Used for tests to override the name of the shared memory segment. |
| 97 std::string shared_memory_name_; | 102 std::string shared_memory_name_; |
| 98 | 103 |
| 99 friend class ModuleUtilsTest; | 104 friend class ModuleUtilsTest; |
| 100 | 105 |
| 101 DISALLOW_COPY_AND_ASSIGN(DllRedirector); | 106 DISALLOW_COPY_AND_ASSIGN(DllRedirector); |
| 102 }; | 107 }; |
| 103 | 108 |
| 104 #endif // CHROME_FRAME_MODULE_UTILS_H_ | 109 #endif // CHROME_FRAME_DLL_REDIRECTOR_H_ |
| OLD | NEW |