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 #if defined(ENABLE_MANAGED_USERS) | 17 #if defined(ENABLE_MANAGED_USERS) |
18 #include "chrome/browser/managed_mode/managed_mode_navigation_observer.h" | 18 #include "chrome/browser/managed_mode/managed_mode_navigation_observer.h" |
19 #include "chrome/browser/managed_mode/managed_user_service.h" | 19 #include "chrome/browser/managed_mode/managed_user_service.h" |
20 #endif | 20 #endif |
21 | 21 |
22 using content::NavigationEntry; | 22 using content::NavigationEntry; |
23 | 23 |
24 DEFINE_WEB_CONTENTS_USER_DATA_KEY(TabContentsSyncedTabDelegate); | 24 DEFINE_WEB_CONTENTS_USER_DATA_KEY(TabContentsSyncedTabDelegate); |
25 | 25 |
26 TabContentsSyncedTabDelegate::TabContentsSyncedTabDelegate( | 26 TabContentsSyncedTabDelegate::TabContentsSyncedTabDelegate( |
27 content::WebContents* web_contents) | 27 content::WebContents* web_contents) |
28 : web_contents_(web_contents) {} | 28 : web_contents_(web_contents), sync_session_id_(0) {} |
29 | 29 |
30 TabContentsSyncedTabDelegate::~TabContentsSyncedTabDelegate() {} | 30 TabContentsSyncedTabDelegate::~TabContentsSyncedTabDelegate() {} |
31 | 31 |
32 SessionID::id_type TabContentsSyncedTabDelegate::GetWindowId() const { | 32 SessionID::id_type TabContentsSyncedTabDelegate::GetWindowId() const { |
33 return SessionTabHelper::FromWebContents(web_contents_)->window_id().id(); | 33 return SessionTabHelper::FromWebContents(web_contents_)->window_id().id(); |
34 } | 34 } |
35 | 35 |
36 SessionID::id_type TabContentsSyncedTabDelegate::GetSessionId() const { | 36 SessionID::id_type TabContentsSyncedTabDelegate::GetSessionId() const { |
37 return SessionTabHelper::FromWebContents(web_contents_)->session_id().id(); | 37 return SessionTabHelper::FromWebContents(web_contents_)->session_id().id(); |
38 } | 38 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 bool TabContentsSyncedTabDelegate::IsPinned() const { | 99 bool TabContentsSyncedTabDelegate::IsPinned() const { |
100 const browser_sync::SyncedWindowDelegate* window = | 100 const browser_sync::SyncedWindowDelegate* window = |
101 browser_sync::SyncedWindowDelegate::FindSyncedWindowDelegateWithId( | 101 browser_sync::SyncedWindowDelegate::FindSyncedWindowDelegateWithId( |
102 GetWindowId()); | 102 GetWindowId()); |
103 // We might not have a parent window, e.g. Developer Tools. | 103 // We might not have a parent window, e.g. Developer Tools. |
104 return window ? window->IsTabPinned(this) : false; | 104 return window ? window->IsTabPinned(this) : false; |
105 } | 105 } |
106 | 106 |
107 bool TabContentsSyncedTabDelegate::HasWebContents() const { return true; } | 107 bool TabContentsSyncedTabDelegate::HasWebContents() const { return true; } |
| 108 |
| 109 int64 TabContentsSyncedTabDelegate::GetSyncId() const { |
| 110 return sync_session_id_; |
| 111 } |
| 112 |
| 113 void TabContentsSyncedTabDelegate::SetSyncId(int64 sync_id) { |
| 114 sync_session_id_ = sync_id; |
| 115 } |
OLD | NEW |