summaryrefslogtreecommitdiffstats
path: root/net/url_request/url_request_netlog_params.cc
blob: 67d44c34a400396f43081366a3959578fe4ea6ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "net/url_request/url_request_netlog_params.h"

#include "base/values.h"
#include "googleurl/src/gurl.h"

namespace net {

Value* NetLogURLRequestStartCallback(const GURL* url,
                                     const std::string* method,
                                     int load_flags,
                                     RequestPriority priority,
                                     NetLog::LogLevel /* log_level */) {
  DictionaryValue* dict = new DictionaryValue();
  dict->SetString("url", url->possibly_invalid_spec());
  dict->SetString("method", *method);
  dict->SetInteger("load_flags", load_flags);
  dict->SetInteger("priority", static_cast<int>(priority));
  return dict;
}

bool StartEventLoadFlagsFromEventParams(const Value* event_params,
                                        int* load_flags) {
  const DictionaryValue* dict;
  if (!event_params->GetAsDictionary(&dict) ||
      !dict->GetInteger("load_flags", load_flags)) {
    *load_flags = 0;
    return false;
  }
  return true;
}

}  // namespace net