Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
|
Yaron
2013/05/21 18:32:07
2013 and no "(c)"
shashi
2013/05/21 23:11:21
Done.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/sync/glue/synced_tab_delegate_android.h" | |
| 6 | |
| 7 #include "base/memory/ref_counted.h" | |
| 8 #include "chrome/browser/android/tab_android.h" | |
| 9 #include "chrome/browser/extensions/tab_helper.h" | |
| 10 #include "chrome/browser/profiles/profile.h" | |
| 11 #include "chrome/browser/sessions/session_tab_helper.h" | |
| 12 #include "chrome/browser/sync/glue/synced_window_delegate.h" | |
| 13 #include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h" | |
| 14 #include "chrome/common/extensions/extension.h" | |
| 15 #include "content/public/browser/navigation_controller.h" | |
| 16 #include "content/public/browser/navigation_entry.h" | |
| 17 #include "content/public/browser/web_contents.h" | |
| 18 | |
| 19 using content::NavigationEntry; | |
| 20 | |
| 21 SyncedTabDelegateAndroid::SyncedTabDelegateAndroid(TabAndroid* tab_android) | |
| 22 : web_contents_(NULL), tab_android_(tab_android) {} | |
| 23 | |
| 24 SyncedTabDelegateAndroid::~SyncedTabDelegateAndroid() {} | |
| 25 | |
| 26 SessionID::id_type SyncedTabDelegateAndroid::GetWindowId() const { | |
| 27 return TabContentsSyncedTabDelegate::FromWebContents(web_contents_) | |
|
Yaron
2013/05/21 18:32:07
So it's up to caller to ensure not to call these i
shashi
2013/05/21 23:11:21
Yes otherwise there will be a DCHECK failure in Fr
| |
| 28 ->GetWindowId(); | |
| 29 } | |
| 30 | |
| 31 SessionID::id_type SyncedTabDelegateAndroid::GetSessionId() const { | |
| 32 return tab_android_->id().id(); | |
| 33 } | |
| 34 | |
| 35 bool SyncedTabDelegateAndroid::IsBeingDestroyed() const { | |
| 36 return TabContentsSyncedTabDelegate::FromWebContents(web_contents_) | |
| 37 ->IsBeingDestroyed(); | |
| 38 } | |
| 39 | |
| 40 Profile* SyncedTabDelegateAndroid::profile() const { | |
| 41 return TabContentsSyncedTabDelegate::FromWebContents(web_contents_) | |
| 42 ->profile(); | |
| 43 } | |
| 44 | |
| 45 std::string SyncedTabDelegateAndroid::GetExtensionAppId() const { | |
| 46 return TabContentsSyncedTabDelegate::FromWebContents(web_contents_) | |
| 47 ->GetExtensionAppId(); | |
| 48 } | |
| 49 | |
| 50 int SyncedTabDelegateAndroid::GetCurrentEntryIndex() const { | |
| 51 return TabContentsSyncedTabDelegate::FromWebContents(web_contents_) | |
| 52 ->GetCurrentEntryIndex(); | |
| 53 } | |
| 54 | |
| 55 int SyncedTabDelegateAndroid::GetEntryCount() const { | |
| 56 return TabContentsSyncedTabDelegate::FromWebContents(web_contents_) | |
| 57 ->GetEntryCount(); | |
| 58 } | |
| 59 | |
| 60 int SyncedTabDelegateAndroid::GetPendingEntryIndex() const { | |
| 61 return TabContentsSyncedTabDelegate::FromWebContents(web_contents_) | |
| 62 ->GetPendingEntryIndex(); | |
| 63 } | |
| 64 | |
| 65 NavigationEntry* SyncedTabDelegateAndroid::GetPendingEntry() const { | |
| 66 return TabContentsSyncedTabDelegate::FromWebContents(web_contents_) | |
| 67 ->GetPendingEntry(); | |
| 68 } | |
| 69 | |
| 70 NavigationEntry* SyncedTabDelegateAndroid::GetEntryAtIndex(int i) const { | |
| 71 return TabContentsSyncedTabDelegate::FromWebContents(web_contents_) | |
| 72 ->GetEntryAtIndex(i); | |
| 73 } | |
| 74 | |
| 75 NavigationEntry* SyncedTabDelegateAndroid::GetActiveEntry() const { | |
| 76 return TabContentsSyncedTabDelegate::FromWebContents(web_contents_) | |
| 77 ->GetActiveEntry(); | |
| 78 } | |
| 79 | |
| 80 bool SyncedTabDelegateAndroid::IsPinned() const { | |
| 81 return TabContentsSyncedTabDelegate::FromWebContents(web_contents_) | |
| 82 ->IsPinned(); | |
| 83 } | |
| 84 | |
| 85 bool SyncedTabDelegateAndroid::HasWebContents() const { | |
| 86 return web_contents_ != NULL; | |
| 87 } | |
| 88 | |
| 89 void SyncedTabDelegateAndroid::SetWebContents( | |
| 90 content::WebContents* web_contents) { | |
| 91 web_contents_ = web_contents; | |
| 92 TabContentsSyncedTabDelegate::CreateForWebContents(web_contents_); | |
| 93 } | |
| OLD | NEW |