| 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/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/sessions/session_tab_helper.h" | 9 #include "chrome/browser/sessions/session_tab_helper.h" |
| 10 #include "chrome/common/features.h" | 10 #include "chrome/common/features.h" |
| 11 #include "components/sessions/content/content_serialized_navigation_builder.h" | 11 #include "components/sessions/content/content_serialized_navigation_builder.h" |
| 12 #include "components/sync_sessions/sync_sessions_client.h" | 12 #include "components/sync_sessions/sync_sessions_client.h" |
| 13 #include "components/sync_sessions/synced_window_delegate.h" | 13 #include "components/sync_sessions/synced_window_delegate.h" |
| 14 #include "components/sync_sessions/synced_window_delegates_getter.h" | 14 #include "components/sync_sessions/synced_window_delegates_getter.h" |
| 15 #include "content/public/browser/favicon_status.h" | 15 #include "content/public/browser/favicon_status.h" |
| 16 #include "content/public/browser/navigation_controller.h" | 16 #include "content/public/browser/navigation_controller.h" |
| 17 #include "content/public/browser/navigation_entry.h" | 17 #include "content/public/browser/navigation_entry.h" |
| 18 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
| 19 #include "extensions/features/features.h" |
| 19 | 20 |
| 20 #if defined(ENABLE_EXTENSIONS) | 21 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 21 #include "chrome/browser/extensions/tab_helper.h" | 22 #include "chrome/browser/extensions/tab_helper.h" |
| 22 #include "extensions/common/extension.h" | 23 #include "extensions/common/extension.h" |
| 23 #endif | 24 #endif |
| 24 | 25 |
| 25 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) | 26 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
| 26 #include "chrome/browser/supervised_user/supervised_user_navigation_observer.h" | 27 #include "chrome/browser/supervised_user/supervised_user_navigation_observer.h" |
| 27 #endif | 28 #endif |
| 28 | 29 |
| 29 using content::NavigationEntry; | 30 using content::NavigationEntry; |
| 30 | 31 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 56 | 57 |
| 57 SessionID::id_type TabContentsSyncedTabDelegate::GetSessionId() const { | 58 SessionID::id_type TabContentsSyncedTabDelegate::GetSessionId() const { |
| 58 return SessionTabHelper::FromWebContents(web_contents_)->session_id().id(); | 59 return SessionTabHelper::FromWebContents(web_contents_)->session_id().id(); |
| 59 } | 60 } |
| 60 | 61 |
| 61 bool TabContentsSyncedTabDelegate::IsBeingDestroyed() const { | 62 bool TabContentsSyncedTabDelegate::IsBeingDestroyed() const { |
| 62 return web_contents_->IsBeingDestroyed(); | 63 return web_contents_->IsBeingDestroyed(); |
| 63 } | 64 } |
| 64 | 65 |
| 65 std::string TabContentsSyncedTabDelegate::GetExtensionAppId() const { | 66 std::string TabContentsSyncedTabDelegate::GetExtensionAppId() const { |
| 66 #if defined(ENABLE_EXTENSIONS) | 67 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 67 const scoped_refptr<const extensions::Extension> extension_app( | 68 const scoped_refptr<const extensions::Extension> extension_app( |
| 68 extensions::TabHelper::FromWebContents(web_contents_)->extension_app()); | 69 extensions::TabHelper::FromWebContents(web_contents_)->extension_app()); |
| 69 if (extension_app.get()) | 70 if (extension_app.get()) |
| 70 return extension_app->id(); | 71 return extension_app->id(); |
| 71 #endif | 72 #endif |
| 72 return std::string(); | 73 return std::string(); |
| 73 } | 74 } |
| 74 | 75 |
| 75 bool TabContentsSyncedTabDelegate::IsInitialBlankNavigation() const { | 76 bool TabContentsSyncedTabDelegate::IsInitialBlankNavigation() const { |
| 76 return web_contents_->GetController().IsInitialBlankNavigation(); | 77 return web_contents_->GetController().IsInitialBlankNavigation(); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 for (int i = 0; i < entry_count; ++i) { | 157 for (int i = 0; i < entry_count; ++i) { |
| 157 const GURL& virtual_url = GetVirtualURLAtIndex(i); | 158 const GURL& virtual_url = GetVirtualURLAtIndex(i); |
| 158 if (!virtual_url.is_valid()) | 159 if (!virtual_url.is_valid()) |
| 159 continue; | 160 continue; |
| 160 | 161 |
| 161 if (sessions_client->ShouldSyncURL(virtual_url)) | 162 if (sessions_client->ShouldSyncURL(virtual_url)) |
| 162 return true; | 163 return true; |
| 163 } | 164 } |
| 164 return false; | 165 return false; |
| 165 } | 166 } |
| OLD | NEW |