| 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 // 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 #include <objbase.h> |
| 11 | 12 |
| 12 #include "base/at_exit.h" | 13 #include "base/at_exit.h" |
| 13 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 14 #include "base/file_util.h" | 15 #include "base/file_util.h" |
| 15 #include "base/file_version_info.h" | 16 #include "base/file_version_info.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" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // static T::UpdateRegistry() methods directly, which doesn't allow | 167 // static T::UpdateRegistry() methods directly, which doesn't allow |
| 167 // pMapEntries to be passed through :-( | 168 // pMapEntries to be passed through :-( |
| 168 if (do_system_registration_) { | 169 if (do_system_registration_) { |
| 169 hr = registrar->AddReplacement(L"HIVE", L"HKLM"); | 170 hr = registrar->AddReplacement(L"HIVE", L"HKLM"); |
| 170 } else { | 171 } else { |
| 171 hr = registrar->AddReplacement(L"HIVE", L"HKCU"); | 172 hr = registrar->AddReplacement(L"HIVE", L"HKCU"); |
| 172 } | 173 } |
| 173 DCHECK(SUCCEEDED(hr)); | 174 DCHECK(SUCCEEDED(hr)); |
| 174 } | 175 } |
| 175 | 176 |
| 177 if (SUCCEEDED(hr)) { |
| 178 // Add the Chrome Frame CLSID. |
| 179 wchar_t cf_clsid[64]; |
| 180 StringFromGUID2(CLSID_ChromeFrame, &cf_clsid[0], arraysize(cf_clsid)); |
| 181 hr = registrar->AddReplacement(L"CHROME_FRAME_CLSID", &cf_clsid[0]); |
| 182 } |
| 183 |
| 176 return hr; | 184 return hr; |
| 177 } | 185 } |
| 178 | 186 |
| 179 // See comments in AddCommonRGSReplacements | 187 // See comments in AddCommonRGSReplacements |
| 180 bool do_system_registration_; | 188 bool do_system_registration_; |
| 181 }; | 189 }; |
| 182 | 190 |
| 183 ChromeTabModule _AtlModule; | 191 ChromeTabModule _AtlModule; |
| 184 | 192 |
| 185 base::AtExitManager* g_exit_manager = NULL; | 193 base::AtExitManager* g_exit_manager = NULL; |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 | 600 |
| 593 HRESULT RegisterActiveX(bool reg, bool is_system) { | 601 HRESULT RegisterActiveX(bool reg, bool is_system) { |
| 594 // We have to call the static T::UpdateRegistry function instead of | 602 // We have to call the static T::UpdateRegistry function instead of |
| 595 // _AtlModule.UpdateRegistryFromResourceS(IDR_CHROMEFRAME_ACTIVEX, reg) | 603 // _AtlModule.UpdateRegistryFromResourceS(IDR_CHROMEFRAME_ACTIVEX, reg) |
| 596 // because there is specific OLEMISC replacement. | 604 // because there is specific OLEMISC replacement. |
| 597 return ChromeFrameActivex::UpdateRegistry(reg); | 605 return ChromeFrameActivex::UpdateRegistry(reg); |
| 598 } | 606 } |
| 599 | 607 |
| 600 HRESULT RegisterElevationPolicy(bool reg, bool is_system) { | 608 HRESULT RegisterElevationPolicy(bool reg, bool is_system) { |
| 601 HRESULT hr = S_OK; | 609 HRESULT hr = S_OK; |
| 602 if (reg && base::win::GetVersion() >= base::win::VERSION_VISTA) { | 610 if (base::win::GetVersion() >= base::win::VERSION_VISTA) { |
| 603 // Register the elevation policy. This must succeed for Chrome Frame to | 611 // Register the elevation policy. This must succeed for Chrome Frame to |
| 604 // be able launch Chrome when running in low-integrity IE. | 612 // be able launch Chrome when running in low-integrity IE. |
| 605 // Note that this is not done on unregistration, the installer will | 613 hr = _AtlModule.UpdateRegistryFromResourceS(IDR_CHROMEFRAME_ELEVATION, reg); |
| 606 // explicitly remove the policy on uninstall. | |
| 607 hr = _AtlModule.UpdateRegistryFromResourceS(IDR_CHROMEFRAME_ELEVATION, | |
| 608 reg); | |
| 609 if (SUCCEEDED(hr)) { | 614 if (SUCCEEDED(hr)) { |
| 610 hr = RefreshElevationPolicy(); | 615 hr = RefreshElevationPolicy(); |
| 611 } | 616 } |
| 612 } | 617 } |
| 613 return hr; | 618 return hr; |
| 614 } | 619 } |
| 615 | 620 |
| 616 HRESULT RegisterProtocol(bool reg, bool is_system) { | 621 HRESULT RegisterProtocol(bool reg, bool is_system) { |
| 617 return _AtlModule.UpdateRegistryFromResourceS(IDR_CHROMEPROTOCOL, reg); | 622 return _AtlModule.UpdateRegistryFromResourceS(IDR_CHROMEPROTOCOL, reg); |
| 618 } | 623 } |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 HRESULT hr = CustomRegistration(ALL, FALSE, false); | 916 HRESULT hr = CustomRegistration(ALL, FALSE, false); |
| 912 return hr; | 917 return hr; |
| 913 } | 918 } |
| 914 | 919 |
| 915 // Object entries go here instead of with each object, so that we can move | 920 // Object entries go here instead of with each object, so that we can move |
| 916 // the objects to a lib. Also reduces magic. | 921 // the objects to a lib. Also reduces magic. |
| 917 OBJECT_ENTRY_AUTO(CLSID_ChromeFrameBHO, Bho) | 922 OBJECT_ENTRY_AUTO(CLSID_ChromeFrameBHO, Bho) |
| 918 OBJECT_ENTRY_AUTO(__uuidof(ChromeActiveDocument), ChromeActiveDocument) | 923 OBJECT_ENTRY_AUTO(__uuidof(ChromeActiveDocument), ChromeActiveDocument) |
| 919 OBJECT_ENTRY_AUTO(__uuidof(ChromeFrame), ChromeFrameActivex) | 924 OBJECT_ENTRY_AUTO(__uuidof(ChromeFrame), ChromeFrameActivex) |
| 920 OBJECT_ENTRY_AUTO(__uuidof(ChromeProtocol), ChromeProtocol) | 925 OBJECT_ENTRY_AUTO(__uuidof(ChromeProtocol), ChromeProtocol) |
| OLD | NEW |