summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-30 01:01:28 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-30 01:01:28 +0000
commit64c754589b76670e3e1ad64fe358c25a1cd2839c (patch)
tree1d3de7b4503fee3e8b026176664137b656d3f29a
parentbdaab67c485eee51a098c7b34544c5d18bf725af (diff)
downloadchromium_src-64c754589b76670e3e1ad64fe358c25a1cd2839c.zip
chromium_src-64c754589b76670e3e1ad64fe358c25a1cd2839c.tar.gz
chromium_src-64c754589b76670e3e1ad64fe358c25a1cd2839c.tar.bz2
net: Add namespace net to URLRequestFileDirJob.
BUG=64263 TEST=compiled locally and trybots Review URL: http://codereview.chromium.org/5958008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70291 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--net/url_request/url_request_file_dir_job.cc32
-rw-r--r--net/url_request/url_request_file_dir_job.h28
2 files changed, 33 insertions, 27 deletions
diff --git a/net/url_request/url_request_file_dir_job.cc b/net/url_request/url_request_file_dir_job.cc
index 553add8..badb6b8 100644
--- a/net/url_request/url_request_file_dir_job.cc
+++ b/net/url_request/url_request_file_dir_job.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
@@ -19,11 +19,11 @@
#include <sys/stat.h>
#endif
-using std::string;
+namespace net {
-URLRequestFileDirJob::URLRequestFileDirJob(net::URLRequest* request,
+URLRequestFileDirJob::URLRequestFileDirJob(URLRequest* request,
const FilePath& dir_path)
- : net::URLRequestJob(request),
+ : URLRequestJob(request),
dir_path_(dir_path),
canceled_(false),
list_complete_(false),
@@ -57,7 +57,7 @@ void URLRequestFileDirJob::StartAsync() {
// is trying to feed us data.
AddRef();
- lister_ = new net::DirectoryLister(dir_path_, this);
+ lister_ = new DirectoryLister(dir_path_, this);
lister_->Start();
NotifyHeadersComplete();
@@ -69,18 +69,18 @@ void URLRequestFileDirJob::Kill() {
canceled_ = true;
- // Don't call CloseLister or dispatch an error to the net::URLRequest because
+ // Don't call CloseLister or dispatch an error to the URLRequest because
// we want OnListDone to be called to also write the error to the output
- // stream. OnListDone will notify the net::URLRequest at this time.
+ // stream. OnListDone will notify the URLRequest at this time.
if (lister_)
lister_->Cancel();
- net::URLRequestJob::Kill();
+ URLRequestJob::Kill();
method_factory_.RevokeAll();
}
-bool URLRequestFileDirJob::ReadRawData(net::IOBuffer* buf, int buf_size,
+bool URLRequestFileDirJob::ReadRawData(IOBuffer* buf, int buf_size,
int *bytes_read) {
DCHECK(bytes_read);
*bytes_read = 0;
@@ -99,19 +99,19 @@ bool URLRequestFileDirJob::ReadRawData(net::IOBuffer* buf, int buf_size,
return false;
}
-bool URLRequestFileDirJob::GetMimeType(string* mime_type) const {
+bool URLRequestFileDirJob::GetMimeType(std::string* mime_type) const {
*mime_type = "text/html";
return true;
}
-bool URLRequestFileDirJob::GetCharset(string* charset) {
+bool URLRequestFileDirJob::GetCharset(std::string* charset) {
// All the filenames are converted to UTF-8 before being added.
*charset = "utf-8";
return true;
}
void URLRequestFileDirJob::OnListFile(
- const net::DirectoryLister::DirectoryListerData& data) {
+ const DirectoryLister::DirectoryListerData& data) {
// We wait to write out the header until we get the first file, so that we
// can catch errors from DirectoryLister and show an error page.
if (!wrote_header_) {
@@ -126,7 +126,7 @@ void URLRequestFileDirJob::OnListFile(
const string16& title = WideToUTF16(
base::SysNativeMBToWide(dir_path_.value()));
#endif
- data_.append(net::GetDirectoryListingHeader(title));
+ data_.append(GetDirectoryListingHeader(title));
wrote_header_ = true;
}
@@ -137,7 +137,7 @@ void URLRequestFileDirJob::OnListFile(
// Note that we should not convert ftLastWriteTime to the local time because
// ICU's datetime formatting APIs expect time in UTC and take into account
// the timezone before formatting.
- data_.append(net::GetDirectoryListingEntry(
+ data_.append(GetDirectoryListingEntry(
data.info.cFileName, std::string(),
(data.info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? true : false,
size,
@@ -145,7 +145,7 @@ void URLRequestFileDirJob::OnListFile(
#elif defined(OS_POSIX)
// TOOD(jungshik): The same issue as for the directory name.
- data_.append(net::GetDirectoryListingEntry(
+ data_.append(GetDirectoryListingEntry(
WideToUTF16(base::SysNativeMBToWide(data.info.filename)),
data.info.filename,
S_ISDIR(data.info.stat.st_mode),
@@ -220,3 +220,5 @@ void URLRequestFileDirJob::CompleteRead() {
}
}
}
+
+} // namespace net
diff --git a/net/url_request/url_request_file_dir_job.h b/net/url_request/url_request_file_dir_job.h
index bdb9b37..2b40a98 100644
--- a/net/url_request/url_request_file_dir_job.h
+++ b/net/url_request/url_request_file_dir_job.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef NET_URL_REQUEST_URL_REQUEST_FILE_DIR_JOB_H__
-#define NET_URL_REQUEST_URL_REQUEST_FILE_DIR_JOB_H__
+#ifndef NET_URL_REQUEST_URL_REQUEST_FILE_DIR_JOB_H_
+#define NET_URL_REQUEST_URL_REQUEST_FILE_DIR_JOB_H_
#pragma once
#include <string>
@@ -14,23 +14,25 @@
#include "net/base/directory_lister.h"
#include "net/url_request/url_request_job.h"
+namespace net {
+
class URLRequestFileDirJob
- : public net::URLRequestJob,
- public net::DirectoryLister::DirectoryListerDelegate {
+ : public URLRequestJob,
+ public DirectoryLister::DirectoryListerDelegate {
public:
- URLRequestFileDirJob(net::URLRequest* request, const FilePath& dir_path);
+ URLRequestFileDirJob(URLRequest* request, const FilePath& dir_path);
- // net::URLRequestJob methods:
+ // Overridden from URLRequestJob:
virtual void Start();
virtual void StartAsync();
virtual void Kill();
- virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int *bytes_read);
+ virtual bool ReadRawData(IOBuffer* buf, int buf_size, int *bytes_read);
virtual bool GetMimeType(std::string* mime_type) const;
virtual bool GetCharset(std::string* charset);
- // DirectoryLister::DirectoryListerDelegate methods:
+ // Overridden from DirectoryLister::DirectoryListerDelegate:
virtual void OnListFile(
- const net::DirectoryLister::DirectoryListerData& data);
+ const DirectoryLister::DirectoryListerData& data);
virtual void OnListDone(int error);
bool list_complete() const { return list_complete_; }
@@ -47,7 +49,7 @@ class URLRequestFileDirJob
// Fills a buffer with the output.
bool FillReadBuffer(char *buf, int buf_size, int *bytes_read);
- scoped_refptr<net::DirectoryLister> lister_;
+ scoped_refptr<DirectoryLister> lister_;
FilePath dir_path_;
std::string data_;
bool canceled_;
@@ -62,11 +64,13 @@ class URLRequestFileDirJob
// we wait for IO to complete. When done, we fill the buffer
// manually.
bool read_pending_;
- scoped_refptr<net::IOBuffer> read_buffer_;
+ scoped_refptr<IOBuffer> read_buffer_;
int read_buffer_length_;
ScopedRunnableMethodFactory<URLRequestFileDirJob> method_factory_;
DISALLOW_COPY_AND_ASSIGN(URLRequestFileDirJob);
};
-#endif // NET_URL_REQUEST_URL_REQUEST_FILE_DIR_JOB_H__
+} // namespace net
+
+#endif // NET_URL_REQUEST_URL_REQUEST_FILE_DIR_JOB_H_