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/ui/sync/browser_synced_window_delegate.h" | 5 #include "chrome/browser/ui/sync/browser_synced_window_delegate.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "chrome/browser/sessions/session_id.h" | 9 #include "chrome/browser/sessions/session_id.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 BrowserSyncedWindowDelegate::~BrowserSyncedWindowDelegate() {} | 41 BrowserSyncedWindowDelegate::~BrowserSyncedWindowDelegate() {} |
42 | 42 |
43 bool BrowserSyncedWindowDelegate::IsTabPinned( | 43 bool BrowserSyncedWindowDelegate::IsTabPinned( |
44 const browser_sync::SyncedTabDelegate* tab) const { | 44 const browser_sync::SyncedTabDelegate* tab) const { |
45 for (int i = 0; i < browser_->tab_strip_model()->count(); i++) { | 45 for (int i = 0; i < browser_->tab_strip_model()->count(); i++) { |
46 browser_sync::SyncedTabDelegate* current = GetTabAt(i); | 46 browser_sync::SyncedTabDelegate* current = GetTabAt(i); |
47 if (tab == current) | 47 if (tab == current) |
48 return browser_->tab_strip_model()->IsTabPinned(i); | 48 return browser_->tab_strip_model()->IsTabPinned(i); |
49 } | 49 } |
50 NOTREACHED(); | 50 // The window and tab are not always updated atomically, so it's possible |
| 51 // one of the values was stale. We'll retry later, just ignore for now. |
51 return false; | 52 return false; |
52 } | 53 } |
53 | 54 |
54 browser_sync::SyncedTabDelegate* BrowserSyncedWindowDelegate::GetTabAt( | 55 browser_sync::SyncedTabDelegate* BrowserSyncedWindowDelegate::GetTabAt( |
55 int index) const { | 56 int index) const { |
56 return TabContentsSyncedTabDelegate::FromWebContents( | 57 return TabContentsSyncedTabDelegate::FromWebContents( |
57 browser_->tab_strip_model()->GetWebContentsAt(index)); | 58 browser_->tab_strip_model()->GetWebContentsAt(index)); |
58 } | 59 } |
59 | 60 |
60 SessionID::id_type BrowserSyncedWindowDelegate::GetTabIdAt(int index) const { | 61 SessionID::id_type BrowserSyncedWindowDelegate::GetTabIdAt(int index) const { |
(...skipping 24 matching lines...) Expand all Loading... |
85 return browser_->is_type_tabbed(); | 86 return browser_->is_type_tabbed(); |
86 } | 87 } |
87 | 88 |
88 bool BrowserSyncedWindowDelegate::IsTypePopup() const { | 89 bool BrowserSyncedWindowDelegate::IsTypePopup() const { |
89 return browser_->is_type_popup(); | 90 return browser_->is_type_popup(); |
90 } | 91 } |
91 | 92 |
92 bool BrowserSyncedWindowDelegate::IsSessionRestoreInProgress() const { | 93 bool BrowserSyncedWindowDelegate::IsSessionRestoreInProgress() const { |
93 return false; | 94 return false; |
94 } | 95 } |
OLD | NEW |