Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Side by Side Diff: chrome/browser/sync/engine/syncapi.cc

Issue 429003: Final part of PathString cleanup. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/sync/engine/syncapi.h" 5 #include "chrome/browser/sync/engine/syncapi.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 private: 128 private:
129 AddressWatchTaskParams* const params_; 129 AddressWatchTaskParams* const params_;
130 DISALLOW_COPY_AND_ASSIGN(AddressWatchTask); 130 DISALLOW_COPY_AND_ASSIGN(AddressWatchTask);
131 }; 131 };
132 132
133 namespace sync_api { 133 namespace sync_api {
134 class ModelSafeWorkerBridge; 134 class ModelSafeWorkerBridge;
135 135
136 static const FilePath::CharType kBookmarkSyncUserSettingsDatabase[] = 136 static const FilePath::CharType kBookmarkSyncUserSettingsDatabase[] =
137 FILE_PATH_LITERAL("BookmarkSyncSettings.sqlite3"); 137 FILE_PATH_LITERAL("BookmarkSyncSettings.sqlite3");
138 static const PSTR_CHAR kDefaultNameForNewNodes[] = PSTR(" "); 138 static const char kDefaultNameForNewNodes[] = " ";
139 139
140 // The list of names which are reserved for use by the server. 140 // The list of names which are reserved for use by the server.
141 static const char* kForbiddenServerNames[] = { "", ".", ".." }; 141 static const char* kForbiddenServerNames[] = { "", ".", ".." };
142 142
143 ////////////////////////////////////////////////////////////////////////// 143 //////////////////////////////////////////////////////////////////////////
144 // Static helper functions. 144 // Static helper functions.
145 145
146 // Helper function to look up the int64 metahandle of an object given the ID 146 // Helper function to look up the int64 metahandle of an object given the ID
147 // string. 147 // string.
148 static int64 IdToMetahandle(syncable::BaseTransaction* trans, 148 static int64 IdToMetahandle(syncable::BaseTransaction* trans,
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 return; // Skip redundant changes. 307 return; // Skip redundant changes.
308 308
309 entry_->Put(syncable::IS_DIR, folder); 309 entry_->Put(syncable::IS_DIR, folder);
310 MarkForSyncing(); 310 MarkForSyncing();
311 } 311 }
312 312
313 void WriteNode::SetTitle(const std::wstring& title) { 313 void WriteNode::SetTitle(const std::wstring& title) {
314 std::string server_legal_name; 314 std::string server_legal_name;
315 SyncAPINameToServerName(title, &server_legal_name); 315 SyncAPINameToServerName(title, &server_legal_name);
316 316
317 PathString old_name = entry_->Get(syncable::NON_UNIQUE_NAME); 317 string old_name = entry_->Get(syncable::NON_UNIQUE_NAME);
318 318
319 if (server_legal_name == old_name) 319 if (server_legal_name == old_name)
320 return; // Skip redundant changes. 320 return; // Skip redundant changes.
321 321
322 entry_->Put(syncable::NON_UNIQUE_NAME, server_legal_name); 322 entry_->Put(syncable::NON_UNIQUE_NAME, server_legal_name);
323 MarkForSyncing(); 323 MarkForSyncing();
324 } 324 }
325 325
326 void WriteNode::SetURL(const GURL& url) { 326 void WriteNode::SetURL(const GURL& url) {
327 const std::string& url_string = url.spec(); 327 const std::string& url_string = url.spec();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 // |predecessor| must be a child of |parent| or NULL. 364 // |predecessor| must be a child of |parent| or NULL.
365 if (predecessor && predecessor->GetParentId() != parent.GetId()) { 365 if (predecessor && predecessor->GetParentId() != parent.GetId()) {
366 DCHECK(false); 366 DCHECK(false);
367 return false; 367 return false;
368 } 368 }
369 369
370 syncable::Id parent_id = parent.GetEntry()->Get(syncable::ID); 370 syncable::Id parent_id = parent.GetEntry()->Get(syncable::ID);
371 371
372 // Start out with a dummy name. We expect 372 // Start out with a dummy name. We expect
373 // the caller to set a meaningful name after creation. 373 // the caller to set a meaningful name after creation.
374 PathString dummy(kDefaultNameForNewNodes); 374 string dummy(kDefaultNameForNewNodes);
375 375
376 entry_ = new syncable::MutableEntry(transaction_->GetWrappedWriteTrans(), 376 entry_ = new syncable::MutableEntry(transaction_->GetWrappedWriteTrans(),
377 syncable::CREATE, parent_id, dummy); 377 syncable::CREATE, parent_id, dummy);
378 378
379 if (!entry_->good()) 379 if (!entry_->good())
380 return false; 380 return false;
381 381
382 // Entries are untitled folders by default. 382 // Entries are untitled folders by default.
383 entry_->Put(syncable::IS_DIR, true); 383 entry_->Put(syncable::IS_DIR, true);
384 // TODO(ncarter): Naming this bit IS_BOOKMARK_OBJECT is a bit unfortunate, 384 // TODO(ncarter): Naming this bit IS_BOOKMARK_OBJECT is a bit unfortunate,
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 BaseTransaction::~BaseTransaction() { 1501 BaseTransaction::~BaseTransaction() {
1502 delete lookup_; 1502 delete lookup_;
1503 } 1503 }
1504 1504
1505 UserShare* SyncManager::GetUserShare() const { 1505 UserShare* SyncManager::GetUserShare() const {
1506 DCHECK(data_->initialized()) << "GetUserShare requires initialization!"; 1506 DCHECK(data_->initialized()) << "GetUserShare requires initialization!";
1507 return data_->GetUserShare(); 1507 return data_->GetUserShare();
1508 } 1508 }
1509 1509
1510 } // namespace sync_api 1510 } // namespace sync_api
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/process_commit_response_command.cc ('k') | chrome/browser/sync/engine/syncer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698