Chromium Code Reviews| Index: content/browser/download/download_net_log_parameters.cc |
| diff --git a/content/browser/download/download_net_log_parameters.cc b/content/browser/download/download_net_log_parameters.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..417c22943eda96630906abc2ef7bc22db8f32110 |
| --- /dev/null |
| +++ b/content/browser/download/download_net_log_parameters.cc |
| @@ -0,0 +1,73 @@ |
| +// 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 "content/browser/download/download_net_log_parameters.h" |
| + |
| +#include "base/basictypes.h" |
| +#include "base/logging.h" |
| +#include "base/string_number_conversions.h" |
| +#include "base/values.h" |
| +#include "content/browser/download/interrupt_reasons.h" |
| +#include "net/base/net_errors.h" |
| + |
| +namespace download_net_logs { |
| + |
| +FileOpenedParameters::FileOpenedParameters( |
| + const std::string& file_name, |
| + int64 start_offset) |
| + : file_name_(file_name), start_offset_(start_offset) { |
|
mmenke1
2012/02/03 18:32:32
nit: Fix indent
ahendrickson
2012/02/04 05:27:14
Done.
|
| +} |
| + |
| +Value* FileOpenedParameters::ToValue() const { |
| + DictionaryValue* dict = new DictionaryValue(); |
| + |
| + dict->SetString("file_name", file_name_); |
| + dict->SetDouble("start_offset", start_offset_); |
| + |
| + return dict; |
| +} |
| + |
| +FileWrittenParameters::FileWrittenParameters( |
| + int64 bytes_in_write, int64 bytes_so_far) |
| + : bytes_in_write_(bytes_in_write), bytes_so_far_(bytes_so_far) { |
| +} |
| + |
| +Value* FileWrittenParameters::ToValue() const { |
| + DictionaryValue* dict = new DictionaryValue(); |
| + |
| + dict->SetDouble("bytes_in_write", bytes_in_write_); |
| + dict->SetDouble("bytes_so_far", bytes_so_far_); |
|
mmenke1
2012/02/03 18:32:32
nit: These names seem a little weird. I'd sugges
ahendrickson
2012/02/04 05:27:14
Done.
|
| + |
| + return dict; |
| +} |
| + |
| +FileRenamedParameters::FileRenamedParameters( |
| + const std::string& old_filename, const std::string& new_filename) |
| + : old_filename_(old_filename), new_filename_(new_filename) { |
| +} |
| + |
| +Value* FileRenamedParameters::ToValue() const { |
| + DictionaryValue* dict = new DictionaryValue(); |
| + |
| + dict->SetString("old_filename", old_filename_); |
| + dict->SetString("new_filename", new_filename_); |
| + |
| + return dict; |
| +} |
| + |
| +FileErrorParameters::FileErrorParameters(const std::string& operation, |
| + net::Error net_error) |
| + : operation_(operation), net_error_(net_error) { |
| +} |
| + |
| +Value* FileErrorParameters::ToValue() const { |
| + DictionaryValue* dict = new DictionaryValue(); |
| + |
| + dict->SetString("operation", operation_); |
| + dict->SetInteger("net_error", net_error_); |
| + |
| + return dict; |
| +} |
| + |
| +} // namespace download_net_logs |