| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ios/chrome/browser/tabs/tab_model_synced_window_delegate_getter.h" | 5 #include "ios/chrome/browser/tabs/tab_model_synced_window_delegate_getter.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ios/chrome/browser/application_context.h" | 8 #include "ios/chrome/browser/application_context.h" |
| 9 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 9 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 10 #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" | 10 #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" |
| 11 #import "ios/chrome/browser/tabs/tab_model.h" | 11 #import "ios/chrome/browser/tabs/tab_model.h" |
| 12 #import "ios/chrome/browser/tabs/tab_model_list.h" | 12 #import "ios/chrome/browser/tabs/tab_model_list.h" |
| 13 #import "ios/chrome/browser/tabs/tab_model_synced_window_delegate.h" | 13 #import "ios/chrome/browser/tabs/tab_model_synced_window_delegate.h" |
| 14 | 14 |
| 15 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 16 #error "This file requires ARC support." |
| 17 #endif |
| 18 |
| 15 TabModelSyncedWindowDelegatesGetter::TabModelSyncedWindowDelegatesGetter() {} | 19 TabModelSyncedWindowDelegatesGetter::TabModelSyncedWindowDelegatesGetter() {} |
| 16 | 20 |
| 17 TabModelSyncedWindowDelegatesGetter::~TabModelSyncedWindowDelegatesGetter() {} | 21 TabModelSyncedWindowDelegatesGetter::~TabModelSyncedWindowDelegatesGetter() {} |
| 18 | 22 |
| 19 TabModelSyncedWindowDelegatesGetter::SyncedWindowDelegateMap | 23 TabModelSyncedWindowDelegatesGetter::SyncedWindowDelegateMap |
| 20 TabModelSyncedWindowDelegatesGetter::GetSyncedWindowDelegates() { | 24 TabModelSyncedWindowDelegatesGetter::GetSyncedWindowDelegates() { |
| 21 SyncedWindowDelegateMap synced_window_delegates; | 25 SyncedWindowDelegateMap synced_window_delegates; |
| 22 | 26 |
| 23 std::vector<ios::ChromeBrowserState*> browser_states = | 27 std::vector<ios::ChromeBrowserState*> browser_states = |
| 24 GetApplicationContext() | 28 GetApplicationContext() |
| (...skipping 18 matching lines...) Expand all Loading... |
| 43 } | 47 } |
| 44 | 48 |
| 45 const sync_sessions::SyncedWindowDelegate* | 49 const sync_sessions::SyncedWindowDelegate* |
| 46 TabModelSyncedWindowDelegatesGetter::FindById(SessionID::id_type session_id) { | 50 TabModelSyncedWindowDelegatesGetter::FindById(SessionID::id_type session_id) { |
| 47 for (const auto& iter : GetSyncedWindowDelegates()) { | 51 for (const auto& iter : GetSyncedWindowDelegates()) { |
| 48 if (session_id == iter.second->GetSessionId()) | 52 if (session_id == iter.second->GetSessionId()) |
| 49 return iter.second; | 53 return iter.second; |
| 50 } | 54 } |
| 51 return nullptr; | 55 return nullptr; |
| 52 } | 56 } |
| OLD | NEW |