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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
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/ui/sync/tab_contents_synced_tab_delegate.h" 5 #include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h"
6 6
7 #include "base/memory/ref_counted.h"
7 #include "chrome/browser/extensions/tab_helper.h" 8 #include "chrome/browser/extensions/tab_helper.h"
8 #include "chrome/browser/sessions/session_tab_helper.h" 9 #include "chrome/browser/sessions/session_tab_helper.h"
10 #include "chrome/browser/sync/glue/synced_window_delegate.h"
9 #include "chrome/browser/ui/tab_contents/tab_contents.h" 11 #include "chrome/browser/ui/tab_contents/tab_contents.h"
10 #include "chrome/common/extensions/extension.h" 12 #include "chrome/common/extensions/extension.h"
11 #include "content/public/browser/navigation_controller.h" 13 #include "content/public/browser/navigation_controller.h"
12 #include "content/public/browser/navigation_entry.h" 14 #include "content/public/browser/navigation_entry.h"
13 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
14 16
15 using content::NavigationEntry; 17 using content::NavigationEntry;
16 18
17 TabContentsSyncedTabDelegate::TabContentsSyncedTabDelegate( 19 TabContentsSyncedTabDelegate::TabContentsSyncedTabDelegate(
18 TabContents* tab_contents) 20 TabContents* tab_contents)
(...skipping 12 matching lines...) Expand all
31 } 33 }
32 34
33 bool TabContentsSyncedTabDelegate::IsBeingDestroyed() const { 35 bool TabContentsSyncedTabDelegate::IsBeingDestroyed() const {
34 return tab_contents_->in_destructor(); 36 return tab_contents_->in_destructor();
35 } 37 }
36 38
37 Profile* TabContentsSyncedTabDelegate::profile() const { 39 Profile* TabContentsSyncedTabDelegate::profile() const {
38 return tab_contents_->profile(); 40 return tab_contents_->profile();
39 } 41 }
40 42
41 bool TabContentsSyncedTabDelegate::HasExtensionAppId() const { 43 std::string TabContentsSyncedTabDelegate::GetExtensionAppId() const {
42 return !!(extensions::TabHelper::FromWebContents( 44 const scoped_refptr<const extensions::Extension> extension_app(
43 tab_contents_->web_contents())->extension_app()); 45 extensions::TabHelper::FromWebContents(
44 } 46 tab_contents_->web_contents())->extension_app());
45 47 return (extension_app.get() ? extension_app->id() : "");
46 const std::string& TabContentsSyncedTabDelegate::GetExtensionAppId()
47 const {
48 DCHECK(HasExtensionAppId());
49 return extensions::TabHelper::FromWebContents(tab_contents_->web_contents())->
50 extension_app()->id();
51 } 48 }
52 49
53 int TabContentsSyncedTabDelegate::GetCurrentEntryIndex() const { 50 int TabContentsSyncedTabDelegate::GetCurrentEntryIndex() const {
54 return tab_contents_->web_contents()->GetController().GetCurrentEntryIndex(); 51 return tab_contents_->web_contents()->GetController().GetCurrentEntryIndex();
55 } 52 }
56 53
57 int TabContentsSyncedTabDelegate::GetEntryCount() const { 54 int TabContentsSyncedTabDelegate::GetEntryCount() const {
58 return tab_contents_->web_contents()->GetController().GetEntryCount(); 55 return tab_contents_->web_contents()->GetController().GetEntryCount();
59 } 56 }
60 57
61 int TabContentsSyncedTabDelegate::GetPendingEntryIndex() const { 58 int TabContentsSyncedTabDelegate::GetPendingEntryIndex() const {
62 return tab_contents_->web_contents()->GetController().GetPendingEntryIndex(); 59 return tab_contents_->web_contents()->GetController().GetPendingEntryIndex();
63 } 60 }
64 61
65 NavigationEntry* TabContentsSyncedTabDelegate::GetPendingEntry() const { 62 NavigationEntry* TabContentsSyncedTabDelegate::GetPendingEntry() const {
66 return 63 return
67 tab_contents_->web_contents()->GetController().GetPendingEntry(); 64 tab_contents_->web_contents()->GetController().GetPendingEntry();
68 } 65 }
69 66
70 NavigationEntry* TabContentsSyncedTabDelegate::GetEntryAtIndex(int i) 67 NavigationEntry* TabContentsSyncedTabDelegate::GetEntryAtIndex(int i)
71 const { 68 const {
72 return tab_contents_->web_contents()->GetController().GetEntryAtIndex(i); 69 return tab_contents_->web_contents()->GetController().GetEntryAtIndex(i);
73 } 70 }
74 71
75 NavigationEntry* TabContentsSyncedTabDelegate::GetActiveEntry() const { 72 NavigationEntry* TabContentsSyncedTabDelegate::GetActiveEntry() const {
76 return tab_contents_->web_contents()->GetController().GetActiveEntry(); 73 return tab_contents_->web_contents()->GetController().GetActiveEntry();
77 } 74 }
75
76 bool TabContentsSyncedTabDelegate::IsPinned() const {
77 const browser_sync::SyncedWindowDelegate* window =
78 browser_sync::SyncedWindowDelegate::FindSyncedWindowDelegateWithId(
79 GetWindowId());
80 // We might not have a parent window, e.g. Developer Tools.
81 return window ? window->IsTabPinned(this) : false;
82 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698