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

Side by Side Diff: chrome/browser/ui/location_bar/origin_chip_info.cc

Issue 397853002: Refactor safe-browsing build-config definitions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup gn files Created 6 years, 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/ui/location_bar/origin_chip_info.h" 5 #include "chrome/browser/ui/location_bar/origin_chip_info.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 // static 161 // static
162 bool OriginChip::IsMalware(const GURL& url, const content::WebContents* tab) { 162 bool OriginChip::IsMalware(const GURL& url, const content::WebContents* tab) {
163 DCHECK(tab); 163 DCHECK(tab);
164 164
165 if (tab->GetURL() != url) 165 if (tab->GetURL() != url)
166 return false; 166 return false;
167 167
168 const safe_browsing::SafeBrowsingTabObserver* sb_observer = 168 const safe_browsing::SafeBrowsingTabObserver* sb_observer =
169 safe_browsing::SafeBrowsingTabObserver::FromWebContents(tab); 169 safe_browsing::SafeBrowsingTabObserver::FromWebContents(tab);
170 return sb_observer && sb_observer->detection_host() && 170 return sb_observer && sb_observer->DidPageReceiveSafeBrowsingMatch();
171 sb_observer->detection_host()->DidPageReceiveSafeBrowsingMatch();
172 } 171 }
173 172
174 // static 173 // static
175 base::string16 OriginChip::LabelFromURLForProfile(const GURL& provided_url, 174 base::string16 OriginChip::LabelFromURLForProfile(const GURL& provided_url,
176 Profile* profile) { 175 Profile* profile) {
177 // First, strip view-source: if it appears. Note that GetContent removes 176 // First, strip view-source: if it appears. Note that GetContent removes
178 // "view-source:" but leaves the original scheme (http, https, ftp, etc). 177 // "view-source:" but leaves the original scheme (http, https, ftp, etc).
179 GURL url(provided_url); 178 GURL url(provided_url);
180 if (url.SchemeIs(content::kViewSourceScheme)) 179 if (url.SchemeIs(content::kViewSourceScheme))
181 url = GURL(url.GetContent()); 180 url = GURL(url.GetContent());
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 251
253 #if defined(OS_CHROMEOS) 252 #if defined(OS_CHROMEOS)
254 if (url.SchemeIs(chrome::kCrosScheme) || 253 if (url.SchemeIs(chrome::kCrosScheme) ||
255 url.SchemeIs(chrome::kDriveScheme)) 254 url.SchemeIs(chrome::kDriveScheme))
256 return base::UTF8ToUTF16(url.spec()); 255 return base::UTF8ToUTF16(url.spec());
257 #endif 256 #endif
258 257
259 // If all else fails, return the hostname. 258 // If all else fails, return the hostname.
260 return base::UTF8ToUTF16(url.host()); 259 return base::UTF8ToUTF16(url.host());
261 } 260 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698