| OLD | NEW |
| 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/ui/sync/tab_contents_synced_tab_delegate.h" | 5 #include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/tab_helper.h" | 7 #include "chrome/browser/extensions/tab_helper.h" |
| 8 #include "chrome/browser/sessions/session_tab_helper.h" | 8 #include "chrome/browser/sessions/session_tab_helper.h" |
| 9 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 9 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 bool TabContentsSyncedTabDelegate::IsBeingDestroyed() const { | 33 bool TabContentsSyncedTabDelegate::IsBeingDestroyed() const { |
| 34 return tab_contents_->in_destructor(); | 34 return tab_contents_->in_destructor(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 Profile* TabContentsSyncedTabDelegate::profile() const { | 37 Profile* TabContentsSyncedTabDelegate::profile() const { |
| 38 return tab_contents_->profile(); | 38 return tab_contents_->profile(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 bool TabContentsSyncedTabDelegate::HasExtensionAppId() const { | 41 bool TabContentsSyncedTabDelegate::HasExtensionAppId() const { |
| 42 return (tab_contents_->extension_tab_helper() && | 42 return !!(extensions::TabHelper::FromWebContents( |
| 43 tab_contents_->extension_tab_helper()->extension_app()); | 43 tab_contents_->web_contents())->extension_app()); |
| 44 } | 44 } |
| 45 | 45 |
| 46 const std::string& TabContentsSyncedTabDelegate::GetExtensionAppId() | 46 const std::string& TabContentsSyncedTabDelegate::GetExtensionAppId() |
| 47 const { | 47 const { |
| 48 DCHECK(HasExtensionAppId()); | 48 DCHECK(HasExtensionAppId()); |
| 49 return tab_contents_->extension_tab_helper()->extension_app()->id(); | 49 return extensions::TabHelper::FromWebContents(tab_contents_->web_contents())-> |
| 50 extension_app()->id(); |
| 50 } | 51 } |
| 51 | 52 |
| 52 int TabContentsSyncedTabDelegate::GetCurrentEntryIndex() const { | 53 int TabContentsSyncedTabDelegate::GetCurrentEntryIndex() const { |
| 53 return tab_contents_->web_contents()->GetController().GetCurrentEntryIndex(); | 54 return tab_contents_->web_contents()->GetController().GetCurrentEntryIndex(); |
| 54 } | 55 } |
| 55 | 56 |
| 56 int TabContentsSyncedTabDelegate::GetEntryCount() const { | 57 int TabContentsSyncedTabDelegate::GetEntryCount() const { |
| 57 return tab_contents_->web_contents()->GetController().GetEntryCount(); | 58 return tab_contents_->web_contents()->GetController().GetEntryCount(); |
| 58 } | 59 } |
| 59 | 60 |
| 60 int TabContentsSyncedTabDelegate::GetPendingEntryIndex() const { | 61 int TabContentsSyncedTabDelegate::GetPendingEntryIndex() const { |
| 61 return tab_contents_->web_contents()->GetController().GetPendingEntryIndex(); | 62 return tab_contents_->web_contents()->GetController().GetPendingEntryIndex(); |
| 62 } | 63 } |
| 63 | 64 |
| 64 NavigationEntry* TabContentsSyncedTabDelegate::GetPendingEntry() const { | 65 NavigationEntry* TabContentsSyncedTabDelegate::GetPendingEntry() const { |
| 65 return | 66 return |
| 66 tab_contents_->web_contents()->GetController().GetPendingEntry(); | 67 tab_contents_->web_contents()->GetController().GetPendingEntry(); |
| 67 } | 68 } |
| 68 | 69 |
| 69 NavigationEntry* TabContentsSyncedTabDelegate::GetEntryAtIndex(int i) | 70 NavigationEntry* TabContentsSyncedTabDelegate::GetEntryAtIndex(int i) |
| 70 const { | 71 const { |
| 71 return tab_contents_->web_contents()->GetController().GetEntryAtIndex(i); | 72 return tab_contents_->web_contents()->GetController().GetEntryAtIndex(i); |
| 72 } | 73 } |
| 73 | 74 |
| 74 NavigationEntry* TabContentsSyncedTabDelegate::GetActiveEntry() const { | 75 NavigationEntry* TabContentsSyncedTabDelegate::GetActiveEntry() const { |
| 75 return tab_contents_->web_contents()->GetController().GetActiveEntry(); | 76 return tab_contents_->web_contents()->GetController().GetActiveEntry(); |
| 76 } | 77 } |
| OLD | NEW |