OLD | NEW |
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 "chrome/browser/safe_browsing/ui_manager.h" | 5 #include "chrome/browser/safe_browsing/ui_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/debug/leak_tracker.h" | 10 #include "base/debug/leak_tracker.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 30 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
31 #include "net/ssl/ssl_info.h" | 31 #include "net/ssl/ssl_info.h" |
32 #include "net/url_request/url_request_context.h" | 32 #include "net/url_request/url_request_context.h" |
33 #include "net/url_request/url_request_context_getter.h" | 33 #include "net/url_request/url_request_context_getter.h" |
34 | 34 |
35 using content::BrowserThread; | 35 using content::BrowserThread; |
36 using content::NavigationEntry; | 36 using content::NavigationEntry; |
37 using content::WebContents; | 37 using content::WebContents; |
38 | 38 |
39 namespace { | 39 namespace { |
40 const void* kWhitelistKey = &kWhitelistKey; | 40 |
| 41 const void* const kWhitelistKey = &kWhitelistKey; |
41 | 42 |
42 class WhitelistUrlSet : public base::SupportsUserData::Data { | 43 class WhitelistUrlSet : public base::SupportsUserData::Data { |
43 public: | 44 public: |
44 WhitelistUrlSet() {} | 45 WhitelistUrlSet() {} |
45 | 46 |
46 bool Contains(const GURL url) { | 47 bool Contains(const GURL url) { |
47 auto iter = set_.find(url.GetWithEmptyPath()); | 48 auto iter = set_.find(url.GetWithEmptyPath()); |
48 return iter != set_.end(); | 49 return iter != set_.end(); |
49 } | 50 } |
50 | 51 |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 resource.render_process_host_id, resource.render_view_id); | 330 resource.render_process_host_id, resource.render_view_id); |
330 | 331 |
331 GURL maybe_whitelisted_url( | 332 GURL maybe_whitelisted_url( |
332 resource.is_subresource ? web_contents->GetVisibleURL() : resource.url); | 333 resource.is_subresource ? web_contents->GetVisibleURL() : resource.url); |
333 WhitelistUrlSet* site_list = | 334 WhitelistUrlSet* site_list = |
334 static_cast<WhitelistUrlSet*>(web_contents->GetUserData(kWhitelistKey)); | 335 static_cast<WhitelistUrlSet*>(web_contents->GetUserData(kWhitelistKey)); |
335 if (!site_list) | 336 if (!site_list) |
336 return false; | 337 return false; |
337 return site_list->Contains(maybe_whitelisted_url); | 338 return site_list->Contains(maybe_whitelisted_url); |
338 } | 339 } |
OLD | NEW |