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/tab_contents_synced_tab_delegate.h" | 5 #include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h" |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "chrome/browser/extensions/tab_helper.h" | 8 #include "chrome/browser/extensions/tab_helper.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/sessions/session_tab_helper.h" | 10 #include "chrome/browser/sessions/session_tab_helper.h" |
11 #include "chrome/browser/sync/glue/synced_window_delegate.h" | 11 #include "chrome/browser/sync/glue/synced_window_delegate.h" |
12 #include "chrome/common/extensions/extension.h" | 12 #include "chrome/common/extensions/extension.h" |
13 #include "content/public/browser/navigation_controller.h" | 13 #include "content/public/browser/navigation_controller.h" |
14 #include "content/public/browser/navigation_entry.h" | 14 #include "content/public/browser/navigation_entry.h" |
15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
16 | 16 |
17 using content::NavigationEntry; | 17 using content::NavigationEntry; |
18 | 18 |
19 DEFINE_WEB_CONTENTS_USER_DATA_KEY(TabContentsSyncedTabDelegate); | 19 DEFINE_WEB_CONTENTS_USER_DATA_KEY(TabContentsSyncedTabDelegate); |
20 | 20 |
21 TabContentsSyncedTabDelegate::TabContentsSyncedTabDelegate( | 21 TabContentsSyncedTabDelegate::TabContentsSyncedTabDelegate( |
22 content::WebContents* web_contents) | 22 content::WebContents* web_contents) |
23 : web_contents_(web_contents) {} | 23 : web_contents_(web_contents) {} |
24 | 24 |
25 TabContentsSyncedTabDelegate::~TabContentsSyncedTabDelegate() {} | 25 TabContentsSyncedTabDelegate::~TabContentsSyncedTabDelegate() {} |
26 | 26 |
27 SessionID::id_type TabContentsSyncedTabDelegate::GetWindowId() const { | 27 const SessionID& TabContentsSyncedTabDelegate::GetWindowId() const { |
28 return SessionTabHelper::FromWebContents(web_contents_)->window_id().id(); | 28 return SessionTabHelper::FromWebContents(web_contents_)->window_id(); |
29 } | 29 } |
30 | 30 |
31 SessionID::id_type TabContentsSyncedTabDelegate::GetSessionId() const { | 31 const SessionID& TabContentsSyncedTabDelegate::GetSessionId() const { |
32 return SessionTabHelper::FromWebContents(web_contents_)->session_id().id(); | 32 return SessionTabHelper::FromWebContents(web_contents_)->session_id(); |
| 33 } |
| 34 |
| 35 int64 TabContentsSyncedTabDelegate::GetSyncSessionId() const { |
| 36 return SessionTabHelper::FromWebContents(web_contents_)->GetSessionSyncId(); |
| 37 } |
| 38 |
| 39 void TabContentsSyncedTabDelegate::SetSyncSessionId(const int64 sync_id) { |
| 40 SessionTabHelper::FromWebContents(web_contents_)->SetSessionSyncId(sync_id); |
33 } | 41 } |
34 | 42 |
35 bool TabContentsSyncedTabDelegate::IsBeingDestroyed() const { | 43 bool TabContentsSyncedTabDelegate::IsBeingDestroyed() const { |
36 return web_contents_->IsBeingDestroyed(); | 44 return web_contents_->IsBeingDestroyed(); |
37 } | 45 } |
38 | 46 |
39 Profile* TabContentsSyncedTabDelegate::profile() const { | 47 Profile* TabContentsSyncedTabDelegate::profile() const { |
40 return Profile::FromBrowserContext(web_contents_->GetBrowserContext()); | 48 return Profile::FromBrowserContext(web_contents_->GetBrowserContext()); |
41 } | 49 } |
42 | 50 |
(...skipping 23 matching lines...) Expand all Loading... |
66 return web_contents_->GetController().GetEntryAtIndex(i); | 74 return web_contents_->GetController().GetEntryAtIndex(i); |
67 } | 75 } |
68 | 76 |
69 NavigationEntry* TabContentsSyncedTabDelegate::GetActiveEntry() const { | 77 NavigationEntry* TabContentsSyncedTabDelegate::GetActiveEntry() const { |
70 return web_contents_->GetController().GetActiveEntry(); | 78 return web_contents_->GetController().GetActiveEntry(); |
71 } | 79 } |
72 | 80 |
73 bool TabContentsSyncedTabDelegate::IsPinned() const { | 81 bool TabContentsSyncedTabDelegate::IsPinned() const { |
74 const browser_sync::SyncedWindowDelegate* window = | 82 const browser_sync::SyncedWindowDelegate* window = |
75 browser_sync::SyncedWindowDelegate::FindSyncedWindowDelegateWithId( | 83 browser_sync::SyncedWindowDelegate::FindSyncedWindowDelegateWithId( |
76 GetWindowId()); | 84 GetWindowId().id()); |
77 // We might not have a parent window, e.g. Developer Tools. | 85 // We might not have a parent window, e.g. Developer Tools. |
78 return window ? window->IsTabPinned(this) : false; | 86 return window ? window->IsTabPinned(this) : false; |
79 } | 87 } |
| 88 |
| 89 bool TabContentsSyncedTabDelegate::IsTabInMemory() const { return true; } |
OLD | NEW |