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

Side by Side Diff: extensions/browser/api/web_request/web_request_permissions.cc

Issue 2478573004: Convert GURL::{host,path} to GURL::{host_piece,path_piece} for ==. (Closed)
Patch Set: Created 4 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "extensions/browser/api/web_request/web_request_permissions.h" 5 #include "extensions/browser/api/web_request/web_request_permissions.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "content/public/browser/resource_request_info.h" 9 #include "content/public/browser/resource_request_info.h"
10 #include "extensions/browser/extension_navigation_ui_data.h" 10 #include "extensions/browser/extension_navigation_ui_data.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 match = false; 46 match = false;
47 break; 47 break;
48 } 48 }
49 } 49 }
50 sensitive_chrome_url = sensitive_chrome_url || match; 50 sensitive_chrome_url = sensitive_chrome_url || match;
51 } 51 }
52 // This protects requests to safe browsing, link doctor, and possibly 52 // This protects requests to safe browsing, link doctor, and possibly
53 // others. 53 // others.
54 sensitive_chrome_url = 54 sensitive_chrome_url =
55 sensitive_chrome_url || 55 sensitive_chrome_url ||
56 base::EndsWith(url.host(), ".clients.google.com", 56 base::EndsWith(url.host_piece(), ".clients.google.com",
57 base::CompareCase::SENSITIVE) || 57 base::CompareCase::SENSITIVE) ||
58 url.host() == "sb-ssl.google.com" || 58 url.host_piece() == "sb-ssl.google.com" ||
59 (url.host() == "chrome.google.com" && 59 (url.host_piece() == "chrome.google.com" &&
60 base::StartsWith(url.path(), "/webstore", 60 base::StartsWith(url.path_piece(), "/webstore",
61 base::CompareCase::SENSITIVE)); 61 base::CompareCase::SENSITIVE));
62 } 62 }
63 GURL::Replacements replacements; 63 GURL::Replacements replacements;
64 replacements.ClearQuery(); 64 replacements.ClearQuery();
65 replacements.ClearRef(); 65 replacements.ClearRef();
66 GURL url_without_query = url.ReplaceComponents(replacements); 66 GURL url_without_query = url.ReplaceComponents(replacements);
67 return sensitive_chrome_url || 67 return sensitive_chrome_url ||
68 extension_urls::IsWebstoreUpdateUrl(url_without_query) || 68 extension_urls::IsWebstoreUpdateUrl(url_without_query) ||
69 extension_urls::IsBlacklistUpdateUrl(url); 69 extension_urls::IsBlacklistUpdateUrl(url);
70 } 70 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 break; 147 break;
148 case REQUIRE_ALL_URLS: 148 case REQUIRE_ALL_URLS:
149 if (extension->permissions_data()->HasEffectiveAccessToAllHosts()) 149 if (extension->permissions_data()->HasEffectiveAccessToAllHosts())
150 access = PermissionsData::ACCESS_ALLOWED; 150 access = PermissionsData::ACCESS_ALLOWED;
151 // else ACCESS_DENIED 151 // else ACCESS_DENIED
152 break; 152 break;
153 } 153 }
154 154
155 return access; 155 return access;
156 } 156 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698