summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authormunjal@chromium.org <munjal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-13 19:40:59 +0000
committermunjal@chromium.org <munjal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-13 19:40:59 +0000
commit6d201be0c55eccdc015124e221d2559a6da7fef0 (patch)
tree121e988c25e62017a08bcbe908a4e6a5f78d34f8 /chrome/browser
parentdc9711fe5e00639471fd0edf195a4ada4f7d994d (diff)
downloadchromium_src-6d201be0c55eccdc015124e221d2559a6da7fef0.zip
chromium_src-6d201be0c55eccdc015124e221d2559a6da7fef0.tar.gz
chromium_src-6d201be0c55eccdc015124e221d2559a6da7fef0.tar.bz2
Part 1 of removing PathSTring. I scrubbed files that are not
in chron's CL to avoid merge. Review URL: http://codereview.chromium.org/393011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31930 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/sync/engine/auth_watcher.cc6
-rw-r--r--chrome/browser/sync/engine/auth_watcher.h2
-rw-r--r--chrome/browser/sync/engine/net/server_connection_manager.cc2
-rw-r--r--chrome/browser/sync/engine/net/server_connection_manager.h2
-rw-r--r--chrome/browser/sync/engine/sync_process_state.cc2
-rw-r--r--chrome/browser/sync/engine/sync_process_state.h7
-rw-r--r--chrome/browser/sync/engine/syncer_session.h3
-rw-r--r--chrome/browser/sync/syncable/directory_manager.cc8
-rw-r--r--chrome/browser/sync/syncable/directory_manager.h13
-rw-r--r--chrome/browser/sync/syncable/path_name_cmp.h6
-rw-r--r--chrome/browser/sync/util/character_set_converters.cc2
-rw-r--r--chrome/browser/sync/util/character_set_converters.h4
-rw-r--r--chrome/browser/sync/util/character_set_converters_unittest.cc4
-rw-r--r--chrome/browser/sync/util/crypto_helpers.cc4
-rw-r--r--chrome/browser/sync/util/crypto_helpers.h2
-rw-r--r--chrome/browser/sync/util/crypto_helpers_unittest.cc2
-rw-r--r--chrome/browser/sync/util/path_helpers.h2
-rw-r--r--chrome/browser/sync/util/path_helpers_posix.cc10
-rw-r--r--chrome/browser/sync/util/path_helpers_win.cc18
19 files changed, 54 insertions, 45 deletions
diff --git a/chrome/browser/sync/engine/auth_watcher.cc b/chrome/browser/sync/engine/auth_watcher.cc
index 1f78d15..b62c948 100644
--- a/chrome/browser/sync/engine/auth_watcher.cc
+++ b/chrome/browser/sync/engine/auth_watcher.cc
@@ -121,7 +121,7 @@ void AuthWatcher::DoAuthenticateWithToken(const std::string& gaia_email,
case Authenticator::SUCCESS:
{
status_ = GAIA_AUTHENTICATED;
- const PathString& share_name = email;
+ const std::string& share_name = email;
user_settings_->SwitchUser(email);
// Set the authentication token for notifications
@@ -163,7 +163,7 @@ bool AuthWatcher::AuthenticateLocally(string email) {
gaia_->SetUsername(email);
status_ = LOCALLY_AUTHENTICATED;
user_settings_->SwitchUser(email);
- const PathString& share_name = email;
+ const std::string& share_name = email;
LoadDirectoryListAndOpen(share_name);
NotifyAuthSucceeded(email);
return true;
@@ -289,7 +289,7 @@ void AuthWatcher::DoHandleServerConnectionEvent(
}
}
-bool AuthWatcher::LoadDirectoryListAndOpen(const PathString& login) {
+bool AuthWatcher::LoadDirectoryListAndOpen(const std::string& login) {
DCHECK_EQ(MessageLoop::current(), message_loop());
LOG(INFO) << "LoadDirectoryListAndOpen(" << login << ")";
bool initial_sync_ended = false;
diff --git a/chrome/browser/sync/engine/auth_watcher.h b/chrome/browser/sync/engine/auth_watcher.h
index 20760e4..e5422ad 100644
--- a/chrome/browser/sync/engine/auth_watcher.h
+++ b/chrome/browser/sync/engine/auth_watcher.h
@@ -96,7 +96,7 @@ class AuthWatcher : public base::RefCountedThreadSafe<AuthWatcher> {
// Returns true if the open share has gotten zero updates from the sync
// server (initial sync complete).
- bool LoadDirectoryListAndOpen(const PathString& login);
+ bool LoadDirectoryListAndOpen(const std::string& login);
typedef EventChannel<AuthWatcherEvent, Lock> Channel;
diff --git a/chrome/browser/sync/engine/net/server_connection_manager.cc b/chrome/browser/sync/engine/net/server_connection_manager.cc
index 38d140f..10c6aef 100644
--- a/chrome/browser/sync/engine/net/server_connection_manager.cc
+++ b/chrome/browser/sync/engine/net/server_connection_manager.cc
@@ -345,7 +345,7 @@ void ServerConnectionManager::GetServerParameters(string* server_url,
bool FillMessageWithShareDetails(sync_pb::ClientToServerMessage* csm,
syncable::DirectoryManager* manager,
- const PathString &share) {
+ const std::string& share) {
syncable::ScopedDirLookup dir(manager, share);
if (!dir.good()) {
LOG(INFO) << "Dir lookup failed";
diff --git a/chrome/browser/sync/engine/net/server_connection_manager.h b/chrome/browser/sync/engine/net/server_connection_manager.h
index 5773a44..c34d4ae 100644
--- a/chrome/browser/sync/engine/net/server_connection_manager.h
+++ b/chrome/browser/sync/engine/net/server_connection_manager.h
@@ -344,7 +344,7 @@ class ServerConnectionManager {
// settings.
bool FillMessageWithShareDetails(sync_pb::ClientToServerMessage* csm,
syncable::DirectoryManager* manager,
- const PathString &share);
+ const std::string& share);
} // namespace browser_sync
diff --git a/chrome/browser/sync/engine/sync_process_state.cc b/chrome/browser/sync/engine/sync_process_state.cc
index 7fe7415..b842f47 100644
--- a/chrome/browser/sync/engine/sync_process_state.cc
+++ b/chrome/browser/sync/engine/sync_process_state.cc
@@ -32,7 +32,7 @@ SyncProcessState::SyncProcessState(const SyncProcessState& counts)
}
SyncProcessState::SyncProcessState(syncable::DirectoryManager* dirman,
- PathString account_name,
+ std::string account_name,
ServerConnectionManager* connection_manager,
ConflictResolver* const resolver,
SyncerEventChannel* syncer_event_channel,
diff --git a/chrome/browser/sync/engine/sync_process_state.h b/chrome/browser/sync/engine/sync_process_state.h
index 4e63695..cefd22f 100644
--- a/chrome/browser/sync/engine/sync_process_state.h
+++ b/chrome/browser/sync/engine/sync_process_state.h
@@ -14,6 +14,7 @@
#include <map>
#include <set>
+#include <string>
#include <utility> // for pair<>
#include "base/atomicops.h"
@@ -37,7 +38,7 @@ class SyncProcessState {
~SyncProcessState();
SyncProcessState(
syncable::DirectoryManager* dirman,
- PathString account_name,
+ std::string account_name,
ServerConnectionManager* connection_manager,
ConflictResolver* const resolver,
SyncerEventChannel* syncer_event_channel,
@@ -47,7 +48,7 @@ class SyncProcessState {
SyncProcessState(const SyncProcessState& counts);
SyncProcessState& operator=(const SyncProcessState& that);
- PathString account_name() const { return account_name_; }
+ std::string account_name() const { return account_name_; }
syncable::DirectoryManager* dirman() const { return dirman_; }
@@ -251,7 +252,7 @@ class SyncProcessState {
auth_failed_(false) {}
ServerConnectionManager* connection_manager_;
- const PathString account_name_;
+ const std::string account_name_;
syncable::DirectoryManager* const dirman_;
ConflictResolver* const resolver_;
ModelSafeWorker* const model_safe_worker_;
diff --git a/chrome/browser/sync/engine/syncer_session.h b/chrome/browser/sync/engine/syncer_session.h
index d15f747..6b24098 100644
--- a/chrome/browser/sync/engine/syncer_session.h
+++ b/chrome/browser/sync/engine/syncer_session.h
@@ -11,6 +11,7 @@
#ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCER_SESSION_H_
#define CHROME_BROWSER_SYNC_ENGINE_SYNCER_SESSION_H_
+#include <string>
#include <utility>
#include <vector>
@@ -100,7 +101,7 @@ class SyncerSession {
return sync_cycle_state_->HasAppliedUpdates();
}
- PathString account_name() const {
+ std::string account_name() const {
return sync_process_state_->account_name();
}
diff --git a/chrome/browser/sync/syncable/directory_manager.cc b/chrome/browser/sync/syncable/directory_manager.cc
index d934f94..be3ed0a 100644
--- a/chrome/browser/sync/syncable/directory_manager.cc
+++ b/chrome/browser/sync/syncable/directory_manager.cc
@@ -48,7 +48,7 @@ DirectoryManager::~DirectoryManager() {
delete channel_;
}
-bool DirectoryManager::Open(const PathString& name) {
+bool DirectoryManager::Open(const std::string& name) {
bool was_open = false;
const DirOpenResult result = OpenImpl(name,
GetSyncDataDatabasePath(), &was_open);
@@ -67,7 +67,7 @@ bool DirectoryManager::Open(const PathString& name) {
}
// Opens a directory. Returns false on error.
-DirOpenResult DirectoryManager::OpenImpl(const PathString& name,
+DirOpenResult DirectoryManager::OpenImpl(const std::string& name,
const FilePath& path,
bool* was_open) {
bool opened = false;
@@ -96,7 +96,7 @@ DirOpenResult DirectoryManager::OpenImpl(const PathString& name,
// Marks a directory as closed. It might take a while until all the file
// handles and resources are freed by other threads.
-void DirectoryManager::Close(const PathString& name) {
+void DirectoryManager::Close(const std::string& name) {
// Erase from mounted and opened directory lists.
{
AutoLock lock(lock_);
@@ -131,7 +131,7 @@ void DirectoryManager::GetOpenDirectories(DirNames* result) {
}
ScopedDirLookup::ScopedDirLookup(DirectoryManager* dirman,
- const PathString& name) : dirman_(dirman) {
+ const std::string& name) : dirman_(dirman) {
dir_ = dirman->managed_directory_ &&
(ComparePathNames(name, dirman->managed_directory_->name()) == 0) ?
dirman->managed_directory_ : NULL;
diff --git a/chrome/browser/sync/syncable/directory_manager.h b/chrome/browser/sync/syncable/directory_manager.h
index 5d9a106..a977dde 100644
--- a/chrome/browser/sync/syncable/directory_manager.h
+++ b/chrome/browser/sync/syncable/directory_manager.h
@@ -12,6 +12,7 @@
#ifndef CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_MANAGER_H_
#define CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_MANAGER_H_
+#include <string>
#include <vector>
#include "base/atomicops.h"
@@ -36,7 +37,7 @@ struct DirectoryManagerEvent {
CLOSED_ALL,
SHUTDOWN,
} what_happened;
- PathString dirname;
+ std::string dirname;
DirOpenResult error; // Only for OPEN_FAILED.
typedef DirectoryManagerEvent EventType;
static inline bool IsChannelShutdownEvent(const EventType& event) {
@@ -60,23 +61,23 @@ class DirectoryManager {
// Opens a directory. Returns false on error.
// Name parameter is the the user's login,
// MUST already have been converted to a common case.
- bool Open(const PathString& name);
+ bool Open(const std::string& name);
// Marks a directory as closed. It might take a while until all the
// file handles and resources are freed by other threads.
- void Close(const PathString& name);
+ void Close(const std::string& name);
// Should be called at App exit.
void FinalSaveChangesForAll();
// Gets the list of currently open directory names.
- typedef std::vector<PathString> DirNames;
+ typedef std::vector<std::string> DirNames;
void GetOpenDirectories(DirNames* result);
Channel* channel() const { return channel_; }
protected:
- DirOpenResult OpenImpl(const PathString& name, const FilePath& path,
+ DirOpenResult OpenImpl(const std::string& name, const FilePath& path,
bool* was_open);
// Helpers for friend class ScopedDirLookup:
@@ -98,7 +99,7 @@ class DirectoryManager {
class ScopedDirLookup {
public:
- ScopedDirLookup(DirectoryManager* dirman, const PathString& name);
+ ScopedDirLookup(DirectoryManager* dirman, const std::string& name);
~ScopedDirLookup();
inline bool good() {
diff --git a/chrome/browser/sync/syncable/path_name_cmp.h b/chrome/browser/sync/syncable/path_name_cmp.h
index 1478a52..6c2e138 100644
--- a/chrome/browser/sync/syncable/path_name_cmp.h
+++ b/chrome/browser/sync/syncable/path_name_cmp.h
@@ -5,15 +5,17 @@
#ifndef CHROME_BROWSER_SYNC_SYNCABLE_PATH_NAME_CMP_H_
#define CHROME_BROWSER_SYNC_SYNCABLE_PATH_NAME_CMP_H_
+#include <string>
+
#include "chrome/browser/sync/util/sync_types.h"
namespace syncable {
struct LessPathNames {
- bool operator() (const PathString&, const PathString&) const;
+ bool operator() (const std::string&, const std::string&) const;
};
-int ComparePathNames(const PathString& a, const PathString& b);
+int ComparePathNames(const std::string& a, const std::string& b);
} // namespace syncable
diff --git a/chrome/browser/sync/util/character_set_converters.cc b/chrome/browser/sync/util/character_set_converters.cc
index 3c66c35..551ca2b 100644
--- a/chrome/browser/sync/util/character_set_converters.cc
+++ b/chrome/browser/sync/util/character_set_converters.cc
@@ -6,7 +6,7 @@
namespace browser_sync {
-void TrimPathStringToValidCharacter(PathString* string) {
+void TrimPathStringToValidCharacter(std::string* string) {
// Constants from http://en.wikipedia.org/wiki/UTF-8
CHECK(string);
if (string->empty())
diff --git a/chrome/browser/sync/util/character_set_converters.h b/chrome/browser/sync/util/character_set_converters.h
index 44aa8a7..b486f04 100644
--- a/chrome/browser/sync/util/character_set_converters.h
+++ b/chrome/browser/sync/util/character_set_converters.h
@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_SYNC_UTIL_CHARACTER_SET_CONVERTERS_H_
#define CHROME_BROWSER_SYNC_UTIL_CHARACTER_SET_CONVERTERS_H_
+#include <string>
+
#include "base/file_path.h"
#include "chrome/browser/sync/util/sync_types.h"
@@ -21,7 +23,7 @@ std::string FilePathToUTF8(const FilePath& file_path);
// Returns FilePath from the given UTF8 string.
FilePath UTF8ToFilePath(const std::string& utf8);
-void TrimPathStringToValidCharacter(PathString* string);
+void TrimPathStringToValidCharacter(std::string* string);
} // namespace browser_sync
diff --git a/chrome/browser/sync/util/character_set_converters_unittest.cc b/chrome/browser/sync/util/character_set_converters_unittest.cc
index 8e75539..aa8fa89 100644
--- a/chrome/browser/sync/util/character_set_converters_unittest.cc
+++ b/chrome/browser/sync/util/character_set_converters_unittest.cc
@@ -15,8 +15,8 @@ class CharacterSetConverterTest : public testing::Test {
TEST(NameTruncation, WindowsNameTruncation) {
using browser_sync::TrimPathStringToValidCharacter;
- PathChar array[] = {'1', '2', '\xc0', '\xe0', '3', '4', '\0'};
- PathString message = array;
+ char array[] = {'1', '2', '\xc0', '\xe0', '3', '4', '\0'};
+ std::string message(array);
ASSERT_EQ(message.length(), arraysize(array) - 1);
string::size_type old_length = message.length();
while (old_length != 0) {
diff --git a/chrome/browser/sync/util/crypto_helpers.cc b/chrome/browser/sync/util/crypto_helpers.cc
index f65301b..801002c 100644
--- a/chrome/browser/sync/util/crypto_helpers.cc
+++ b/chrome/browser/sync/util/crypto_helpers.cc
@@ -38,12 +38,12 @@ vector<uint8> MD5Calculator::GetDigest() {
return bin_digest_;
}
-PathString MD5Calculator::GetHexDigest() {
+std::string MD5Calculator::GetHexDigest() {
CalcDigest();
string hex = HexEncode(reinterpret_cast<char*>(&bin_digest_.front()),
bin_digest_.size());
StringToLowerASCII(&hex);
- return PathString(hex.begin(), hex.end());
+ return hex;
}
void GetRandomBytes(char* output, int output_length) {
diff --git a/chrome/browser/sync/util/crypto_helpers.h b/chrome/browser/sync/util/crypto_helpers.h
index c31a278..704fed6 100644
--- a/chrome/browser/sync/util/crypto_helpers.h
+++ b/chrome/browser/sync/util/crypto_helpers.h
@@ -28,7 +28,7 @@ class MD5Calculator {
void AddData(const char* data, int length) {
AddData(reinterpret_cast<const uint8*>(data), length);
}
- PathString GetHexDigest();
+ std::string GetHexDigest();
std::vector<uint8> GetDigest();
private:
DISALLOW_COPY_AND_ASSIGN(MD5Calculator);
diff --git a/chrome/browser/sync/util/crypto_helpers_unittest.cc b/chrome/browser/sync/util/crypto_helpers_unittest.cc
index 1d2dd60..0277ae6 100644
--- a/chrome/browser/sync/util/crypto_helpers_unittest.cc
+++ b/chrome/browser/sync/util/crypto_helpers_unittest.cc
@@ -12,6 +12,6 @@ TEST(ChecksumTest, MD5ChecksumTest) {
}
MD5Calculator md5;
md5.AddData(buffer, arraysize(buffer));
- PathString checksum(PSTR("e2c865db4162bed963bfaa9ef6ac18f0"));
+ std::string checksum("e2c865db4162bed963bfaa9ef6ac18f0");
ASSERT_EQ(checksum, md5.GetHexDigest());
}
diff --git a/chrome/browser/sync/util/path_helpers.h b/chrome/browser/sync/util/path_helpers.h
index 5ebf465..c212fa8 100644
--- a/chrome/browser/sync/util/path_helpers.h
+++ b/chrome/browser/sync/util/path_helpers.h
@@ -75,6 +75,6 @@ class PathSegmentIterator : public std::iterator<std::forward_iterator_tag,
// on mac/linux we let names stay unicode normalization form C in the system
// and convert to another normal form in fuse handlers. but, if a '/' is in
// a filename, we handle it here.
-PathString MakePathComponentOSLegal(const PathString& component);
+std::string MakePathComponentOSLegal(const std::string& component);
#endif // CHROME_BROWSER_SYNC_UTIL_PATH_HELPERS_H_
diff --git a/chrome/browser/sync/util/path_helpers_posix.cc b/chrome/browser/sync/util/path_helpers_posix.cc
index c954271..db6100b 100644
--- a/chrome/browser/sync/util/path_helpers_posix.cc
+++ b/chrome/browser/sync/util/path_helpers_posix.cc
@@ -10,11 +10,13 @@
#error Compile this file on Mac OS X or Linux only.
#endif
+using std::string;
+
// Convert /s to :s.
-PathString MakePathComponentOSLegal(const PathString& component) {
- if (PathString::npos == component.find("/"))
- return PSTR("");
- PathString new_name(component);
+string MakePathComponentOSLegal(const string& component) {
+ if (string::npos == component.find("/"))
+ return "";
+ string new_name(component);
std::replace(new_name.begin(), new_name.end(), '/', ':');
return new_name;
}
diff --git a/chrome/browser/sync/util/path_helpers_win.cc b/chrome/browser/sync/util/path_helpers_win.cc
index 8fe60df..94bfb84 100644
--- a/chrome/browser/sync/util/path_helpers_win.cc
+++ b/chrome/browser/sync/util/path_helpers_win.cc
@@ -19,7 +19,7 @@
using std::string;
namespace {
-const PathString kWindowsIllegalBaseFilenames[] = {
+const string kWindowsIllegalBaseFilenames[] = {
"CON", "PRN", "AUX", "NUL", "COM1", "COM2",
"COM3", "COM4", "COM5", "COM6", "COM7",
"COM8", "COM9", "LPT1", "LPT2", "LPT3",
@@ -31,14 +31,14 @@ const PathString kWindowsIllegalBaseFilenames[] = {
// en-us/fileio/fs/naming_a_file.asp
// note that * and ? are not listed on the page as illegal characters,
// but they are.
-PathString MakePathComponentOSLegal(const PathString& component) {
+string MakePathComponentOSLegal(const string& component) {
CHECK(!component.empty());
- PathString mutable_component = component;
+ string mutable_component = component;
// Remove illegal characters.
- for (PathString::iterator i = mutable_component.begin();
+ for (string::iterator i = mutable_component.begin();
i != mutable_component.end();) {
- if ((PathString::npos != PathString("<>:\"/\\|*?").find(*i)) ||
+ if ((string::npos != string("<>:\"/\\|*?").find(*i)) ||
((static_cast<unsigned short>(*i) >= 0) &&
(static_cast<unsigned short>(*i) <= 31))) {
mutable_component.erase(i);
@@ -61,11 +61,11 @@ PathString MakePathComponentOSLegal(const PathString& component) {
// From this point out, we break mutable_component into two strings, and use
// them this way: we save anything after and including the first dot (usually
// the extension) and only mess with stuff before the first dot.
- PathString::size_type first_dot = mutable_component.find_first_of('.');
- if (PathString::npos == first_dot)
+ string::size_type first_dot = mutable_component.find_first_of('.');
+ if (string::npos == first_dot)
first_dot = mutable_component.size();
- PathString sub = mutable_component.substr(0, first_dot);
- PathString postsub = mutable_component.substr(first_dot);
+ string sub = mutable_component.substr(0, first_dot);
+ string postsub = mutable_component.substr(first_dot);
CHECK(sub + postsub == mutable_component);
for (int i = 0; i < ARRAYSIZE(kWindowsIllegalBaseFilenames); i++) {
// ComparePathNames(a, b) == 0 -> same