Chromium Code Reviews| Index: chrome/browser/ui/sync/browser_synced_window_delegates_getter.cc |
| diff --git a/chrome/browser/ui/sync/browser_synced_window_delegates_getter.cc b/chrome/browser/ui/sync/browser_synced_window_delegates_getter.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4ea590e76152464c600d52c0367e044bb5f4acf3 |
| --- /dev/null |
| +++ b/chrome/browser/ui/sync/browser_synced_window_delegates_getter.cc |
| @@ -0,0 +1,31 @@ |
| +// Copyright 2015 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/ui/sync/browser_synced_window_delegates_getter.h" |
| + |
| +#include "chrome/browser/sync/glue/synced_window_delegate.h" |
| +#include "chrome/browser/ui/browser_finder.h" |
| +#include "chrome/browser/ui/browser_iterator.h" |
| +#include "chrome/browser/ui/sync/browser_synced_window_delegate.h" |
| + |
| +namespace browser_sync { |
| + |
| +BrowserSyncedWindowDelegatesGetter::BrowserSyncedWindowDelegatesGetter() {} |
| + |
| +std::set<const SyncedWindowDelegate*> |
| +BrowserSyncedWindowDelegatesGetter::GetSyncedWindowDelegates() { |
| + std::set<const SyncedWindowDelegate*> synced_window_delegates; |
| + // Add all the browser windows. |
| + for (chrome::BrowserIterator it; !it.done(); it.Next()) |
| + synced_window_delegates.insert(it->synced_window_delegate()); |
| + return synced_window_delegates; |
| +} |
| + |
| +const SyncedWindowDelegate* BrowserSyncedWindowDelegatesGetter::FindById( |
| + SessionID::id_type id) { |
| + Browser* browser = chrome::FindBrowserWithID(id); |
| + return (browser != NULL) ? browser->synced_window_delegate() : NULL; |
|
Nicolas Zea
2015/08/31 22:12:47
nit: use nullptr (here and elsewhere in the CL).
(
maxbogue
2015/09/01 17:29:28
I changed most, but not ones in files where NULL i
|
| +} |
| + |
| +} // namespace browser_sync |