Skip to content

Commit

Permalink
Add FilePath to base namespace.
Browse files Browse the repository at this point in the history
This updates headers that forward-declare it and a few random places to use the namespace explicitly. There us a using declaration in file_path.h that makes the rest compile, which we can do in future passes.
Review URL: https://codereview.chromium.org/12163003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180245 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
brettw@chromium.org committed Feb 2, 2013
1 parent 8bc574c commit a3ef483
Show file tree
Hide file tree
Showing 636 changed files with 3,754 additions and 3,231 deletions.
2 changes: 1 addition & 1 deletion android_webview/browser/net/aw_network_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ bool AwNetworkDelegate::OnCanSetCookie(const net::URLRequest& request,
}

bool AwNetworkDelegate::OnCanAccessFile(const net::URLRequest& request,
const FilePath& path) const {
const base::FilePath& path) const {
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion android_webview/browser/net/aw_network_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class AwNetworkDelegate : public net::NetworkDelegate {
const std::string& cookie_line,
net::CookieOptions* options) OVERRIDE;
virtual bool OnCanAccessFile(const net::URLRequest& request,
const FilePath& path) const OVERRIDE;
const base::FilePath& path) const OVERRIDE;
virtual bool OnCanThrottleRequest(
const net::URLRequest& request) const OVERRIDE;
virtual int OnBeforeSocketStreamConnect(
Expand Down
3 changes: 2 additions & 1 deletion base/android/path_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@

#include "base/base_export.h"

namespace base {

class FilePath;

namespace base {
namespace android {

// Retrieves the absolute path to the data directory of the current
Expand Down
15 changes: 9 additions & 6 deletions base/command_line.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
#include "base/base_export.h"
#include "build/build_config.h"

namespace base {
class FilePath;
}

class BASE_EXPORT CommandLine {
public:
Expand All @@ -43,7 +45,7 @@ class BASE_EXPORT CommandLine {
explicit CommandLine(NoProgram no_program);

// Construct a new command line with |program| as argv[0].
explicit CommandLine(const FilePath& program);
explicit CommandLine(const base::FilePath& program);

// Construct a new command line from an argument list.
CommandLine(int argc, const CharType* const* argv);
Expand Down Expand Up @@ -92,8 +94,8 @@ class BASE_EXPORT CommandLine {
const StringVector& argv() const { return argv_; }

// Get and Set the program part of the command line string (the first item).
FilePath GetProgram() const;
void SetProgram(const FilePath& program);
base::FilePath GetProgram() const;
void SetProgram(const base::FilePath& program);

// Returns true if this command line contains the given switch.
// (Switch names are case-insensitive).
Expand All @@ -102,7 +104,7 @@ class BASE_EXPORT CommandLine {
// Returns the value associated with the given switch. If the switch has no
// value or isn't present, this method returns the empty string.
std::string GetSwitchValueASCII(const std::string& switch_string) const;
FilePath GetSwitchValuePath(const std::string& switch_string) const;
base::FilePath GetSwitchValuePath(const std::string& switch_string) const;
StringType GetSwitchValueNative(const std::string& switch_string) const;

// Get a copy of all switches, along with their values.
Expand All @@ -111,7 +113,8 @@ class BASE_EXPORT CommandLine {
// Append a switch [with optional value] to the command line.
// Note: Switches will precede arguments regardless of appending order.
void AppendSwitch(const std::string& switch_string);
void AppendSwitchPath(const std::string& switch_string, const FilePath& path);
void AppendSwitchPath(const std::string& switch_string,
const base::FilePath& path);
void AppendSwitchNative(const std::string& switch_string,
const StringType& value);
void AppendSwitchASCII(const std::string& switch_string,
Expand All @@ -131,7 +134,7 @@ class BASE_EXPORT CommandLine {
// AppendArg is primarily for ASCII; non-ASCII input is interpreted as UTF-8.
// Note: Switches will precede arguments regardless of appending order.
void AppendArg(const std::string& value);
void AppendArgPath(const FilePath& value);
void AppendArgPath(const base::FilePath& value);
void AppendArgNative(const StringType& value);

// Append the switches and arguments from another command line to this one.
Expand Down
4 changes: 2 additions & 2 deletions base/event_recorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
#include <windows.h>
#endif

class FilePath;

namespace base {

class FilePath;

// A class for recording and playing back keyboard and mouse input events.
//
// Note - if you record events, and the playback with the windows in
Expand Down
17 changes: 12 additions & 5 deletions base/file_path.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@
class Pickle;
class PickleIterator;

namespace base {

// An abstraction to isolate users from the differences between native
// pathnames on different platforms.
class BASE_EXPORT FilePath {
Expand Down Expand Up @@ -398,8 +400,13 @@ class BASE_EXPORT FilePath {
StringType path_;
};

} // namespace base

// TODO(brettw) remove this once callers properly use the base namespace.
using base::FilePath;

// This is required by googletest to print a readable output on test failures.
BASE_EXPORT extern void PrintTo(const FilePath& path, std::ostream* out);
BASE_EXPORT extern void PrintTo(const base::FilePath& path, std::ostream* out);

// Macros for string literal initialization of FilePath::CharType[], and for
// using a FilePath::CharType[] in a printf-style format string.
Expand All @@ -419,15 +426,15 @@ namespace BASE_HASH_NAMESPACE {
#if defined(COMPILER_GCC)

template<>
struct hash<FilePath> {
size_t operator()(const FilePath& f) const {
return hash<FilePath::StringType>()(f.value());
struct hash<base::FilePath> {
size_t operator()(const base::FilePath& f) const {
return hash<base::FilePath::StringType>()(f.value());
}
};

#elif defined(COMPILER_MSVC)

inline size_t hash_value(const FilePath& f) {
inline size_t hash_value(const base::FilePath& f) {
return hash_value(f.value());
}

Expand Down
Loading

0 comments on commit a3ef483

Please sign in to comment.