OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/sync/glue/synced_tab_delegate_android.h" | 5 #include "chrome/browser/sync/glue/synced_tab_delegate_android.h" |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "chrome/browser/android/tab_android.h" | 8 #include "chrome/browser/android/tab_android.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/sync/glue/synced_window_delegate.h" | 10 #include "chrome/browser/sync/glue/synced_window_delegate.h" |
11 #include "chrome/browser/sync/glue/synced_window_delegates_getter_android.h" | |
11 #include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h" | 12 #include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h" |
12 #include "content/public/browser/navigation_entry.h" | 13 #include "content/public/browser/navigation_entry.h" |
13 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
14 | 15 |
15 using content::NavigationEntry; | 16 using content::NavigationEntry; |
16 | 17 |
17 namespace browser_sync { | 18 namespace browser_sync { |
18 SyncedTabDelegateAndroid::SyncedTabDelegateAndroid(TabAndroid* tab_android) | 19 SyncedTabDelegateAndroid::SyncedTabDelegateAndroid(TabAndroid* tab_android) |
19 : web_contents_(NULL), tab_android_(tab_android) {} | 20 : web_contents_(NULL), tab_android_(tab_android) {} |
20 | 21 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
111 } | 112 } |
112 | 113 |
113 void SyncedTabDelegateAndroid::SetSyncId(int sync_id) { | 114 void SyncedTabDelegateAndroid::SetSyncId(int sync_id) { |
114 tab_android_->SetSyncId(sync_id); | 115 tab_android_->SetSyncId(sync_id); |
115 } | 116 } |
116 | 117 |
117 // static | 118 // static |
118 SyncedTabDelegate* SyncedTabDelegate::ImplFromWebContents( | 119 SyncedTabDelegate* SyncedTabDelegate::ImplFromWebContents( |
119 content::WebContents* web_contents) { | 120 content::WebContents* web_contents) { |
120 TabAndroid* tab = TabAndroid::FromWebContents(web_contents); | 121 TabAndroid* tab = TabAndroid::FromWebContents(web_contents); |
121 return tab ? tab->GetSyncedTabDelegate() : NULL; | 122 if (!tab) { |
123 return NULL; | |
Nicolas Zea
2015/09/02 21:19:44
nit: style guide recommends nullptr for all new co
maxbogue
2015/09/02 23:05:40
Done.
| |
124 } | |
125 SyncedTabDelegate* delegate = tab->GetSyncedTabDelegate(); | |
Nicolas Zea
2015/09/02 21:19:43
Can delegate be null? Should that be handled?
maxbogue
2015/09/02 23:05:40
Yes, thank you. I forgot there were two versions o
| |
126 delegate->SetSyncedWindowGetter(make_scoped_ptr( | |
127 new SyncedWindowDelegatesGetterAndroid())); | |
128 return delegate; | |
122 } | 129 } |
123 | 130 |
124 } // namespace browser_sync | 131 } // namespace browser_sync |
OLD | NEW |