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

Unified Diff: chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc

Issue 10990012: [Sync] Refactor handling of session tabs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Few more fixes Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc
diff --git a/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc b/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc
index 4cab6ca53105ca2b2e28f517c23432404592474a..2e9992e4a8ea2fa41f15fc13a98d402e71aea494 100644
--- a/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc
+++ b/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc
@@ -4,8 +4,10 @@
#include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h"
+#include "base/memory/ref_counted.h"
#include "chrome/browser/extensions/tab_helper.h"
#include "chrome/browser/sessions/session_tab_helper.h"
+#include "chrome/browser/sync/glue/synced_window_delegate.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/common/extensions/extension.h"
#include "content/public/browser/navigation_controller.h"
@@ -38,16 +40,11 @@ Profile* TabContentsSyncedTabDelegate::profile() const {
return tab_contents_->profile();
}
-bool TabContentsSyncedTabDelegate::HasExtensionAppId() const {
- return !!(extensions::TabHelper::FromWebContents(
- tab_contents_->web_contents())->extension_app());
-}
-
-const std::string& TabContentsSyncedTabDelegate::GetExtensionAppId()
- const {
- DCHECK(HasExtensionAppId());
- return extensions::TabHelper::FromWebContents(tab_contents_->web_contents())->
- extension_app()->id();
+std::string TabContentsSyncedTabDelegate::GetExtensionAppId() const {
+ const scoped_refptr<const extensions::Extension> extension_app(
+ extensions::TabHelper::FromWebContents(
+ tab_contents_->web_contents())->extension_app());
+ return (extension_app.get() ? extension_app->id() : "");
}
int TabContentsSyncedTabDelegate::GetCurrentEntryIndex() const {
@@ -75,3 +72,11 @@ NavigationEntry* TabContentsSyncedTabDelegate::GetEntryAtIndex(int i)
NavigationEntry* TabContentsSyncedTabDelegate::GetActiveEntry() const {
return tab_contents_->web_contents()->GetController().GetActiveEntry();
}
+
+bool TabContentsSyncedTabDelegate::IsPinned() const {
+ const browser_sync::SyncedWindowDelegate* window =
+ browser_sync::SyncedWindowDelegate::FindSyncedWindowDelegateWithId(
+ GetWindowId());
+ // We might not have a parent window, e.g. Developer Tools.
+ return window ? window->IsTabPinned(this) : false;
+}

Powered by Google App Engine
This is Rietveld 408576698