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/sync/ios_chrome_synced_tab_delegate.h" | 5 #include "ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.h" |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "components/sessions/ios/ios_serialized_navigation_builder.h" | 8 #include "components/sessions/ios/ios_serialized_navigation_builder.h" |
9 #include "components/sync_sessions/sync_sessions_client.h" | 9 #include "components/sync_sessions/sync_sessions_client.h" |
10 #include "components/sync_sessions/synced_window_delegate.h" | 10 #include "components/sync_sessions/synced_window_delegate.h" |
(...skipping 18 matching lines...) Expand all Loading... | |
29 NavigationItem* GetPossiblyPendingItemAtIndex(web::WebState* web_state, int i) { | 29 NavigationItem* GetPossiblyPendingItemAtIndex(web::WebState* web_state, int i) { |
30 int pending_index = web_state->GetNavigationManager()->GetPendingItemIndex(); | 30 int pending_index = web_state->GetNavigationManager()->GetPendingItemIndex(); |
31 return (pending_index == i) | 31 return (pending_index == i) |
32 ? web_state->GetNavigationManager()->GetPendingItem() | 32 ? web_state->GetNavigationManager()->GetPendingItem() |
33 : web_state->GetNavigationManager()->GetItemAtIndex(i); | 33 : web_state->GetNavigationManager()->GetItemAtIndex(i); |
34 } | 34 } |
35 | 35 |
36 } // namespace | 36 } // namespace |
37 | 37 |
38 IOSChromeSyncedTabDelegate::IOSChromeSyncedTabDelegate(web::WebState* web_state) | 38 IOSChromeSyncedTabDelegate::IOSChromeSyncedTabDelegate(web::WebState* web_state) |
39 : web_state_(web_state), sync_session_id_(0) {} | 39 : web_state_(web_state), sync_session_id_(-1) {} |
skym
2017/04/17 20:37:02
This should be able to ref the real invalid id con
Nicolas Zea
2017/04/17 21:24:54
Done.
| |
40 | 40 |
41 IOSChromeSyncedTabDelegate::~IOSChromeSyncedTabDelegate() {} | 41 IOSChromeSyncedTabDelegate::~IOSChromeSyncedTabDelegate() {} |
42 | 42 |
43 SessionID::id_type IOSChromeSyncedTabDelegate::GetWindowId() const { | 43 SessionID::id_type IOSChromeSyncedTabDelegate::GetWindowId() const { |
44 return IOSChromeSessionTabHelper::FromWebState(web_state_)->window_id().id(); | 44 return IOSChromeSessionTabHelper::FromWebState(web_state_)->window_id().id(); |
45 } | 45 } |
46 | 46 |
47 SessionID::id_type IOSChromeSyncedTabDelegate::GetSessionId() const { | 47 SessionID::id_type IOSChromeSyncedTabDelegate::GetSessionId() const { |
48 return IOSChromeSessionTabHelper::FromWebState(web_state_)->session_id().id(); | 48 return IOSChromeSessionTabHelper::FromWebState(web_state_)->session_id().id(); |
49 } | 49 } |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
133 for (int i = 0; i < entry_count; ++i) { | 133 for (int i = 0; i < entry_count; ++i) { |
134 const GURL& virtual_url = GetVirtualURLAtIndex(i); | 134 const GURL& virtual_url = GetVirtualURLAtIndex(i); |
135 if (!virtual_url.is_valid()) | 135 if (!virtual_url.is_valid()) |
136 continue; | 136 continue; |
137 | 137 |
138 if (sessions_client->ShouldSyncURL(virtual_url)) | 138 if (sessions_client->ShouldSyncURL(virtual_url)) |
139 return true; | 139 return true; |
140 } | 140 } |
141 return false; | 141 return false; |
142 } | 142 } |
OLD | NEW |