OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/sessions/chrome_tab_restore_service_client.h" | 5 #include "chrome/browser/sessions/chrome_tab_restore_service_client.h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/sessions/session_service.h" | 8 #include "chrome/browser/sessions/session_service.h" |
9 #include "chrome/browser/sessions/session_service_factory.h" | 9 #include "chrome/browser/sessions/session_service_factory.h" |
10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 #endif // defined(ENABLE_EXTENSIONS) | 41 #endif // defined(ENABLE_EXTENSIONS) |
42 } | 42 } |
43 | 43 |
44 } // namespace | 44 } // namespace |
45 | 45 |
46 ChromeTabRestoreServiceClient::ChromeTabRestoreServiceClient(Profile* profile) | 46 ChromeTabRestoreServiceClient::ChromeTabRestoreServiceClient(Profile* profile) |
47 : profile_(profile) {} | 47 : profile_(profile) {} |
48 | 48 |
49 ChromeTabRestoreServiceClient::~ChromeTabRestoreServiceClient() {} | 49 ChromeTabRestoreServiceClient::~ChromeTabRestoreServiceClient() {} |
50 | 50 |
51 TabRestoreServiceDelegate* | 51 sessions::TabRestoreServiceDelegate* |
52 ChromeTabRestoreServiceClient::CreateTabRestoreServiceDelegate( | 52 ChromeTabRestoreServiceClient::CreateTabRestoreServiceDelegate( |
53 int host_desktop_type, | 53 int host_desktop_type, |
54 const std::string& app_name) { | 54 const std::string& app_name) { |
55 #if defined(OS_ANDROID) | 55 #if defined(OS_ANDROID) |
56 // Android does not support TabRestoreServiceDelegate, as tab persistence | 56 // Android does not support TabRestoreServiceDelegate, as tab persistence |
57 // is implemented on the Java side. | 57 // is implemented on the Java side. |
58 return nullptr; | 58 return nullptr; |
59 #else | 59 #else |
60 return BrowserTabRestoreServiceDelegate::Create( | 60 return BrowserTabRestoreServiceDelegate::Create( |
61 profile_, static_cast<chrome::HostDesktopType>(host_desktop_type), | 61 profile_, static_cast<chrome::HostDesktopType>(host_desktop_type), |
62 app_name); | 62 app_name); |
63 #endif | 63 #endif |
64 } | 64 } |
65 | 65 |
66 TabRestoreServiceDelegate* | 66 sessions::TabRestoreServiceDelegate* |
67 ChromeTabRestoreServiceClient::FindTabRestoreServiceDelegateForTab( | 67 ChromeTabRestoreServiceClient::FindTabRestoreServiceDelegateForTab( |
68 const sessions::LiveTab* tab) { | 68 const sessions::LiveTab* tab) { |
69 #if defined(OS_ANDROID) | 69 #if defined(OS_ANDROID) |
70 // Android does not support TabRestoreServiceDelegate, as tab persistence | 70 // Android does not support TabRestoreServiceDelegate, as tab persistence |
71 // is implemented on the Java side. | 71 // is implemented on the Java side. |
72 return nullptr; | 72 return nullptr; |
73 #else | 73 #else |
74 return BrowserTabRestoreServiceDelegate::FindDelegateForWebContents( | 74 return BrowserTabRestoreServiceDelegate::FindDelegateForWebContents( |
75 static_cast<const sessions::ContentLiveTab*>(tab)->web_contents()); | 75 static_cast<const sessions::ContentLiveTab*>(tab)->web_contents()); |
76 #endif | 76 #endif |
77 } | 77 } |
78 | 78 |
79 TabRestoreServiceDelegate* | 79 sessions::TabRestoreServiceDelegate* |
80 ChromeTabRestoreServiceClient::FindTabRestoreServiceDelegateWithID( | 80 ChromeTabRestoreServiceClient::FindTabRestoreServiceDelegateWithID( |
81 SessionID::id_type desired_id, | 81 SessionID::id_type desired_id, |
82 int host_desktop_type) { | 82 int host_desktop_type) { |
83 #if defined(OS_ANDROID) | 83 #if defined(OS_ANDROID) |
84 // Android does not support TabRestoreServiceDelegate, as tab persistence | 84 // Android does not support TabRestoreServiceDelegate, as tab persistence |
85 // is implemented on the Java side. | 85 // is implemented on the Java side. |
86 return nullptr; | 86 return nullptr; |
87 #else | 87 #else |
88 return BrowserTabRestoreServiceDelegate::FindDelegateWithID( | 88 return BrowserTabRestoreServiceDelegate::FindDelegateWithID( |
89 desired_id, static_cast<chrome::HostDesktopType>(host_desktop_type)); | 89 desired_id, static_cast<chrome::HostDesktopType>(host_desktop_type)); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 DCHECK(HasLastSession()); | 156 DCHECK(HasLastSession()); |
157 #if defined(ENABLE_SESSION_SERVICE) | 157 #if defined(ENABLE_SESSION_SERVICE) |
158 SessionServiceFactory::GetForProfile(profile_) | 158 SessionServiceFactory::GetForProfile(profile_) |
159 ->GetLastSession(callback, tracker); | 159 ->GetLastSession(callback, tracker); |
160 #endif | 160 #endif |
161 } | 161 } |
162 | 162 |
163 void ChromeTabRestoreServiceClient::OnTabRestored(const GURL& url) { | 163 void ChromeTabRestoreServiceClient::OnTabRestored(const GURL& url) { |
164 RecordAppLaunch(profile_, url); | 164 RecordAppLaunch(profile_, url); |
165 } | 165 } |
OLD | NEW |