Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/sync/glue/synced_window_delegate_android.h" | 5 #include "chrome/browser/sync/glue/synced_window_delegate_android.h" |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/sync/glue/synced_tab_delegate_android.h" | |
| 8 #include "chrome/browser/ui/android/tab_model/tab_model.h" | 9 #include "chrome/browser/ui/android/tab_model/tab_model.h" |
| 9 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" | 10 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" |
| 10 #include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h" | |
| 11 #include "chrome/browser/sessions/session_id.h" | |
| 12 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
| 13 | 12 |
| 14 namespace browser_sync { | 13 namespace browser_sync { |
| 15 | 14 |
| 16 // SyncedWindowDelegate implementations | 15 // SyncedWindowDelegate implementations |
| 17 | 16 |
| 18 const std::set<SyncedWindowDelegate*> | 17 const std::set<SyncedWindowDelegate*> |
| 19 SyncedWindowDelegate::GetSyncedWindowDelegates() { | 18 SyncedWindowDelegate::GetSyncedWindowDelegates() { |
| 20 std::set<SyncedWindowDelegate*> synced_window_delegates; | 19 std::set<SyncedWindowDelegate*> synced_window_delegates; |
| 21 for (TabModelList::const_iterator i = TabModelList::begin(); | 20 for (TabModelList::const_iterator i = TabModelList::begin(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 bool SyncedWindowDelegateAndroid::IsTypePopup() const { | 69 bool SyncedWindowDelegateAndroid::IsTypePopup() const { |
| 71 return false; | 70 return false; |
| 72 } | 71 } |
| 73 | 72 |
| 74 bool SyncedWindowDelegateAndroid::IsTabPinned( | 73 bool SyncedWindowDelegateAndroid::IsTabPinned( |
| 75 const SyncedTabDelegate* tab) const { | 74 const SyncedTabDelegate* tab) const { |
| 76 return false; | 75 return false; |
| 77 } | 76 } |
| 78 | 77 |
| 79 SyncedTabDelegate* SyncedWindowDelegateAndroid::GetTabAt(int index) const { | 78 SyncedTabDelegate* SyncedWindowDelegateAndroid::GetTabAt(int index) const { |
| 80 content::WebContents* web_contents = tab_model_->GetWebContentsAt(index); | 79 return tab_model_->GetTabAt(index); |
| 81 return web_contents ? TabContentsSyncedTabDelegate::FromWebContents( | |
| 82 web_contents) : NULL; | |
| 83 } | 80 } |
| 84 | 81 |
| 85 SessionID::id_type SyncedWindowDelegateAndroid::GetTabIdAt(int index) const { | 82 SessionID::id_type SyncedWindowDelegateAndroid::GetTabIdAt(int index) const { |
| 86 return tab_model_->GetTabIdAt(index); | 83 SyncedTabDelegate* tab = GetTabAt(index); |
| 84 return tab ? tab->GetSessionId() : -1; | |
|
Yaron
2013/05/21 18:32:07
Can this be null? Don't we always have an android
shashi
2013/05/21 23:11:21
This should not be null, but TabModelImpl uses Get
| |
| 87 } | 85 } |
| 88 | 86 |
| 89 bool SyncedWindowDelegateAndroid::IsSessionRestoreInProgress() const { | 87 bool SyncedWindowDelegateAndroid::IsSessionRestoreInProgress() const { |
| 90 return tab_model_->IsSessionRestoreInProgress(); | 88 return tab_model_->IsSessionRestoreInProgress(); |
| 91 } | 89 } |
| 92 | 90 |
| 93 } // namespace browser_sync | 91 } // namespace browser_sync |
| OLD | NEW |