| 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" | 8 #include "chrome/browser/extensions/tab_helper.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/sessions/session_tab_helper.h" | 10 #include "chrome/browser/sessions/session_tab_helper.h" |
| 11 #include "chrome/browser/sync/glue/synced_window_delegate.h" | 11 #include "chrome/browser/sync/glue/synced_window_delegate.h" |
| 12 #include "content/public/browser/navigation_controller.h" | 12 #include "content/public/browser/navigation_controller.h" |
| 13 #include "content/public/browser/navigation_entry.h" | 13 #include "content/public/browser/navigation_entry.h" |
| 14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 15 #include "extensions/common/extension.h" | 15 #include "extensions/common/extension.h" |
| 16 | 16 |
| 17 #if defined(ENABLE_MANAGED_USERS) | 17 #if defined(ENABLE_MANAGED_USERS) |
| 18 #include "chrome/browser/managed_mode/managed_mode_navigation_observer.h" | 18 #include "chrome/browser/supervised_user/supervised_user_navigation_observer.h" |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 using content::NavigationEntry; | 21 using content::NavigationEntry; |
| 22 | 22 |
| 23 DEFINE_WEB_CONTENTS_USER_DATA_KEY(TabContentsSyncedTabDelegate); | 23 DEFINE_WEB_CONTENTS_USER_DATA_KEY(TabContentsSyncedTabDelegate); |
| 24 | 24 |
| 25 TabContentsSyncedTabDelegate::TabContentsSyncedTabDelegate( | 25 TabContentsSyncedTabDelegate::TabContentsSyncedTabDelegate( |
| 26 content::WebContents* web_contents) | 26 content::WebContents* web_contents) |
| 27 : web_contents_(web_contents), sync_session_id_(0) {} | 27 : web_contents_(web_contents), sync_session_id_(0) {} |
| 28 | 28 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 return web_contents_->GetController().GetVisibleEntry(); | 74 return web_contents_->GetController().GetVisibleEntry(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 bool TabContentsSyncedTabDelegate::ProfileIsSupervised() const { | 77 bool TabContentsSyncedTabDelegate::ProfileIsSupervised() const { |
| 78 return profile()->IsSupervised(); | 78 return profile()->IsSupervised(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 const std::vector<const content::NavigationEntry*>* | 81 const std::vector<const content::NavigationEntry*>* |
| 82 TabContentsSyncedTabDelegate::GetBlockedNavigations() const { | 82 TabContentsSyncedTabDelegate::GetBlockedNavigations() const { |
| 83 #if defined(ENABLE_MANAGED_USERS) | 83 #if defined(ENABLE_MANAGED_USERS) |
| 84 ManagedModeNavigationObserver* navigation_observer = | 84 SupervisedUserNavigationObserver* navigation_observer = |
| 85 ManagedModeNavigationObserver::FromWebContents(web_contents_); | 85 SupervisedUserNavigationObserver::FromWebContents(web_contents_); |
| 86 DCHECK(navigation_observer); | 86 DCHECK(navigation_observer); |
| 87 return navigation_observer->blocked_navigations(); | 87 return navigation_observer->blocked_navigations(); |
| 88 #else | 88 #else |
| 89 NOTREACHED(); | 89 NOTREACHED(); |
| 90 return NULL; | 90 return NULL; |
| 91 #endif | 91 #endif |
| 92 } | 92 } |
| 93 | 93 |
| 94 bool TabContentsSyncedTabDelegate::IsPinned() const { | 94 bool TabContentsSyncedTabDelegate::IsPinned() const { |
| 95 const browser_sync::SyncedWindowDelegate* window = | 95 const browser_sync::SyncedWindowDelegate* window = |
| 96 browser_sync::SyncedWindowDelegate::FindSyncedWindowDelegateWithId( | 96 browser_sync::SyncedWindowDelegate::FindSyncedWindowDelegateWithId( |
| 97 GetWindowId()); | 97 GetWindowId()); |
| 98 // We might not have a parent window, e.g. Developer Tools. | 98 // We might not have a parent window, e.g. Developer Tools. |
| 99 return window ? window->IsTabPinned(this) : false; | 99 return window ? window->IsTabPinned(this) : false; |
| 100 } | 100 } |
| 101 | 101 |
| 102 bool TabContentsSyncedTabDelegate::HasWebContents() const { return true; } | 102 bool TabContentsSyncedTabDelegate::HasWebContents() const { return true; } |
| 103 | 103 |
| 104 content::WebContents* TabContentsSyncedTabDelegate::GetWebContents() const { | 104 content::WebContents* TabContentsSyncedTabDelegate::GetWebContents() const { |
| 105 return web_contents_; | 105 return web_contents_; |
| 106 } | 106 } |
| 107 | 107 |
| 108 int TabContentsSyncedTabDelegate::GetSyncId() const { | 108 int TabContentsSyncedTabDelegate::GetSyncId() const { |
| 109 return sync_session_id_; | 109 return sync_session_id_; |
| 110 } | 110 } |
| 111 | 111 |
| 112 void TabContentsSyncedTabDelegate::SetSyncId(int sync_id) { | 112 void TabContentsSyncedTabDelegate::SetSyncId(int sync_id) { |
| 113 sync_session_id_ = sync_id; | 113 sync_session_id_ = sync_id; |
| 114 } | 114 } |
| OLD | NEW |