diff options
author | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-11 02:36:34 +0000 |
---|---|---|
committer | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-11 02:36:34 +0000 |
commit | 92ad2cd7566835836b0dc3b66c719e9bfe08e6af (patch) | |
tree | cff9514cf67a4b795847c7313d007a8c45308a55 | |
parent | a80dac4df5c030169f05ea207bdae06f82e656c3 (diff) | |
download | chromium_src-92ad2cd7566835836b0dc3b66c719e9bfe08e6af.zip chromium_src-92ad2cd7566835836b0dc3b66c719e9bfe08e6af.tar.gz chromium_src-92ad2cd7566835836b0dc3b66c719e9bfe08e6af.tar.bz2 |
Build browser/sync files by default using a stubbed-out syncapi
implementation. The stub will be replaced once the rest of
sync/engine lands as we open source the sync engine code.
Review URL: http://codereview.chromium.org/165257
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23004 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | build/common.gypi | 18 | ||||
-rw-r--r-- | chrome/browser/dom_ui/new_tab_ui.cc | 2 | ||||
-rw-r--r-- | chrome/browser/gtk/options/options_window_gtk.cc | 2 | ||||
-rw-r--r-- | chrome/browser/profile.cc | 2 | ||||
-rw-r--r-- | chrome/browser/sync/engine/syncapi.h | 2 | ||||
-rw-r--r-- | chrome/browser/sync/engine/syncapi_stub.cc | 305 | ||||
-rw-r--r-- | chrome/browser/sync/personalization.cc | 8 | ||||
-rw-r--r-- | chrome/browser/sync/personalization.h | 2 | ||||
-rw-r--r-- | chrome/browser/sync/profile_sync_service_unittest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/toolbar_view.cc | 2 | ||||
-rw-r--r-- | chrome/chrome.gyp | 9 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 3 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 2 |
13 files changed, 344 insertions, 15 deletions
diff --git a/build/common.gypi b/build/common.gypi index 9d734fa..d9d35dc 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -94,7 +94,11 @@ 'chromeos%': 0, - 'chrome_personalization%': 0, + # Whether or not browser sync code is built in. + 'chrome_personalization%': 1, + + # Used to build and statically link a stub (no-op) syncapi engine. + 'use_syncapi_stub%' : 1, # Set the restrictions on the SUID sandbox binary. # Path: only exec the hard coded chrome binary path @@ -180,8 +184,16 @@ 'defines': ['OS_CHROMEOS=1'], }], ['chrome_personalization==1', { - 'defines': ['CHROME_PERSONALIZATION=1'], - }], + 'conditions': [ + ['OS=="win"', { + # For now sync is only enabled on windows. + 'defines': ['CHROME_PERSONALIZATION=1'], + }], # OS==win + ], # conditions for chrome_personalization + }], # chrome_personalization==1 + ['use_syncapi_stub==1', { + 'defines': ['COMPILING_SYNCAPI_STUB'], + }], # use_syncapi_stub==1 ['coverage!=0', { 'conditions': [ ['OS=="mac"', { diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc index e3f2f62..fae0081 100644 --- a/chrome/browser/dom_ui/new_tab_ui.cc +++ b/chrome/browser/dom_ui/new_tab_ui.cc @@ -1551,7 +1551,7 @@ NewTabUI::NewTabUI(TabContents* contents) } #ifdef CHROME_PERSONALIZATION - if (!Personalization::IsP13NDisabled(GetProfile())) { + if (Personalization::IsSyncEnabled(GetProfile())) { AddMessageHandler(Personalization::CreateNewTabPageHandler(this)); } #endif diff --git a/chrome/browser/gtk/options/options_window_gtk.cc b/chrome/browser/gtk/options/options_window_gtk.cc index 8ee1591..23dd38e 100644 --- a/chrome/browser/gtk/options/options_window_gtk.cc +++ b/chrome/browser/gtk/options/options_window_gtk.cc @@ -117,7 +117,7 @@ OptionsWindowGtk::OptionsWindowGtk(Profile* profile) l10n_util::GetStringUTF8(IDS_OPTIONS_CONTENT_TAB_LABEL).c_str())); #ifdef CHROME_PERSONALIZATION - if (!Personalization::IsP13NDisabled(profile)) { + if (Personalization::IsSyncEnabled(profile)) { gtk_notebook_append_page( GTK_NOTEBOOK(notebook_), gtk_label_new("TODO personalization"), diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc index f468bfa..6304c2b 100644 --- a/chrome/browser/profile.cc +++ b/chrome/browser/profile.cc @@ -518,7 +518,7 @@ ProfileImpl::ProfileImpl(const FilePath& path) prefs->AddPrefObserver(prefs::kEnableAutoSpellCorrect, this); #ifdef CHROME_PERSONALIZATION - if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableP13n)) + if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableSync)) personalization_.reset(Personalization::CreateProfilePersonalization(this)); #endif diff --git a/chrome/browser/sync/engine/syncapi.h b/chrome/browser/sync/engine/syncapi.h index da50cc2..3b02004 100644 --- a/chrome/browser/sync/engine/syncapi.h +++ b/chrome/browser/sync/engine/syncapi.h @@ -51,6 +51,8 @@ typedef uint16 sync_char16; #if (defined(OS_WIN) || defined(OS_WINDOWS)) #if COMPILING_SYNCAPI_LIBRARY #define SYNC_EXPORT __declspec(dllexport) +#elif COMPILING_SYNCAPI_STUB +#define SYNC_EXPORT #else #define SYNC_EXPORT __declspec(dllimport) #endif diff --git a/chrome/browser/sync/engine/syncapi_stub.cc b/chrome/browser/sync/engine/syncapi_stub.cc new file mode 100644 index 0000000..41ad4a9 --- /dev/null +++ b/chrome/browser/sync/engine/syncapi_stub.cc @@ -0,0 +1,305 @@ +// Copyright (c) 2006-2008 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. + +#ifdef CHROME_PERSONALIZATION + +#include "base/logging.h" +#include "chrome/browser/sync/engine/syncapi.h" + +namespace sync_api { + +struct BaseNode::BaseNodeInternal { +}; + +struct UserShare { +}; + +class SyncInternal { + DISALLOW_COPY_AND_ASSIGN(SyncInternal); +}; + +// BaseNode. +BaseNode::BaseNode() : data_(NULL) {} +BaseNode::~BaseNode() {} +int64 BaseNode::GetParentId() const { + NOTIMPLEMENTED(); + return 0; +} + +int64 BaseNode::GetId() const { + NOTIMPLEMENTED(); + return 0; +} + +bool BaseNode::GetIsFolder() const { + NOTIMPLEMENTED(); + return false; +} + +const sync_char16* BaseNode::GetTitle() const { + NOTIMPLEMENTED(); + return NULL; +} + +const sync_char16* BaseNode::GetURL() const { + NOTIMPLEMENTED(); + return NULL; +} + +const int64* BaseNode::GetChildIds(size_t* child_count) const { + NOTIMPLEMENTED(); + return NULL; +} + +int64 BaseNode::GetPredecessorId() const { + NOTIMPLEMENTED(); + return 0; +} + +int64 BaseNode::GetSuccessorId() const { + NOTIMPLEMENTED(); + return 0; +} + +int64 BaseNode::GetFirstChildId() const { + NOTIMPLEMENTED(); + return 0; +} + +const unsigned char* BaseNode::GetFaviconBytes(size_t* size_in_bytes) { + NOTIMPLEMENTED(); + return NULL; +} + +int64 BaseNode::GetExternalId() const { + NOTIMPLEMENTED(); + return 0; +} + + +//////////////////////////////////// +// WriteNode member definitions +void WriteNode::SetIsFolder(bool folder) { + NOTIMPLEMENTED(); +} + +void WriteNode::SetTitle(const sync_char16* title) { + NOTIMPLEMENTED(); +} + +void WriteNode::SetURL(const sync_char16* url) { + NOTIMPLEMENTED(); +} + +void WriteNode::SetExternalId(int64 id) { + NOTIMPLEMENTED(); +} + +WriteNode::WriteNode(WriteTransaction* transaction) + : entry_(NULL), transaction_(NULL) { + NOTIMPLEMENTED(); +} + +WriteNode::~WriteNode() { + NOTIMPLEMENTED(); +} + +bool WriteNode::InitByIdLookup(int64 id) { + NOTIMPLEMENTED(); + return false; +} + +bool WriteNode::InitByCreation(const BaseNode& parent, + const BaseNode* predecessor) { + NOTIMPLEMENTED(); + return false; +} + +bool WriteNode::SetPosition(const BaseNode& new_parent, + const BaseNode* predecessor) { + NOTIMPLEMENTED(); + return false; +} + +const syncable::Entry* WriteNode::GetEntry() const { + NOTIMPLEMENTED(); + return NULL; +} + +const BaseTransaction* WriteNode::GetTransaction() const { + NOTIMPLEMENTED(); + return NULL; +} + +void WriteNode::Remove() { + NOTIMPLEMENTED(); +} + +void WriteNode::PutPredecessor(const BaseNode* predecessor) { + NOTIMPLEMENTED(); +} + +void WriteNode::SetFaviconBytes(const unsigned char* bytes, + size_t size_in_bytes) { + NOTIMPLEMENTED(); +} + +void WriteNode::MarkForSyncing() { + NOTIMPLEMENTED(); +} + +////////////////////////////////////////////////////////////////////////// +// ReadNode member definitions +ReadNode::ReadNode(const BaseTransaction* transaction) + : entry_(NULL), transaction_(NULL) { + NOTIMPLEMENTED(); +} + +ReadNode::~ReadNode() { + NOTIMPLEMENTED(); +} + +void ReadNode::InitByRootLookup() { + NOTIMPLEMENTED(); +} + +bool ReadNode::InitByIdLookup(int64 id) { + NOTIMPLEMENTED(); + return false; +} + +const syncable::Entry* ReadNode::GetEntry() const { + NOTIMPLEMENTED(); + return NULL; +} + +const BaseTransaction* ReadNode::GetTransaction() const { + NOTIMPLEMENTED(); + return NULL; +} + +bool ReadNode::InitByTagLookup(const sync_char16* tag) { + NOTIMPLEMENTED(); + return false; +} + +////////////////////////////////////////////////////////////////////////// +// ReadTransaction member definitions +ReadTransaction::ReadTransaction(UserShare* share) : BaseTransaction(NULL), + transaction_(NULL) { + NOTIMPLEMENTED(); +} + +ReadTransaction::~ReadTransaction() { + NOTIMPLEMENTED(); +} + +syncable::BaseTransaction* ReadTransaction::GetWrappedTrans() const { + NOTIMPLEMENTED(); + return NULL; +} + +////////////////////////////////////////////////////////////////////////// +// WriteTransaction member definitions +WriteTransaction::WriteTransaction(UserShare* share) : BaseTransaction(NULL), + transaction_(NULL) { + NOTIMPLEMENTED(); +} + +WriteTransaction::~WriteTransaction() { + NOTIMPLEMENTED(); +} + +syncable::BaseTransaction* WriteTransaction::GetWrappedTrans() const { + NOTIMPLEMENTED(); + return NULL; +} + +// SyncManager + +SyncManager::SyncManager() { + NOTIMPLEMENTED(); +} + +bool SyncManager::Init(const sync_char16* database_location, + const char* sync_server_and_path, + int sync_server_port, + const char* gaia_service_id, + const char* gaia_source, + bool use_ssl, + HttpPostProviderFactory* post_factory, + HttpPostProviderFactory* auth_post_factory, + ModelSafeWorkerInterface* model_safe_worker, + bool attempt_last_user_authentication, + const char* user_agent) { + NOTIMPLEMENTED(); + return false; +} + +void SyncManager::Authenticate(const char* username, const char* password) { + NOTIMPLEMENTED(); +} + +const char* SyncManager::GetAuthenticatedUsername() { + NOTIMPLEMENTED(); + return NULL; +} + +SyncManager::~SyncManager() { + NOTIMPLEMENTED(); +} + +void SyncManager::SetObserver(Observer* observer) { + NOTIMPLEMENTED(); +} + +void SyncManager::RemoveObserver() { + NOTIMPLEMENTED(); +} + +void SyncManager::Shutdown() { + NOTIMPLEMENTED(); +} + +SyncManager::Status::Summary SyncManager::GetStatusSummary() const { + NOTIMPLEMENTED(); + return SyncManager::Status::INVALID; +} + +SyncManager::Status SyncManager::GetDetailedStatus() const { + NOTIMPLEMENTED(); + return SyncManager::Status(); +} + +SyncManager::SyncInternal* SyncManager::GetImpl() const { + NOTIMPLEMENTED(); + return NULL; +} + +void SyncManager::SaveChanges() { + NOTIMPLEMENTED(); +} + +void SyncManager::SetupForTestMode(const sync_char16* test_username) { + NOTIMPLEMENTED(); +} + +////////////////////////////////////////////////////////////////////////// +// BaseTransaction member definitions +BaseTransaction::BaseTransaction(UserShare* share) : lookup_(NULL) { + NOTIMPLEMENTED(); +} +BaseTransaction::~BaseTransaction() { + NOTIMPLEMENTED(); +} + +UserShare* SyncManager::GetUserShare() const { + NOTIMPLEMENTED(); + return NULL; +} + +} // namespace sync_api + +#endif // CHROME_PERSONALIZATION + diff --git a/chrome/browser/sync/personalization.cc b/chrome/browser/sync/personalization.cc index 8e8b6a6b..8f0fc76 100644 --- a/chrome/browser/sync/personalization.cc +++ b/chrome/browser/sync/personalization.cc @@ -79,11 +79,11 @@ static std::wstring MakeAuthErrorText(AuthErrorState state) { } } -bool IsP13NDisabled(Profile* profile) { +bool IsSyncEnabled(Profile* profile) { const CommandLine* command_line = CommandLine::ForCurrentProcess(); - if (command_line->HasSwitch(switches::kDisableP13n)) - return true; - return !profile || profile->GetProfilePersonalization() == NULL; + if (!command_line->HasSwitch(switches::kEnableSync)) + return false; + return profile && profile->GetProfilePersonalization() != NULL; } bool NeedsDOMUI(const GURL& url) { diff --git a/chrome/browser/sync/personalization.h b/chrome/browser/sync/personalization.h index 57decf5..f278d28d 100644 --- a/chrome/browser/sync/personalization.h +++ b/chrome/browser/sync/personalization.h @@ -64,7 +64,7 @@ namespace Personalization { // Checks if P13N is globally disabled or not, and that |profile| has a valid // ProfilePersonalization member (it can be NULL for TestingProfiles). -bool IsP13NDisabled(Profile* profile); +bool IsSyncEnabled(Profile* profile); // Returns whether |url| should be loaded in a DOMUI. bool NeedsDOMUI(const GURL& url); diff --git a/chrome/browser/sync/profile_sync_service_unittest.cc b/chrome/browser/sync/profile_sync_service_unittest.cc index a4d1421..022dbeb 100644 --- a/chrome/browser/sync/profile_sync_service_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_unittest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #ifdef CHROME_PERSONALIZATION +#ifndef COMPILING_SYNCAPI_STUB // This test requires the real deal syncapi. #include <stack> #include <vector> @@ -1270,4 +1271,5 @@ TEST_F(ProfileSyncServiceTestWithData, RecoverAfterDeletingSyncDataDirectory) { ExpectModelMatch(); } +#endif // COMPILING_SYNCAPI_STUB #endif // CHROME_PERSONALIZATION diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index 68f5f35..dce39b1 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -1085,7 +1085,7 @@ void ToolbarView::CreateAppMenu() { IDS_SHOW_DOWNLOADS); app_menu_contents_->AddSeparator(); #ifdef CHROME_PERSONALIZATION - if (!Personalization::IsP13NDisabled(profile_)) { + if (Personalization::IsSyncEnabled(profile_)) { app_menu_contents_->AddItem( IDC_P13N_INFO, Personalization::GetMenuItemInfoText(browser())); diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index f2cacd0..4e0d2e7 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -2225,6 +2225,13 @@ 'msvs_precompiled_source': 'tools/build/win/precompiled_wtl.cc', }, }, + 'conditions': [ + ['use_syncapi_stub==1', { + 'sources': [ + 'browser/sync/engine/syncapi_stub.cc', + ], + }] # use_syncapi_stub==1 + ], }, { # 'OS!="win" 'sources/': [ # Exclude all of hang_monitor. @@ -4923,7 +4930,7 @@ # Windows-only for now; this has issues with scons # regarding use of run_all_unittests.cc. # TODO(zork): add target to linux build. - 'target_name': 'live_sync_tests', + 'target_name': 'sync_integration_tests', 'type': 'executable', 'dependencies': [ 'browser', diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 6b58fae..f6e0678 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -372,7 +372,8 @@ const wchar_t kGearsPluginPathOverride[] = L"gears-plugin-path"; // Enable the fastback page cache. const wchar_t kEnableFastback[] = L"enable-fastback"; -const wchar_t kDisableP13n[] = L"disable-p13n"; +// Enable syncing bookmarks to a Google Account. +const wchar_t kEnableSync[] = L"enable-sync"; // Enable support for SDCH filtering (dictionary based expansion of content). // Optional argument is *the* only domain name that will have SDCH suppport. diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index cd99855..4465096 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -135,7 +135,7 @@ extern const wchar_t kGearsPluginPathOverride[]; extern const wchar_t kEnableFastback[]; -extern const wchar_t kDisableP13n[]; +extern const wchar_t kEnableSync[]; extern const wchar_t kSdchFilter[]; |