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

Side by Side Diff: chrome/browser/sync/glue/synced_window_delegate_android.cc

Issue 1310373009: [Sync] Remove static methods on SyncedWindowDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 3 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
OLDNEW
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/sync/glue/synced_window_delegate_android.h" 5 #include "chrome/browser/sync/glue/synced_window_delegate_android.h"
6 6
7 #include "chrome/browser/android/tab_android.h" 7 #include "chrome/browser/android/tab_android.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/sync/glue/synced_tab_delegate_android.h" 9 #include "chrome/browser/sync/glue/synced_tab_delegate_android.h"
10 #include "chrome/browser/ui/android/tab_model/tab_model.h" 10 #include "chrome/browser/ui/android/tab_model/tab_model.h"
11 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" 11 #include "chrome/browser/ui/android/tab_model/tab_model_list.h"
12 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
13 13
14 namespace browser_sync { 14 namespace browser_sync {
15 15
16 // SyncedWindowDelegate implementations
17
18 std::set<SyncedWindowDelegate const*> SyncedWindowDelegate::GetAll() {
19 std::set<SyncedWindowDelegate const*> synced_window_delegates;
20 for (TabModelList::const_iterator i = TabModelList::begin();
21 i != TabModelList::end(); ++i) {
22 synced_window_delegates.insert((*i)->GetSyncedWindowDelegate());
23 }
24 return synced_window_delegates;
25 }
26
27 const SyncedWindowDelegate* SyncedWindowDelegate::FindById(
28 SessionID::id_type session_id) {
29 TabModel* tab_model = TabModelList::FindTabModelWithId(session_id);
30
31 // In case we don't find the browser (e.g. for Developer Tools).
32 return tab_model ? tab_model->GetSyncedWindowDelegate() : NULL;
33 }
34
35 // SyncedWindowDelegateAndroid implementations 16 // SyncedWindowDelegateAndroid implementations
36 17
37 SyncedWindowDelegateAndroid::SyncedWindowDelegateAndroid( 18 SyncedWindowDelegateAndroid::SyncedWindowDelegateAndroid(
38 TabModel* tab_model) 19 TabModel* tab_model)
39 : tab_model_(tab_model) {} 20 : tab_model_(tab_model) {}
40 21
41 SyncedWindowDelegateAndroid::~SyncedWindowDelegateAndroid() {} 22 SyncedWindowDelegateAndroid::~SyncedWindowDelegateAndroid() {}
42 23
43 bool SyncedWindowDelegateAndroid::HasWindow() const { 24 bool SyncedWindowDelegateAndroid::HasWindow() const {
44 return !tab_model_->IsOffTheRecord(); 25 return !tab_model_->IsOffTheRecord();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 67
87 bool SyncedWindowDelegateAndroid::IsSessionRestoreInProgress() const { 68 bool SyncedWindowDelegateAndroid::IsSessionRestoreInProgress() const {
88 return tab_model_->IsSessionRestoreInProgress(); 69 return tab_model_->IsSessionRestoreInProgress();
89 } 70 }
90 71
91 bool SyncedWindowDelegateAndroid::ShouldSync() const { 72 bool SyncedWindowDelegateAndroid::ShouldSync() const {
92 return true; 73 return true;
93 } 74 }
94 75
95 } // namespace browser_sync 76 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/synced_window_delegate.h ('k') | chrome/browser/sync/glue/synced_window_delegates_getter_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698