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

Side by Side Diff: chrome_frame/utils.cc

Issue 5698005: Add support for gcf:about:plugins in chrome frame full tab mode. The URL vali... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years 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/utils.h ('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 "chrome_frame/utils.h" 5 #include "chrome_frame/utils.h"
6 6
7 #include <htiframe.h> 7 #include <htiframe.h>
8 #include <mshtml.h> 8 #include <mshtml.h>
9 #include <shlobj.h> 9 #include <shlobj.h>
10 10
(...skipping 13 matching lines...) Expand all
24 #include "base/utf_string_conversions.h" 24 #include "base/utf_string_conversions.h"
25 #include "base/win/registry.h" 25 #include "base/win/registry.h"
26 #include "base/win/scoped_bstr.h" 26 #include "base/win/scoped_bstr.h"
27 #include "base/win/scoped_comptr.h" 27 #include "base/win/scoped_comptr.h"
28 #include "base/win/scoped_variant.h" 28 #include "base/win/scoped_variant.h"
29 #include "chrome/common/chrome_paths_internal.h" 29 #include "chrome/common/chrome_paths_internal.h"
30 #include "chrome/common/url_constants.h" 30 #include "chrome/common/url_constants.h"
31 #include "chrome/installer/util/chrome_frame_distribution.h" 31 #include "chrome/installer/util/chrome_frame_distribution.h"
32 #include "chrome_frame/extra_system_apis.h" 32 #include "chrome_frame/extra_system_apis.h"
33 #include "chrome_frame/html_utils.h" 33 #include "chrome_frame/html_utils.h"
34 #include "chrome_frame/navigation_constraints.h"
34 #include "chrome_frame/policy_settings.h" 35 #include "chrome_frame/policy_settings.h"
35 #include "chrome_frame/simple_resource_loader.h" 36 #include "chrome_frame/simple_resource_loader.h"
36 #include "googleurl/src/gurl.h" 37 #include "googleurl/src/gurl.h"
37 #include "googleurl/src/url_canon.h" 38 #include "googleurl/src/url_canon.h"
38 #include "grit/chromium_strings.h" 39 #include "grit/chromium_strings.h"
39 #include "net/base/escape.h" 40 #include "net/base/escape.h"
40 #include "net/http/http_util.h" 41 #include "net/http/http_util.h"
41 42
42 using base::win::RegKey; 43 using base::win::RegKey;
43 using base::win::ScopedComPtr; 44 using base::win::ScopedComPtr;
(...skipping 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 1417
1417 void ChromeFrameUrl::Reset() { 1418 void ChromeFrameUrl::Reset() {
1418 attach_to_external_tab_ = false; 1419 attach_to_external_tab_ = false;
1419 is_chrome_protocol_ = false; 1420 is_chrome_protocol_ = false;
1420 cookie_ = 0; 1421 cookie_ = 0;
1421 dimensions_.SetRect(0, 0, 0, 0); 1422 dimensions_.SetRect(0, 0, 0, 0);
1422 disposition_ = 0; 1423 disposition_ = 0;
1423 profile_name_.clear(); 1424 profile_name_.clear();
1424 } 1425 }
1425 1426
1426 bool CanNavigate(const GURL& url, IInternetSecurityManager* security_manager, 1427 bool CanNavigate(const GURL& url,
1427 bool is_privileged) { 1428 NavigationConstraints* navigation_constraints) {
1428 if (!url.is_valid()) { 1429 if (!url.is_valid()) {
1429 DLOG(ERROR) << "Invalid URL passed to InitiateNavigation: " << url; 1430 DLOG(ERROR) << "Invalid URL passed to InitiateNavigation: " << url;
1430 return false; 1431 return false;
1431 } 1432 }
1432 1433
1434 if (!navigation_constraints) {
1435 NOTREACHED() << "Invalid NavigationConstraints passed in";
1436 return false;
1437 }
1438
1433 // No sanity checks if unsafe URLs are allowed 1439 // No sanity checks if unsafe URLs are allowed
1434 if (GetConfigBool(false, kAllowUnsafeURLs)) 1440 if (navigation_constraints->AllowUnsafeUrls())
1435 return true; 1441 return true;
1436 1442
1437 if (!IsValidUrlScheme(url, is_privileged)) { 1443 if (!navigation_constraints->IsSchemeAllowed(url)) {
1438 DLOG(WARNING) << __FUNCTION__ << " Disallowing navigation to url: " << url; 1444 DLOG(WARNING) << __FUNCTION__ << " Disallowing navigation to url: " << url;
1439 return false; 1445 return false;
1440 } 1446 }
1441 1447
1442 // Allow only about:blank or about:version 1448 if (!navigation_constraints->IsZoneAllowed(url)) {
1443 if (url.SchemeIs(chrome::kAboutScheme)) { 1449 DLOG(WARNING) << __FUNCTION__
1444 if (!LowerCaseEqualsASCII(url.spec(), chrome::kAboutBlankURL) && 1450 << " Disallowing navigation to restricted url: " << url;
1445 !LowerCaseEqualsASCII(url.spec(), chrome::kAboutVersionURL)) { 1451 return false;
1446 DLOG(WARNING) << __FUNCTION__
1447 << " Disallowing navigation to about url: " << url;
1448 return false;
1449 }
1450 } 1452 }
1451
1452 // Prevent navigations to URLs in untrusted zone, even in Firefox.
1453 if (security_manager) {
1454 DWORD zone = URLZONE_INVALID;
1455 std::wstring unicode_url = UTF8ToWide(url.spec());
1456 security_manager->MapUrlToZone(unicode_url.c_str(), &zone, 0);
1457 if (zone == URLZONE_UNTRUSTED) {
1458 DLOG(WARNING) << __FUNCTION__
1459 << " Disallowing navigation to restricted url: " << url;
1460 return false;
1461 }
1462 }
1463
1464 return true; 1453 return true;
1465 } 1454 }
1466 1455
1467 void PinModule() { 1456 void PinModule() {
1468 static bool s_pinned = false; 1457 static bool s_pinned = false;
1469 if (!s_pinned && !IsUnpinnedMode()) { 1458 if (!s_pinned && !IsUnpinnedMode()) {
1470 FilePath module_path; 1459 FilePath module_path;
1471 if (PathService::Get(base::FILE_MODULE, &module_path)) { 1460 if (PathService::Get(base::FILE_MODULE, &module_path)) {
1472 HMODULE unused; 1461 HMODULE unused;
1473 if (!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_PIN, 1462 if (!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_PIN,
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 1558
1570 void EnumerateKeyValues(HKEY parent_key, const wchar_t* sub_key_name, 1559 void EnumerateKeyValues(HKEY parent_key, const wchar_t* sub_key_name,
1571 std::vector<std::wstring>* values) { 1560 std::vector<std::wstring>* values) {
1572 DCHECK(values); 1561 DCHECK(values);
1573 base::win::RegistryValueIterator url_list(parent_key, sub_key_name); 1562 base::win::RegistryValueIterator url_list(parent_key, sub_key_name);
1574 while (url_list.Valid()) { 1563 while (url_list.Valid()) {
1575 values->push_back(url_list.Value()); 1564 values->push_back(url_list.Value());
1576 ++url_list; 1565 ++url_list;
1577 } 1566 }
1578 } 1567 }
OLDNEW
« no previous file with comments | « chrome_frame/utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698