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

Side by Side Diff: net/url_request/url_request_netlog_params.cc

Issue 10399083: Make NetLog take in callbacks that return Values (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix merge error Created 8 years, 6 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
« no previous file with comments | « net/url_request/url_request_netlog_params.h ('k') | remoting/host/vlog_net_log.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "net/url_request/url_request_netlog_params.h" 5 #include "net/url_request/url_request_netlog_params.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "googleurl/src/gurl.h"
8 9
9 namespace net { 10 namespace net {
10 11
11 URLRequestStartEventParameters::URLRequestStartEventParameters( 12 Value* NetLogURLRequestStartCallback(const GURL* url,
12 const GURL& url, 13 const std::string* method,
13 const std::string& method, 14 int load_flags,
14 int load_flags, 15 RequestPriority priority,
15 RequestPriority priority) 16 NetLog::LogLevel /* log_level */) {
16 : url_(url),
17 method_(method),
18 load_flags_(load_flags),
19 priority_(priority) {
20 }
21
22 Value* URLRequestStartEventParameters::ToValue() const {
23 DictionaryValue* dict = new DictionaryValue(); 17 DictionaryValue* dict = new DictionaryValue();
24 dict->SetString("url", url_.possibly_invalid_spec()); 18 dict->SetString("url", url->possibly_invalid_spec());
25 dict->SetString("method", method_); 19 dict->SetString("method", *method);
26 dict->SetInteger("load_flags", load_flags_); 20 dict->SetInteger("load_flags", load_flags);
27 dict->SetInteger("priority", static_cast<int>(priority_)); 21 dict->SetInteger("priority", static_cast<int>(priority));
28 return dict; 22 return dict;
29 } 23 }
30 24
31 URLRequestStartEventParameters::~URLRequestStartEventParameters() {} 25 bool StartEventLoadFlagsFromEventParams(const Value* event_params,
26 int* load_flags) {
27 const DictionaryValue* dict;
28 if (!event_params->GetAsDictionary(&dict) ||
29 !dict->GetInteger("load_flags", load_flags)) {
30 *load_flags = 0;
31 return false;
32 }
33 return true;
34 }
32 35
33 } // namespace net 36 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_netlog_params.h ('k') | remoting/host/vlog_net_log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698