diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-03-08 10:28:10 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-03-20 13:40:30 +0000 |
commit | e733310db58160074f574c429d48f8308c0afe17 (patch) | |
tree | f8aef4b7e62a69928dbcf880620eece20f98c6df /chromium/components/sync_sessions | |
parent | 2f583e4aec1ae3a86fa047829c96b310dc12ecdf (diff) | |
download | qtwebengine-chromium-e733310db58160074f574c429d48f8308c0afe17.tar.gz |
BASELINE: Update Chromium to 56.0.2924.122
Change-Id: I4e04de8f47e47e501c46ed934c76a431c6337ced
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/components/sync_sessions')
16 files changed, 80 insertions, 53 deletions
diff --git a/chromium/components/sync_sessions/BUILD.gn b/chromium/components/sync_sessions/BUILD.gn index 1515037ebfe..20b6578889f 100644 --- a/chromium/components/sync_sessions/BUILD.gn +++ b/chromium/components/sync_sessions/BUILD.gn @@ -114,9 +114,9 @@ source_set("unit_tests") { "//components/prefs:test_support", "//components/sessions:test_support", "//components/sync", - "//components/sync:test_support_sync_api", - "//components/sync:test_support_sync_core", - "//components/sync:test_support_sync_driver", + "//components/sync:test_support_driver", + "//components/sync:test_support_engine", + "//components/sync:test_support_model", "//testing/gmock", "//testing/gtest", "//ui/base:base", diff --git a/chromium/components/sync_sessions/PRESUBMIT.py b/chromium/components/sync_sessions/PRESUBMIT.py index 70dee3d1689..39f2f9ac418 100644 --- a/chromium/components/sync_sessions/PRESUBMIT.py +++ b/chromium/components/sync_sessions/PRESUBMIT.py @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -"""Top-level presubmit script for sync_sessions. +"""Presubmit script for sync_sessions component. See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for more details about the presubmit API built into depot_tools. @@ -10,16 +10,22 @@ for more details about the presubmit API built into depot_tools. import re -SYNC_SESSIONS_SOURCE_FILES=(r'^components[\\/]sync_sessions[\\/].*\.(cc|h)$',) +SYNC_SESSIONS_SOURCE_FILES = (r'^components[\\/]sync_sessions[\\/].*\.(cc|h)$',) def CheckChangeLintsClean(input_api, output_api): source_filter = lambda x: input_api.FilterSourceFile( x, white_list=SYNC_SESSIONS_SOURCE_FILES, black_list=None) - return input_api.canned_checks.CheckChangeLintsClean( input_api, output_api, source_filter, lint_filters=[], verbose_level=1) -def CheckChangeOnUpload(input_api, output_api): +def CheckChanges(input_api, output_api): results = [] results += CheckChangeLintsClean(input_api, output_api) + results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api) return results + +def CheckChangeOnUpload(input_api, output_api): + return CheckChanges(input_api, output_api) + +def CheckChangeOnCommit(input_api, output_api): + return CheckChanges(input_api, output_api) diff --git a/chromium/components/sync_sessions/favicon_cache.cc b/chromium/components/sync_sessions/favicon_cache.cc index 52e48cfe5da..dff0ae06cca 100644 --- a/chromium/components/sync_sessions/favicon_cache.cc +++ b/chromium/components/sync_sessions/favicon_cache.cc @@ -12,7 +12,7 @@ #include "base/threading/thread_task_runner_handle.h" #include "components/favicon/core/favicon_service.h" #include "components/history/core/browser/history_service.h" -#include "components/sync/api/time.h" +#include "components/sync/model/time.h" #include "components/sync/protocol/favicon_image_specifics.pb.h" #include "components/sync/protocol/favicon_tracking_specifics.pb.h" #include "components/sync/protocol/sync.pb.h" @@ -58,7 +58,7 @@ struct LocalFaviconUpdateInfo { : new_image(false), new_tracking(false), image_needs_rewrite(false), - favicon_info(NULL) {} + favicon_info(nullptr) {} bool new_image; bool new_tracking; diff --git a/chromium/components/sync_sessions/favicon_cache.h b/chromium/components/sync_sessions/favicon_cache.h index c5bb13b8dc6..e35611e557b 100644 --- a/chromium/components/sync_sessions/favicon_cache.h +++ b/chromium/components/sync_sessions/favicon_cache.h @@ -26,9 +26,9 @@ #include "components/history/core/browser/history_service_observer.h" #include "components/history/core/browser/history_types.h" #include "components/sessions/core/session_id.h" -#include "components/sync/api/sync_change.h" -#include "components/sync/api/sync_error_factory.h" -#include "components/sync/api/syncable_service.h" +#include "components/sync/model/sync_change.h" +#include "components/sync/model/sync_error_factory.h" +#include "components/sync/model/syncable_service.h" #include "url/gurl.h" namespace chrome { diff --git a/chromium/components/sync_sessions/favicon_cache_unittest.cc b/chromium/components/sync_sessions/favicon_cache_unittest.cc index 52173803e11..3db330f42ab 100644 --- a/chromium/components/sync_sessions/favicon_cache_unittest.cc +++ b/chromium/components/sync_sessions/favicon_cache_unittest.cc @@ -11,11 +11,11 @@ #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "base/time/time.h" -#include "components/sync/api/attachments/attachment_id.h" -#include "components/sync/api/sync_change_processor_wrapper_for_test.h" -#include "components/sync/api/sync_error_factory_mock.h" -#include "components/sync/api/time.h" -#include "components/sync/core/attachments/attachment_service_proxy_for_test.h" +#include "components/sync/model/attachments/attachment_id.h" +#include "components/sync/model/attachments/attachment_service_proxy_for_test.h" +#include "components/sync/model/sync_change_processor_wrapper_for_test.h" +#include "components/sync/model/sync_error_factory_mock.h" +#include "components/sync/model/time.h" #include "components/sync/protocol/favicon_image_specifics.pb.h" #include "components/sync/protocol/favicon_tracking_specifics.pb.h" #include "components/sync/protocol/sync.pb.h" diff --git a/chromium/components/sync_sessions/lost_navigations_recorder.h b/chromium/components/sync_sessions/lost_navigations_recorder.h index f90d8e79cb5..cf433041d43 100644 --- a/chromium/components/sync_sessions/lost_navigations_recorder.h +++ b/chromium/components/sync_sessions/lost_navigations_recorder.h @@ -10,8 +10,8 @@ #include "base/macros.h" #include "components/sessions/core/session_id.h" -#include "components/sync/api/local_change_observer.h" -#include "components/sync/api/sync_change.h" +#include "components/sync/model/local_change_observer.h" +#include "components/sync/model/sync_change.h" #include "components/sync/protocol/session_specifics.pb.h" namespace sync_sessions { diff --git a/chromium/components/sync_sessions/lost_navigations_recorder_unittest.cc b/chromium/components/sync_sessions/lost_navigations_recorder_unittest.cc index d3c19769422..1b61896f86c 100644 --- a/chromium/components/sync_sessions/lost_navigations_recorder_unittest.cc +++ b/chromium/components/sync_sessions/lost_navigations_recorder_unittest.cc @@ -9,7 +9,7 @@ #include "base/message_loop/message_loop.h" #include "base/test/histogram_tester.h" -#include "components/sync/core/attachments/attachment_service_proxy_for_test.h" +#include "components/sync/model/attachments/attachment_service_proxy_for_test.h" #include "components/sync/syncable/entry.h" #include "components/sync/syncable/mutable_entry.h" #include "components/sync/syncable/syncable_base_transaction.h" diff --git a/chromium/components/sync_sessions/open_tabs_ui_delegate.h b/chromium/components/sync_sessions/open_tabs_ui_delegate.h index cf8fd5faee4..66b11d41736 100644 --- a/chromium/components/sync_sessions/open_tabs_ui_delegate.h +++ b/chromium/components/sync_sessions/open_tabs_ui_delegate.h @@ -34,7 +34,7 @@ class OpenTabsUIDelegate { // session |tag|. Caller does NOT own the SessionTab object. // Returns true if the foreign session and tab were found, false otherwise. virtual bool GetForeignTab(const std::string& tag, - const SessionID::id_type tab_id, + SessionID::id_type tab_id, const sessions::SessionTab** tab) = 0; // Delete a foreign session and all its sync data. diff --git a/chromium/components/sync_sessions/session_data_type_controller_unittest.cc b/chromium/components/sync_sessions/session_data_type_controller_unittest.cc index 5dc16c41be1..8e4b7b703e6 100644 --- a/chromium/components/sync_sessions/session_data_type_controller_unittest.cc +++ b/chromium/components/sync_sessions/session_data_type_controller_unittest.cc @@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/callback.h" #include "base/files/file_path.h" +#include "base/memory/ptr_util.h" #include "base/memory/weak_ptr.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" @@ -46,7 +47,7 @@ class MockSyncedWindowDelegate : public SyncedWindowDelegate { bool IsTabPinned(const SyncedTabDelegate* tab) const override { return false; } - SyncedTabDelegate* GetTabAt(int index) const override { return NULL; } + SyncedTabDelegate* GetTabAt(int index) const override { return nullptr; } SessionID::id_type GetTabIdAt(int index) const override { return 0; } bool IsSessionRestoreInProgress() const override { @@ -114,20 +115,20 @@ class SessionDataTypeControllerTest : public testing::Test, prefs_.registry()->RegisterBooleanPref(kSavingBrowserHistoryDisabled, false); - synced_window_delegate_.reset(new MockSyncedWindowDelegate()); - synced_window_getter_.reset(new MockSyncedWindowDelegatesGetter()); - sync_sessions_client_.reset(new TestSyncSessionsClient()); + synced_window_delegate_ = base::MakeUnique<MockSyncedWindowDelegate>(); + synced_window_getter_ = base::MakeUnique<MockSyncedWindowDelegatesGetter>(); + sync_sessions_client_ = base::MakeUnique<TestSyncSessionsClient>(); synced_window_getter_->Add(synced_window_delegate_.get()); sync_sessions_client_->SetSyncedWindowDelegatesGetter( synced_window_getter_.get()); - local_device_.reset(new LocalDeviceInfoProviderMock( + local_device_ = base::MakeUnique<LocalDeviceInfoProviderMock>( "cache_guid", "Wayne Gretzky's Hacking Box", "Chromium 10k", - "Chrome 10k", sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id")); + "Chrome 10k", sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id"); - controller_.reset(new SessionDataTypeController( + controller_ = base::MakeUnique<SessionDataTypeController>( base::Bind(&base::DoNothing), this, local_device_.get(), - kSavingBrowserHistoryDisabled)); + kSavingBrowserHistoryDisabled); load_finished_ = false; last_type_ = syncer::UNSPECIFIED; diff --git a/chromium/components/sync_sessions/sessions_sync_manager.cc b/chromium/components/sync_sessions/sessions_sync_manager.cc index e97f1bc9181..acb6882b7bc 100644 --- a/chromium/components/sync_sessions/sessions_sync_manager.cc +++ b/chromium/components/sync_sessions/sessions_sync_manager.cc @@ -11,12 +11,12 @@ #include "base/metrics/field_trial.h" #include "base/metrics/histogram_macros.h" #include "build/build_config.h" -#include "components/sync/api/sync_error.h" -#include "components/sync/api/sync_error_factory.h" -#include "components/sync/api/sync_merge_result.h" -#include "components/sync/api/time.h" +#include "components/sync/base/hash_util.h" #include "components/sync/device_info/local_device_info_provider.h" -#include "components/sync/syncable/syncable_util.h" +#include "components/sync/model/sync_error.h" +#include "components/sync/model/sync_error_factory.h" +#include "components/sync/model/sync_merge_result.h" +#include "components/sync/model/time.h" #include "components/sync_sessions/sync_sessions_client.h" #include "components/sync_sessions/synced_tab_delegate.h" #include "components/sync_sessions/synced_window_delegate.h" @@ -210,14 +210,27 @@ void SessionsSyncManager::AssociateWindows( std::set<const SyncedWindowDelegate*> windows = synced_window_delegates_getter()->GetSyncedWindowDelegates(); + if (option == RELOAD_TABS) { + UMA_HISTOGRAM_COUNTS("Sync.SessionWindows", windows.size()); + } + if (windows.size() == 0) { + // Assume that the window hasn't loaded. Attempting to associate now would + // clobber any old windows, so just return. + LOG(ERROR) << "No windows present, see crbug.com/639009"; + return; + } for (std::set<const SyncedWindowDelegate*>::const_iterator i = windows.begin(); i != windows.end(); ++i) { + if (option == RELOAD_TABS) { + UMA_HISTOGRAM_COUNTS("Sync.SessionTabs", (*i)->GetTabCount()); + } + // Make sure the window has tabs and a viewable window. The viewable window // check is necessary because, for example, when a browser is closed the // destructor is not necessarily run immediately. This means its possible // for us to get a handle to a browser that is about to be removed. If - // the tab count is 0 or the window is NULL, the browser is about to be + // the tab count is 0 or the window is null, the browser is about to be // deleted, so we ignore it. if ((*i)->ShouldSync() && (*i)->GetTabCount() && (*i)->HasWindow()) { sync_pb::SessionWindow window_s; @@ -232,9 +245,14 @@ void SessionsSyncManager::AssociateWindows( if ((*i)->IsTypeTabbed()) { window_s.set_browser_type( sync_pb::SessionWindow_BrowserType_TYPE_TABBED); - } else { + } else if ((*i)->IsTypePopup()) { window_s.set_browser_type( sync_pb::SessionWindow_BrowserType_TYPE_POPUP); + } else { + // This is a custom tab within an app. These will not be restored on + // startup if not present. + window_s.set_browser_type( + sync_pb::SessionWindow_BrowserType_TYPE_CUSTOM_TAB); } bool found_tabs = false; @@ -270,7 +288,7 @@ void SessionsSyncManager::AssociateWindows( // change processor calling AssociateTab for all modified tabs. // Therefore, we can key whether this window has valid tabs based on // the tab's presence in the tracker. - const sessions::SessionTab* tab = NULL; + const sessions::SessionTab* tab = nullptr; if (session_tracker_.LookupSessionTab(local_tag, tab_id, &tab)) { found_tabs = true; window_s.add_tab(tab_id); @@ -323,7 +341,7 @@ void SessionsSyncManager::AssociateTab(SyncedTabDelegate* const tab, return; TabLinksMap::iterator local_tab_map_iter = local_tab_map_.find(tab_id); - TabLink* tab_link = NULL; + TabLink* tab_link = nullptr; if (local_tab_map_iter == local_tab_map_.end()) { int tab_node_id = tab->GetSyncId(); @@ -451,7 +469,7 @@ void SessionsSyncManager::StopSyncing(syncer::ModelType type) { lost_navigations_recorder_.get()); lost_navigations_recorder_.reset(); } - sync_processor_.reset(NULL); + sync_processor_.reset(nullptr); error_handler_.reset(); session_tracker_.Clear(); local_tab_map_.clear(); @@ -464,7 +482,7 @@ void SessionsSyncManager::StopSyncing(syncer::ModelType type) { syncer::SyncDataList SessionsSyncManager::GetAllSyncData( syncer::ModelType type) const { syncer::SyncDataList list; - const SyncedSession* session = NULL; + const SyncedSession* session = nullptr; if (!session_tracker_.LookupLocalSession(&session)) return syncer::SyncDataList(); @@ -823,6 +841,8 @@ void SessionsSyncManager::BuildSyncedSessionFromSpecifics( sync_pb::SessionWindow_BrowserType_TYPE_TABBED) { session_window->type = sessions::SessionWindow::TYPE_TABBED; } else { + // Note: custom tabs are treated like popup windows on restore, as you can + // restore a custom tab on a platform that doesn't support them. session_window->type = sessions::SessionWindow::TYPE_POPUP; } } @@ -934,7 +954,7 @@ bool SessionsSyncManager::GetForeignSessionTabs( bool SessionsSyncManager::GetForeignTab(const std::string& tag, const SessionID::id_type tab_id, const sessions::SessionTab** tab) { - const sessions::SessionTab* synced_tab = NULL; + const sessions::SessionTab* synced_tab = nullptr; bool success = session_tracker_.LookupSessionTab(tag, tab_id, &synced_tab); if (success) *tab = synced_tab; @@ -944,7 +964,7 @@ bool SessionsSyncManager::GetForeignTab(const std::string& tag, void SessionsSyncManager::LocalTabDelegateToSpecifics( const SyncedTabDelegate& tab_delegate, sync_pb::SessionSpecifics* specifics) { - sessions::SessionTab* session_tab = NULL; + sessions::SessionTab* session_tab = nullptr; session_tab = session_tracker_.GetTab(current_machine_tag(), tab_delegate.GetSessionId(), tab_delegate.GetSyncId()); @@ -1114,8 +1134,8 @@ void SessionsSyncManager::DoGarbageCollection() { // static std::string SessionsSyncManager::TagHashFromSpecifics( const sync_pb::SessionSpecifics& specifics) { - return syncer::syncable::GenerateSyncableHash(syncer::SESSIONS, - TagFromSpecifics(specifics)); + return syncer::GenerateSyncableHash(syncer::SESSIONS, + TagFromSpecifics(specifics)); } }; // namespace sync_sessions diff --git a/chromium/components/sync_sessions/sessions_sync_manager.h b/chromium/components/sync_sessions/sessions_sync_manager.h index a0ff584d3f0..b78a1b401b2 100644 --- a/chromium/components/sync_sessions/sessions_sync_manager.h +++ b/chromium/components/sync_sessions/sessions_sync_manager.h @@ -20,9 +20,9 @@ #include "base/time/time.h" #include "components/sessions/core/session_id.h" #include "components/sessions/core/session_types.h" -#include "components/sync/api/syncable_service.h" +#include "components/sync/base/sync_prefs.h" #include "components/sync/device_info/device_info.h" -#include "components/sync/driver/sync_prefs.h" +#include "components/sync/model/syncable_service.h" #include "components/sync_sessions/favicon_cache.h" #include "components/sync_sessions/local_session_event_router.h" #include "components/sync_sessions/lost_navigations_recorder.h" @@ -91,7 +91,7 @@ class SessionsSyncManager : public syncer::SyncableService, const std::string& tag, std::vector<const sessions::SessionWindow*>* windows) override; bool GetForeignTab(const std::string& tag, - const SessionID::id_type tab_id, + SessionID::id_type tab_id, const sessions::SessionTab** tab) override; bool GetForeignSessionTabs( const std::string& tag, diff --git a/chromium/components/sync_sessions/sync_sessions_metrics.cc b/chromium/components/sync_sessions/sync_sessions_metrics.cc index de5f03abd29..1242b095e32 100644 --- a/chromium/components/sync_sessions/sync_sessions_metrics.cc +++ b/chromium/components/sync_sessions/sync_sessions_metrics.cc @@ -20,7 +20,7 @@ namespace sync_sessions { // static void SyncSessionsMetrics::RecordYoungestForeignTabAgeOnNTP( SessionsSyncManager* sessions_sync_manager) { - if (sessions_sync_manager != NULL) { + if (sessions_sync_manager != nullptr) { std::vector<const SyncedSession*> foreign_sessions; sessions_sync_manager->GetAllForeignSessions(&foreign_sessions); base::Time best(MaxTabTimestamp(foreign_sessions)); diff --git a/chromium/components/sync_sessions/synced_session_tracker.h b/chromium/components/sync_sessions/synced_session_tracker.h index 63e8429fd0b..35123d76a9c 100644 --- a/chromium/components/sync_sessions/synced_session_tracker.h +++ b/chromium/components/sync_sessions/synced_session_tracker.h @@ -67,7 +67,7 @@ class SyncedSessionTracker { // If lookup succeeds: // - Sets tab to point to the SessionTab, and returns true. // Else - // - Returns false, tab is set to NULL. + // - Returns false, tab is set to null. bool LookupSessionTab(const std::string& session_tag, SessionID::id_type tab_id, const sessions::SessionTab** tab) const; diff --git a/chromium/components/sync_sessions/tab_node_pool.cc b/chromium/components/sync_sessions/tab_node_pool.cc index 6ad5da7771d..4067b92894d 100644 --- a/chromium/components/sync_sessions/tab_node_pool.cc +++ b/chromium/components/sync_sessions/tab_node_pool.cc @@ -7,9 +7,9 @@ #include "base/format_macros.h" #include "base/logging.h" #include "base/strings/stringprintf.h" -#include "components/sync/api/sync_change.h" -#include "components/sync/api/sync_data.h" #include "components/sync/base/model_type.h" +#include "components/sync/model/sync_change.h" +#include "components/sync/model/sync_data.h" #include "components/sync/protocol/session_specifics.pb.h" #include "components/sync/protocol/sync.pb.h" diff --git a/chromium/components/sync_sessions/tab_node_pool.h b/chromium/components/sync_sessions/tab_node_pool.h index b197e00b1f5..caadc4e5f2e 100644 --- a/chromium/components/sync_sessions/tab_node_pool.h +++ b/chromium/components/sync_sessions/tab_node_pool.h @@ -13,7 +13,7 @@ #include "base/macros.h" #include "components/sessions/core/session_id.h" -#include "components/sync/api/sync_change_processor.h" +#include "components/sync/model/sync_change_processor.h" namespace syncer { class SyncChangeProcessor; diff --git a/chromium/components/sync_sessions/tab_node_pool_unittest.cc b/chromium/components/sync_sessions/tab_node_pool_unittest.cc index e52397b3214..cd125a2fe3e 100644 --- a/chromium/components/sync_sessions/tab_node_pool_unittest.cc +++ b/chromium/components/sync_sessions/tab_node_pool_unittest.cc @@ -6,7 +6,7 @@ #include <vector> -#include "components/sync/api/sync_change.h" +#include "components/sync/model/sync_change.h" #include "components/sync/protocol/session_specifics.pb.h" #include "components/sync/protocol/sync.pb.h" #include "testing/gtest/include/gtest/gtest.h" |