| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include <htiframe.h> | 5 #include <htiframe.h> |
| 6 #include <mshtml.h> | 6 #include <mshtml.h> |
| 7 #include <shlobj.h> | 7 #include <shlobj.h> |
| 8 #include <wininet.h> | 8 #include <wininet.h> |
| 9 | 9 |
| 10 #include "chrome_frame/html_utils.h" | 10 #include "chrome_frame/html_utils.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 static const wchar_t kChromeFrameNPAPIKey[] = | 40 static const wchar_t kChromeFrameNPAPIKey[] = |
| 41 L"Software\\MozillaPlugins\\@google.com/ChromeFrame,version=1.0"; | 41 L"Software\\MozillaPlugins\\@google.com/ChromeFrame,version=1.0"; |
| 42 static const wchar_t kChromeFramePersistNPAPIReg[] = L"PersistNPAPIReg"; | 42 static const wchar_t kChromeFramePersistNPAPIReg[] = L"PersistNPAPIReg"; |
| 43 | 43 |
| 44 // Used to isolate chrome frame builds from google chrome release channels. | 44 // Used to isolate chrome frame builds from google chrome release channels. |
| 45 const wchar_t kChromeFrameOmahaSuffix[] = L"-cf"; | 45 const wchar_t kChromeFrameOmahaSuffix[] = L"-cf"; |
| 46 const wchar_t kDevChannelName[] = L"-dev"; | 46 const wchar_t kDevChannelName[] = L"-dev"; |
| 47 | 47 |
| 48 const wchar_t kChromeAttachExternalTabPrefix[] = L"attach_external_tab"; | 48 const wchar_t kChromeAttachExternalTabPrefix[] = L"attach_external_tab"; |
| 49 | 49 |
| 50 // Indicates that we are running in a test environment, where execptions, etc |
| 51 // are handled by the chrome test crash server. |
| 52 const wchar_t kChromeFrameHeadlessMode[] = L"ChromeFrameHeadlessMode"; |
| 53 |
| 50 HRESULT UtilRegisterTypeLib(HINSTANCE tlb_instance, | 54 HRESULT UtilRegisterTypeLib(HINSTANCE tlb_instance, |
| 51 LPCOLESTR index, | 55 LPCOLESTR index, |
| 52 bool for_current_user_only) { | 56 bool for_current_user_only) { |
| 53 CComBSTR path; | 57 CComBSTR path; |
| 54 CComPtr<ITypeLib> type_lib; | 58 CComPtr<ITypeLib> type_lib; |
| 55 HRESULT hr = AtlLoadTypeLib(tlb_instance, index, &path, &type_lib); | 59 HRESULT hr = AtlLoadTypeLib(tlb_instance, index, &path, &type_lib); |
| 56 if (SUCCEEDED(hr)) { | 60 if (SUCCEEDED(hr)) { |
| 57 hr = UtilRegisterTypeLib(type_lib, path, NULL, for_current_user_only); | 61 hr = UtilRegisterTypeLib(type_lib, path, NULL, for_current_user_only); |
| 58 } | 62 } |
| 59 return hr; | 63 return hr; |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 } | 543 } |
| 540 | 544 |
| 541 return ret; | 545 return ret; |
| 542 } | 546 } |
| 543 | 547 |
| 544 bool GetConfigBool(bool default_value, const wchar_t* value_name) { | 548 bool GetConfigBool(bool default_value, const wchar_t* value_name) { |
| 545 DWORD value = GetConfigInt(default_value, value_name); | 549 DWORD value = GetConfigInt(default_value, value_name); |
| 546 return (value != FALSE); | 550 return (value != FALSE); |
| 547 } | 551 } |
| 548 | 552 |
| 553 bool SetConfigInt(const wchar_t* value_name, int value) { |
| 554 RegKey config_key; |
| 555 if (config_key.Open(HKEY_CURRENT_USER, kChromeFrameConfigKey, |
| 556 KEY_SET_VALUE)) { |
| 557 if (config_key.WriteValue(value_name, value)) { |
| 558 return true; |
| 559 } |
| 560 } |
| 561 |
| 562 return false; |
| 563 } |
| 564 |
| 565 bool SetConfigBool(const wchar_t* value_name, bool value) { |
| 566 return SetConfigInt(value_name, value); |
| 567 } |
| 568 |
| 569 bool DeleteConfigValue(const wchar_t* value_name) { |
| 570 RegKey config_key; |
| 571 if (config_key.Open(HKEY_CURRENT_USER, kChromeFrameConfigKey, |
| 572 KEY_WRITE)) { |
| 573 return config_key.DeleteValue(value_name); |
| 574 } |
| 575 return false; |
| 576 } |
| 577 |
| 549 bool IsOptInUrl(const wchar_t* url) { | 578 bool IsOptInUrl(const wchar_t* url) { |
| 550 RegKey config_key; | 579 RegKey config_key; |
| 551 if (!config_key.Open(HKEY_CURRENT_USER, kChromeFrameConfigKey, KEY_READ)) | 580 if (!config_key.Open(HKEY_CURRENT_USER, kChromeFrameConfigKey, KEY_READ)) |
| 552 return false; | 581 return false; |
| 553 | 582 |
| 554 RegistryValueIterator optin_urls_list(config_key.Handle(), | 583 RegistryValueIterator optin_urls_list(config_key.Handle(), |
| 555 kChromeFrameOptinUrlsKey); | 584 kChromeFrameOptinUrlsKey); |
| 556 while (optin_urls_list.Valid()) { | 585 while (optin_urls_list.Valid()) { |
| 557 if (MatchPatternWide(url, optin_urls_list.Name())) | 586 if (MatchPatternWide(url, optin_urls_list.Name())) |
| 558 return true; | 587 return true; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 DLOG(INFO) << "Sub frame detected"; | 689 DLOG(INFO) << "Sub frame detected"; |
| 661 is_non_top_level_request = true; | 690 is_non_top_level_request = true; |
| 662 } | 691 } |
| 663 } | 692 } |
| 664 } else { | 693 } else { |
| 665 is_non_top_level_request = true; | 694 is_non_top_level_request = true; |
| 666 } | 695 } |
| 667 | 696 |
| 668 return is_non_top_level_request; | 697 return is_non_top_level_request; |
| 669 } | 698 } |
| 699 |
| 700 bool IsHeadlessMode() { |
| 701 bool headless = GetConfigBool(false, kChromeFrameHeadlessMode); |
| 702 return headless; |
| 703 } |
| 704 |
| OLD | NEW |