Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: chrome/browser/ui/sync/synced_tab_delegate_android.cc

Issue 15055003: Do not submit: high level overview patch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix build. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/sync/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 void SyncedTabDelegateAndroid::SetWebContents(
27 content::WebContents* web_contents) {
28 web_contents_ = web_contents;
29 TabContentsSyncedTabDelegate::CreateForWebContents(web_contents_);
30 }
31
32 const SessionID& SyncedTabDelegateAndroid::GetWindowId() const {
33 return TabContentsSyncedTabDelegate::FromWebContents(web_contents_)
34 ->GetWindowId();
35 }
36
37 const SessionID& SyncedTabDelegateAndroid::GetSessionId() const {
38 return tab_android_->id();
39 }
40
41 int64 SyncedTabDelegateAndroid::GetSyncSessionId() const {
42 if (web_contents_)
43 return TabContentsSyncedTabDelegate::FromWebContents(web_contents_)
44 ->GetSyncSessionId();
45 return tab_android_->GetSyncSessionId();
46 }
47
48 void SyncedTabDelegateAndroid::SetSyncSessionId(const int64 sync_id) {
49 tab_android_->SetSyncSessionId(sync_id);
50 TabContentsSyncedTabDelegate::FromWebContents(web_contents_)
51 ->SetSyncSessionId(sync_id);
52 }
53
54 bool SyncedTabDelegateAndroid::IsBeingDestroyed() const {
55 return TabContentsSyncedTabDelegate::FromWebContents(web_contents_)
56 ->IsBeingDestroyed();
57 }
58
59 Profile* SyncedTabDelegateAndroid::profile() const {
60 return TabContentsSyncedTabDelegate::FromWebContents(web_contents_)
61 ->profile();
62 }
63
64 std::string SyncedTabDelegateAndroid::GetExtensionAppId() const {
65 return TabContentsSyncedTabDelegate::FromWebContents(web_contents_)
66 ->GetExtensionAppId();
67 }
68
69 int SyncedTabDelegateAndroid::GetCurrentEntryIndex() const {
70 return TabContentsSyncedTabDelegate::FromWebContents(web_contents_)
71 ->GetCurrentEntryIndex();
72 }
73
74 int SyncedTabDelegateAndroid::GetEntryCount() const {
75 return TabContentsSyncedTabDelegate::FromWebContents(web_contents_)
76 ->GetEntryCount();
77 }
78
79 int SyncedTabDelegateAndroid::GetPendingEntryIndex() const {
80 return TabContentsSyncedTabDelegate::FromWebContents(web_contents_)
81 ->GetPendingEntryIndex();
82 }
83
84 NavigationEntry* SyncedTabDelegateAndroid::GetPendingEntry() const {
85 return TabContentsSyncedTabDelegate::FromWebContents(web_contents_)
86 ->GetPendingEntry();
87 }
88
89 NavigationEntry* SyncedTabDelegateAndroid::GetEntryAtIndex(int i) const {
90 return TabContentsSyncedTabDelegate::FromWebContents(web_contents_)
91 ->GetEntryAtIndex(i);
92 }
93
94 NavigationEntry* SyncedTabDelegateAndroid::GetActiveEntry() const {
95 return TabContentsSyncedTabDelegate::FromWebContents(web_contents_)
96 ->GetActiveEntry();
97 }
98
99 bool SyncedTabDelegateAndroid::IsPinned() const {
100 return TabContentsSyncedTabDelegate::FromWebContents(web_contents_)
101 ->IsPinned();
102 }
103
104 bool SyncedTabDelegateAndroid::IsTabInMemory() const {
105 return web_contents_ != NULL;
106 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698