| 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/renderer_host/safe_browsing_resource_throttle.h" | 5 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/logging.h" | 9 #include "base/logging.h" |
| 8 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/values.h" | 11 #include "base/values.h" |
| 10 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/prerender/prerender_contents.h" | 13 #include "chrome/browser/prerender/prerender_contents.h" |
| 12 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 14 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 13 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 14 #include "content/public/browser/render_view_host.h" | 16 #include "content/public/browser/render_view_host.h" |
| 15 #include "content/public/browser/resource_controller.h" | 17 #include "content/public/browser/resource_controller.h" |
| 16 #include "content/public/browser/resource_request_info.h" | 18 #include "content/public/browser/resource_request_info.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 42 const net::URLRequest* request, | 44 const net::URLRequest* request, |
| 43 const GURL& url, | 45 const GURL& url, |
| 44 const char* name, | 46 const char* name, |
| 45 const char* value, | 47 const char* value, |
| 46 net::NetLogCaptureMode /* capture_mode */) { | 48 net::NetLogCaptureMode /* capture_mode */) { |
| 47 scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue()); | 49 scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue()); |
| 48 event_params->SetString("url", url.spec()); | 50 event_params->SetString("url", url.spec()); |
| 49 if (name && value) | 51 if (name && value) |
| 50 event_params->SetString(name, value); | 52 event_params->SetString(name, value); |
| 51 request->net_log().source().AddToEventParameters(event_params.get()); | 53 request->net_log().source().AddToEventParameters(event_params.get()); |
| 52 return event_params.Pass(); | 54 return std::move(event_params); |
| 53 } | 55 } |
| 54 | 56 |
| 55 // Return a dictionary with |name|=|value|, for netlogging. | 57 // Return a dictionary with |name|=|value|, for netlogging. |
| 56 scoped_ptr<base::Value> NetLogStringCallback( | 58 scoped_ptr<base::Value> NetLogStringCallback( |
| 57 const char* name, | 59 const char* name, |
| 58 const char* value, | 60 const char* value, |
| 59 net::NetLogCaptureMode) { | 61 net::NetLogCaptureMode) { |
| 60 scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue()); | 62 scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue()); |
| 61 if (name && value) | 63 if (name && value) |
| 62 event_params->SetString(name, value); | 64 event_params->SetString(name, value); |
| 63 return event_params.Pass(); | 65 return std::move(event_params); |
| 64 } | 66 } |
| 65 | 67 |
| 66 } // namespace | 68 } // namespace |
| 67 | 69 |
| 68 // TODO(eroman): Downgrade these CHECK()s to DCHECKs once there is more | 70 // TODO(eroman): Downgrade these CHECK()s to DCHECKs once there is more |
| 69 // unit test coverage. | 71 // unit test coverage. |
| 70 | 72 |
| 71 // static | 73 // static |
| 72 SafeBrowsingResourceThrottle* SafeBrowsingResourceThrottle::MaybeCreate( | 74 SafeBrowsingResourceThrottle* SafeBrowsingResourceThrottle::MaybeCreate( |
| 73 net::URLRequest* request, | 75 net::URLRequest* request, |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 unchecked_redirect_url_, "defer_reason", | 380 unchecked_redirect_url_, "defer_reason", |
| 379 "resumed_redirect"); | 381 "resumed_redirect"); |
| 380 } | 382 } |
| 381 } | 383 } |
| 382 | 384 |
| 383 if (resume) { | 385 if (resume) { |
| 384 defer_state_ = DEFERRED_NONE; | 386 defer_state_ = DEFERRED_NONE; |
| 385 controller()->Resume(); | 387 controller()->Resume(); |
| 386 } | 388 } |
| 387 } | 389 } |
| OLD | NEW |