Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / sync / browser_synced_window_delegates_getter.cc
blob0ffc72587b3e965d2bc600449d3889387a53afb5
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/sync/browser_synced_window_delegates_getter.h"
7 #include "chrome/browser/ui/browser_finder.h"
8 #include "chrome/browser/ui/browser_iterator.h"
9 #include "chrome/browser/ui/sync/browser_synced_window_delegate.h"
10 #include "components/sync_driver/glue/synced_window_delegate.h"
12 namespace browser_sync {
14 BrowserSyncedWindowDelegatesGetter::BrowserSyncedWindowDelegatesGetter() {}
15 BrowserSyncedWindowDelegatesGetter::~BrowserSyncedWindowDelegatesGetter() {}
17 std::set<const SyncedWindowDelegate*>
18 BrowserSyncedWindowDelegatesGetter::GetSyncedWindowDelegates() {
19 std::set<const SyncedWindowDelegate*> synced_window_delegates;
20 // Add all the browser windows.
21 for (chrome::BrowserIterator it; !it.done(); it.Next())
22 synced_window_delegates.insert(it->synced_window_delegate());
23 return synced_window_delegates;
26 const SyncedWindowDelegate* BrowserSyncedWindowDelegatesGetter::FindById(
27 SessionID::id_type id) {
28 Browser* browser = chrome::FindBrowserWithID(id);
29 return (browser != nullptr) ? browser->synced_window_delegate() : nullptr;
32 } // namespace browser_sync