| 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 #ifndef NET_URL_REQUEST_URL_REQUEST_NETLOG_PARAMS_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_NETLOG_PARAMS_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_NETLOG_PARAMS_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_NETLOG_PARAMS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | |
| 12 #include "googleurl/src/gurl.h" | |
| 13 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
| 14 #include "net/base/net_log.h" | 12 #include "net/base/net_log.h" |
| 15 #include "net/base/request_priority.h" | 13 #include "net/base/request_priority.h" |
| 16 | 14 |
| 15 class GURL; |
| 16 |
| 17 namespace base { |
| 18 class Value; |
| 19 } |
| 20 |
| 17 namespace net { | 21 namespace net { |
| 18 | 22 |
| 19 // Holds the parameters to emit to the NetLog when starting a URLRequest. | 23 // Returns a Value containing NetLog parameters for starting a URLRequest. |
| 20 class NET_EXPORT URLRequestStartEventParameters | 24 NET_EXPORT base::Value* NetLogURLRequestStartCallback( |
| 21 : public NetLog::EventParameters { | 25 const GURL* url, |
| 22 public: | 26 const std::string* method, |
| 23 URLRequestStartEventParameters(const GURL& url, | 27 int load_flags, |
| 24 const std::string& method, | 28 RequestPriority priority, |
| 25 int load_flags, | 29 NetLog::LogLevel /* log_level */); |
| 26 RequestPriority priority); | |
| 27 | 30 |
| 28 const GURL& url() const { | 31 // Attempts to extract the load flags from a Value created by the above |
| 29 return url_; | 32 // function. On success, sets |load_flags| accordingly and returns true. |
| 30 } | 33 // On failure, sets |load_flags| to 0. |
| 31 | 34 NET_EXPORT bool StartEventLoadFlagsFromEventParams( |
| 32 int load_flags() const { | 35 const base::Value* event_params, |
| 33 return load_flags_; | 36 int* load_flags); |
| 34 } | |
| 35 | |
| 36 virtual base::Value* ToValue() const OVERRIDE; | |
| 37 | |
| 38 protected: | |
| 39 virtual ~URLRequestStartEventParameters(); | |
| 40 | |
| 41 private: | |
| 42 const GURL url_; | |
| 43 const std::string method_; | |
| 44 const int load_flags_; | |
| 45 const RequestPriority priority_; | |
| 46 | |
| 47 DISALLOW_COPY_AND_ASSIGN(URLRequestStartEventParameters); | |
| 48 }; | |
| 49 | 37 |
| 50 } // namespace net | 38 } // namespace net |
| 51 | 39 |
| 52 #endif // NET_URL_REQUEST_URL_REQUEST_NETLOG_PARAMS_H_ | 40 #endif // NET_URL_REQUEST_URL_REQUEST_NETLOG_PARAMS_H_ |
| OLD | NEW |