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

Unified Diff: chrome/browser/sync/glue/synced_tab_delegate.cc

Issue 1408643002: [Sync] Componentize synced_tab_delegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test broken by rebase Created 5 years, 2 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/glue/synced_tab_delegate.cc
diff --git a/chrome/browser/sync/glue/synced_tab_delegate.cc b/chrome/browser/sync/glue/synced_tab_delegate.cc
deleted file mode 100644
index 54fde076b003dca61875b86fb6f97668a7731ee2..0000000000000000000000000000000000000000
--- a/chrome/browser/sync/glue/synced_tab_delegate.cc
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2013 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.
-
-#include "chrome/browser/sync/glue/synced_tab_delegate.h"
-
-#include "base/logging.h"
-#include "chrome/browser/sync/glue/synced_session_util.h"
-#include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h"
-#include "chrome/common/url_constants.h"
-#include "content/public/browser/navigation_entry.h"
-#include "url/gurl.h"
-
-using browser_sync::SyncedTabDelegate;
-
-namespace browser_sync {
-
-SyncedTabDelegate::SyncedTabDelegate() {}
-SyncedTabDelegate::~SyncedTabDelegate() {}
-
-content::NavigationEntry* SyncedTabDelegate::GetCurrentEntryMaybePending()
- const {
- return GetEntryAtIndexMaybePending(GetCurrentEntryIndex());
-}
-
-content::NavigationEntry* SyncedTabDelegate::GetEntryAtIndexMaybePending(
- int i) const {
- return (GetPendingEntryIndex() == i) ? GetPendingEntry() : GetEntryAtIndex(i);
-}
-
-bool SyncedTabDelegate::ShouldSync() const {
- if (GetSyncedWindowDelegate() == nullptr)
- return false;
-
- // Is there a valid NavigationEntry?
- if (ProfileIsSupervised() && GetBlockedNavigations()->size() > 0)
- return true;
-
- if (IsInitialBlankNavigation())
- return false; // This deliberately ignores a new pending entry.
-
- int entry_count = GetEntryCount();
- bool found_valid_url = false;
- for (int i = 0; i < entry_count; ++i) {
- const content::NavigationEntry* entry = GetEntryAtIndexMaybePending(i);
- if (!entry) {
- return false;
- }
- const GURL& virtual_url = entry->GetVirtualURL();
-
- if (ShouldSyncURL(virtual_url)) {
- found_valid_url = true;
- } else if (virtual_url == GURL(chrome::kChromeUIHistoryURL)) {
- // The history page is treated specially as we want it to trigger syncable
- // events for UI purposes.
- found_valid_url = true;
- }
- }
- return found_valid_url;
-}
-
-void SyncedTabDelegate::SetSyncedWindowGetter(
- scoped_ptr<SyncedWindowDelegatesGetter> getter) {
- synced_window_getter_.reset(getter.release());
-}
-
-const SyncedWindowDelegate* SyncedTabDelegate::GetSyncedWindowDelegate() const {
- if (!synced_window_getter_) {
- NOTREACHED();
- }
- return synced_window_getter_->FindById(GetWindowId());
-}
-
-} // namespace browser_sync

Powered by Google App Engine
This is Rietveld 408576698