Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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. | |
| 4 | |
| 5 #include "chrome/browser/sync/glue/synced_window_delegates_getter_android.h" | |
| 6 | |
| 7 #include "chrome/browser/sync/glue/synced_window_delegate.h" | |
| 8 #include "chrome/browser/ui/android/tab_model/tab_model.h" | |
| 9 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" | |
| 10 | |
| 11 namespace browser_sync { | |
| 12 | |
| 13 SyncedWindowDelegatesGetterAndroid::SyncedWindowDelegatesGetterAndroid() {} | |
| 14 | |
| 15 std::set<const SyncedWindowDelegate*> | |
| 16 SyncedWindowDelegatesGetterAndroid::GetSyncedWindowDelegates() { | |
| 17 std::set<SyncedWindowDelegate const*> synced_window_delegates; | |
| 18 for (TabModelList::const_iterator i = TabModelList::begin(); | |
|
Nicolas Zea
2015/08/31 22:12:47
nit: use C++11 auto iterators. Something like "con
maxbogue
2015/09/01 17:29:27
Done.
| |
| 19 i != TabModelList::end(); ++i) { | |
| 20 synced_window_delegates.insert((*i)->GetSyncedWindowDelegate()); | |
| 21 } | |
| 22 return synced_window_delegates; | |
| 23 } | |
| 24 | |
| 25 const SyncedWindowDelegate* SyncedWindowDelegatesGetterAndroid::FindById( | |
| 26 SessionID::id_type session_id) { | |
| 27 TabModel* tab_model = TabModelList::FindTabModelWithId(session_id); | |
| 28 | |
| 29 // In case we don't find the browser (e.g. for Developer Tools). | |
| 30 return tab_model ? tab_model->GetSyncedWindowDelegate() : NULL; | |
| 31 } | |
| 32 | |
| 33 } // namespace browser_sync | |
| OLD | NEW |