| 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 // static T::UpdateRegistry() methods directly, which doesn't allow | 175 // static T::UpdateRegistry() methods directly, which doesn't allow |
| 175 // pMapEntries to be passed through :-( | 176 // pMapEntries to be passed through :-( |
| 176 if (do_system_registration_) { | 177 if (do_system_registration_) { |
| 177 hr = registrar->AddReplacement(L"HIVE", L"HKLM"); | 178 hr = registrar->AddReplacement(L"HIVE", L"HKLM"); |
| 178 } else { | 179 } else { |
| 179 hr = registrar->AddReplacement(L"HIVE", L"HKCU"); | 180 hr = registrar->AddReplacement(L"HIVE", L"HKCU"); |
| 180 } | 181 } |
| 181 DCHECK(SUCCEEDED(hr)); | 182 DCHECK(SUCCEEDED(hr)); |
| 182 } | 183 } |
| 183 | 184 |
| 185 if (SUCCEEDED(hr)) { |
| 186 // Add the Chrome Frame CLSID. |
| 187 wchar_t cf_clsid[64]; |
| 188 StringFromGUID2(CLSID_ChromeFrame, &cf_clsid[0], arraysize(cf_clsid)); |
| 189 hr = registrar->AddReplacement(L"CHROME_FRAME_CLSID", &cf_clsid[0]); |
| 190 } |
| 191 |
| 184 return hr; | 192 return hr; |
| 185 } | 193 } |
| 186 | 194 |
| 187 // See comments in AddCommonRGSReplacements | 195 // See comments in AddCommonRGSReplacements |
| 188 bool do_system_registration_; | 196 bool do_system_registration_; |
| 189 }; | 197 }; |
| 190 | 198 |
| 191 ChromeTabModule _AtlModule; | 199 ChromeTabModule _AtlModule; |
| 192 | 200 |
| 193 base::AtExitManager* g_exit_manager = NULL; | 201 base::AtExitManager* g_exit_manager = NULL; |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 hr = ChromeActiveDocument::UpdateRegistry(reg); | 519 hr = ChromeActiveDocument::UpdateRegistry(reg); |
| 512 } | 520 } |
| 513 | 521 |
| 514 if ((hr == S_OK) && (flags & ACTIVEX)) { | 522 if ((hr == S_OK) && (flags & ACTIVEX)) { |
| 515 // We have to call the static T::UpdateRegistry function instead of | 523 // We have to call the static T::UpdateRegistry function instead of |
| 516 // _AtlModule.UpdateRegistryFromResourceS(IDR_CHROMEFRAME_ACTIVEX, reg) | 524 // _AtlModule.UpdateRegistryFromResourceS(IDR_CHROMEFRAME_ACTIVEX, reg) |
| 517 // because there is specific OLEMISC replacement. | 525 // because there is specific OLEMISC replacement. |
| 518 hr = ChromeFrameActivex::UpdateRegistry(reg); | 526 hr = ChromeFrameActivex::UpdateRegistry(reg); |
| 519 } | 527 } |
| 520 | 528 |
| 521 // Register the elevation policy. We do this only for developer convenience | 529 // Register the elevation policy. This must succeed for Chrome Frame to |
| 522 // as the installer is really responsible for doing this. | 530 // be able launch Chrome when running in low-integrity IE. |
| 523 // Because of that, we do not unregister this policy and just leave that up | 531 if (hr == S_OK && (flags & (ACTIVEDOC | ACTIVEX))) { |
| 524 // to the installer. | |
| 525 if (hr == S_OK && (flags & (ACTIVEDOC | ACTIVEX)) && reg) { | |
| 526 _AtlModule.UpdateRegistryFromResourceS(IDR_CHROMEFRAME_ELEVATION, reg); | 532 _AtlModule.UpdateRegistryFromResourceS(IDR_CHROMEFRAME_ELEVATION, reg); |
| 527 RefreshElevationPolicy(); | 533 RefreshElevationPolicy(); |
| 528 } | 534 } |
| 529 | 535 |
| 530 if ((hr == S_OK) && (flags & GCF_PROTOCOL)) { | 536 if ((hr == S_OK) && (flags & GCF_PROTOCOL)) { |
| 531 hr = _AtlModule.UpdateRegistryFromResourceS(IDR_CHROMEPROTOCOL, reg); | 537 hr = _AtlModule.UpdateRegistryFromResourceS(IDR_CHROMEPROTOCOL, reg); |
| 532 } | 538 } |
| 533 | 539 |
| 534 if ((hr == S_OK) && (flags & BHO_CLSID)) { | 540 if ((hr == S_OK) && (flags & BHO_CLSID)) { |
| 535 hr = Bho::UpdateRegistry(reg); | 541 hr = Bho::UpdateRegistry(reg); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 sd.GetDacl(&new_dacl); | 810 sd.GetDacl(&new_dacl); |
| 805 new_dacl.AddAllowedAce(token_.GetUser(), GENERIC_WRITE | GENERIC_READ); | 811 new_dacl.AddAllowedAce(token_.GetUser(), GENERIC_WRITE | GENERIC_READ); |
| 806 if (AtlSetDacl(object_name.c_str(), SE_REGISTRY_KEY, new_dacl)) { | 812 if (AtlSetDacl(object_name.c_str(), SE_REGISTRY_KEY, new_dacl)) { |
| 807 result = SetOrDeleteMimeHandlerKey(enable, HKEY_LOCAL_MACHINE); | 813 result = SetOrDeleteMimeHandlerKey(enable, HKEY_LOCAL_MACHINE); |
| 808 } | 814 } |
| 809 } | 815 } |
| 810 | 816 |
| 811 backup.RestoreSecurity(object_name.c_str()); | 817 backup.RestoreSecurity(object_name.c_str()); |
| 812 return result; | 818 return result; |
| 813 } | 819 } |
| OLD | NEW |