Only grant permissions to new extensions from sync if they have the expected version
[chromium-blink-merge.git] / chrome / browser / sync / glue / synced_window_delegate_android.cc
blobe0839dc4ad7b4233449cf55be7d8c61b19fe3d2e
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.
5 #include "chrome/browser/sync/glue/synced_window_delegate_android.h"
7 #include "chrome/browser/android/tab_android.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/sync/glue/synced_tab_delegate_android.h"
10 #include "chrome/browser/ui/android/tab_model/tab_model.h"
11 #include "chrome/browser/ui/android/tab_model/tab_model_list.h"
12 #include "content/public/browser/web_contents.h"
14 namespace browser_sync {
16 // SyncedWindowDelegateAndroid implementations
18 SyncedWindowDelegateAndroid::SyncedWindowDelegateAndroid(
19 TabModel* tab_model)
20 : tab_model_(tab_model) {}
22 SyncedWindowDelegateAndroid::~SyncedWindowDelegateAndroid() {}
24 bool SyncedWindowDelegateAndroid::HasWindow() const {
25 return !tab_model_->IsOffTheRecord();
28 SessionID::id_type SyncedWindowDelegateAndroid::GetSessionId() const {
29 return tab_model_->GetSessionId();
32 int SyncedWindowDelegateAndroid::GetTabCount() const {
33 return tab_model_->GetTabCount();
36 int SyncedWindowDelegateAndroid::GetActiveIndex() const {
37 return tab_model_->GetActiveIndex();
40 bool SyncedWindowDelegateAndroid::IsApp() const {
41 return false;
44 bool SyncedWindowDelegateAndroid::IsTypeTabbed() const {
45 return true;
48 bool SyncedWindowDelegateAndroid::IsTypePopup() const {
49 return false;
52 bool SyncedWindowDelegateAndroid::IsTabPinned(
53 const SyncedTabDelegate* tab) const {
54 return false;
57 SyncedTabDelegate* SyncedWindowDelegateAndroid::GetTabAt(int index) const {
58 // After a restart, it is possible for the Tab to be null during startup.
59 TabAndroid* tab = tab_model_->GetTabAt(index);
60 return tab ? tab->GetSyncedTabDelegate() : NULL;
63 SessionID::id_type SyncedWindowDelegateAndroid::GetTabIdAt(int index) const {
64 SyncedTabDelegate* tab = GetTabAt(index);
65 return tab ? tab->GetSessionId() : -1;
68 bool SyncedWindowDelegateAndroid::IsSessionRestoreInProgress() const {
69 return tab_model_->IsSessionRestoreInProgress();
72 bool SyncedWindowDelegateAndroid::ShouldSync() const {
73 return true;
76 } // namespace browser_sync