Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: chrome_frame/utils.cc

Issue 3131003: Support GCF as the default HTML viewer. I simply extended the IsOptInUrl che... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome_frame/protocol_sink_wrap.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 30 matching lines...) Expand all
41 const wchar_t kXUACompatValue[] = L"x-ua-compatible"; 41 const wchar_t kXUACompatValue[] = L"x-ua-compatible";
42 const wchar_t kBodyTag[] = L"body"; 42 const wchar_t kBodyTag[] = L"body";
43 const wchar_t kChromeContentPrefix[] = L"chrome="; 43 const wchar_t kChromeContentPrefix[] = L"chrome=";
44 const wchar_t kChromeProtocolPrefix[] = L"gcf:"; 44 const wchar_t kChromeProtocolPrefix[] = L"gcf:";
45 const wchar_t kChromeMimeType[] = L"application/chromepage"; 45 const wchar_t kChromeMimeType[] = L"application/chromepage";
46 const wchar_t kPatchProtocols[] = L"PatchProtocols"; 46 const wchar_t kPatchProtocols[] = L"PatchProtocols";
47 const wchar_t kChromeFrameAttachTabPattern[] = L"*?attach_external_tab&*"; 47 const wchar_t kChromeFrameAttachTabPattern[] = L"*?attach_external_tab&*";
48 48
49 static const wchar_t kChromeFrameConfigKey[] = 49 static const wchar_t kChromeFrameConfigKey[] =
50 L"Software\\Google\\ChromeFrame"; 50 L"Software\\Google\\ChromeFrame";
51 static const wchar_t kChromeFrameOptinUrlsKey[] = L"OptinUrls"; 51 static const wchar_t kRenderInGCFUrlList[] = L"RenderInGcfUrls";
52 static const wchar_t kRenderInHostUrlList[] = L"RenderInHostUrls";
52 static const wchar_t kEnableGCFProtocol[] = L"EnableGCFProtocol"; 53 static const wchar_t kEnableGCFProtocol[] = L"EnableGCFProtocol";
54 static const wchar_t kEnableGCFRendererByDefault[] = L"IsDefaultRenderer";
53 static const wchar_t kEnableBuggyBhoIntercept[] = L"EnableBuggyBhoIntercept"; 55 static const wchar_t kEnableBuggyBhoIntercept[] = L"EnableBuggyBhoIntercept";
54 56
55 static const wchar_t kChromeFrameNPAPIKey[] = 57 static const wchar_t kChromeFrameNPAPIKey[] =
56 L"Software\\MozillaPlugins\\@google.com/ChromeFrame,version=1.0"; 58 L"Software\\MozillaPlugins\\@google.com/ChromeFrame,version=1.0";
57 static const wchar_t kChromeFramePersistNPAPIReg[] = L"PersistNPAPIReg"; 59 static const wchar_t kChromeFramePersistNPAPIReg[] = L"PersistNPAPIReg";
58 60
59 // Used to isolate chrome frame builds from google chrome release channels. 61 // Used to isolate chrome frame builds from google chrome release channels.
60 const wchar_t kChromeFrameOmahaSuffix[] = L"-cf"; 62 const wchar_t kChromeFrameOmahaSuffix[] = L"-cf";
61 const wchar_t kDevChannelName[] = L"-dev"; 63 const wchar_t kDevChannelName[] = L"-dev";
62 64
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 return config_key.DeleteValue(value_name); 695 return config_key.DeleteValue(value_name);
694 } 696 }
695 return false; 697 return false;
696 } 698 }
697 699
698 bool IsOptInUrl(const wchar_t* url) { 700 bool IsOptInUrl(const wchar_t* url) {
699 RegKey config_key; 701 RegKey config_key;
700 if (!config_key.Open(HKEY_CURRENT_USER, kChromeFrameConfigKey, KEY_READ)) 702 if (!config_key.Open(HKEY_CURRENT_USER, kChromeFrameConfigKey, KEY_READ))
701 return false; 703 return false;
702 704
703 RegistryValueIterator optin_urls_list(config_key.Handle(), 705 bool load_in_chrome_frame = false;
704 kChromeFrameOptinUrlsKey); 706
705 while (optin_urls_list.Valid()) { 707 const wchar_t* url_list_name = NULL;
706 if (MatchPatternWide(url, optin_urls_list.Name())) 708 int render_in_cf_by_default = FALSE;
707 return true; 709 config_key.ReadValueDW(kEnableGCFRendererByDefault,
708 ++optin_urls_list; 710 reinterpret_cast<DWORD*>(&render_in_cf_by_default));
711 if (render_in_cf_by_default) {
712 url_list_name = kRenderInHostUrlList;
713 load_in_chrome_frame = true;
714 } else {
715 url_list_name = kRenderInGCFUrlList;
709 } 716 }
710 717
711 return false; 718 bool match_found = false;
719 RegistryValueIterator url_list(config_key.Handle(), url_list_name);
720 while (!match_found && url_list.Valid()) {
721 if (MatchPatternWide(url, url_list.Name())) {
722 match_found = true;
723 } else {
724 ++url_list;
725 }
726 }
727
728 if (match_found) {
729 // The lists are there to opt out of whatever is the default.
730 load_in_chrome_frame = !load_in_chrome_frame;
amit 2010/08/10 20:36:25 true! :) We definitely need a unit test for this.
731 }
732
733 return load_in_chrome_frame;
712 } 734 }
713 735
714 HRESULT NavigateBrowserToMoniker(IUnknown* browser, IMoniker* moniker, 736 HRESULT NavigateBrowserToMoniker(IUnknown* browser, IMoniker* moniker,
715 const wchar_t* headers, IBindCtx* bind_ctx, 737 const wchar_t* headers, IBindCtx* bind_ctx,
716 const wchar_t* fragment) { 738 const wchar_t* fragment) {
717 DCHECK(browser); 739 DCHECK(browser);
718 DCHECK(moniker); 740 DCHECK(moniker);
719 DCHECK(bind_ctx); 741 DCHECK(bind_ctx);
720 742
721 ScopedComPtr<IWebBrowser2> web_browser2; 743 ScopedComPtr<IWebBrowser2> web_browser2;
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
1373 DLOG(WARNING) << __FUNCTION__ 1395 DLOG(WARNING) << __FUNCTION__
1374 << " Disallowing navigation to gcf url: " 1396 << " Disallowing navigation to gcf url: "
1375 << cf_url.url(); 1397 << cf_url.url();
1376 return false; 1398 return false;
1377 } 1399 }
1378 } 1400 }
1379 1401
1380 return true; 1402 return true;
1381 } 1403 }
1382 1404
OLDNEW
« no previous file with comments | « chrome_frame/protocol_sink_wrap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698