| 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 "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" | 
| 8 #include "chrome/browser/extensions/tab_helper.h" |  | 
| 9 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" | 
| 10 #include "chrome/browser/sessions/session_tab_helper.h" | 9 #include "chrome/browser/sessions/session_tab_helper.h" | 
| 11 #include "chrome/browser/sync/glue/synced_window_delegate.h" | 10 #include "chrome/browser/sync/glue/synced_window_delegate.h" | 
| 12 #include "content/public/browser/navigation_controller.h" | 11 #include "content/public/browser/navigation_controller.h" | 
| 13 #include "content/public/browser/navigation_entry.h" | 12 #include "content/public/browser/navigation_entry.h" | 
| 14 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" | 
| 15 #include "extensions/common/extension.h" | 14 #include "extensions/common/extension.h" | 
| 16 | 15 | 
|  | 16 #if defined(ENABLE_EXTENSIONS) | 
|  | 17 #include "chrome/browser/extensions/tab_helper.h" | 
|  | 18 #endif | 
|  | 19 | 
| 17 #if defined(ENABLE_MANAGED_USERS) | 20 #if defined(ENABLE_MANAGED_USERS) | 
| 18 #include "chrome/browser/supervised_user/supervised_user_navigation_observer.h" | 21 #include "chrome/browser/supervised_user/supervised_user_navigation_observer.h" | 
| 19 #endif | 22 #endif | 
| 20 | 23 | 
| 21 using content::NavigationEntry; | 24 using content::NavigationEntry; | 
| 22 | 25 | 
| 23 DEFINE_WEB_CONTENTS_USER_DATA_KEY(TabContentsSyncedTabDelegate); | 26 DEFINE_WEB_CONTENTS_USER_DATA_KEY(TabContentsSyncedTabDelegate); | 
| 24 | 27 | 
| 25 TabContentsSyncedTabDelegate::TabContentsSyncedTabDelegate( | 28 TabContentsSyncedTabDelegate::TabContentsSyncedTabDelegate( | 
| 26     content::WebContents* web_contents) | 29     content::WebContents* web_contents) | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 38 | 41 | 
| 39 bool TabContentsSyncedTabDelegate::IsBeingDestroyed() const { | 42 bool TabContentsSyncedTabDelegate::IsBeingDestroyed() const { | 
| 40   return web_contents_->IsBeingDestroyed(); | 43   return web_contents_->IsBeingDestroyed(); | 
| 41 } | 44 } | 
| 42 | 45 | 
| 43 Profile* TabContentsSyncedTabDelegate::profile() const { | 46 Profile* TabContentsSyncedTabDelegate::profile() const { | 
| 44   return Profile::FromBrowserContext(web_contents_->GetBrowserContext()); | 47   return Profile::FromBrowserContext(web_contents_->GetBrowserContext()); | 
| 45 } | 48 } | 
| 46 | 49 | 
| 47 std::string TabContentsSyncedTabDelegate::GetExtensionAppId() const { | 50 std::string TabContentsSyncedTabDelegate::GetExtensionAppId() const { | 
|  | 51 #if defined(ENABLE_EXTENSIONS) | 
| 48   const scoped_refptr<const extensions::Extension> extension_app( | 52   const scoped_refptr<const extensions::Extension> extension_app( | 
| 49       extensions::TabHelper::FromWebContents(web_contents_)->extension_app()); | 53       extensions::TabHelper::FromWebContents(web_contents_)->extension_app()); | 
| 50   return (extension_app.get() ? extension_app->id() : std::string()); | 54   if (extension_app.get()) | 
|  | 55     return extension_app->id(); | 
|  | 56 #endif | 
|  | 57   return std::string(); | 
| 51 } | 58 } | 
| 52 | 59 | 
| 53 int TabContentsSyncedTabDelegate::GetCurrentEntryIndex() const { | 60 int TabContentsSyncedTabDelegate::GetCurrentEntryIndex() const { | 
| 54   return web_contents_->GetController().GetCurrentEntryIndex(); | 61   return web_contents_->GetController().GetCurrentEntryIndex(); | 
| 55 } | 62 } | 
| 56 | 63 | 
| 57 int TabContentsSyncedTabDelegate::GetEntryCount() const { | 64 int TabContentsSyncedTabDelegate::GetEntryCount() const { | 
| 58   return web_contents_->GetController().GetEntryCount(); | 65   return web_contents_->GetController().GetEntryCount(); | 
| 59 } | 66 } | 
| 60 | 67 | 
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 105   return web_contents_; | 112   return web_contents_; | 
| 106 } | 113 } | 
| 107 | 114 | 
| 108 int TabContentsSyncedTabDelegate::GetSyncId() const { | 115 int TabContentsSyncedTabDelegate::GetSyncId() const { | 
| 109   return sync_session_id_; | 116   return sync_session_id_; | 
| 110 } | 117 } | 
| 111 | 118 | 
| 112 void TabContentsSyncedTabDelegate::SetSyncId(int sync_id) { | 119 void TabContentsSyncedTabDelegate::SetSyncId(int sync_id) { | 
| 113   sync_session_id_ = sync_id; | 120   sync_session_id_ = sync_id; | 
| 114 } | 121 } | 
| OLD | NEW | 
|---|