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 "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/sessions/session_service.h" | 9 #include "chrome/browser/sessions/session_service.h" |
10 #include "chrome/browser/sessions/session_service_factory.h" | 10 #include "chrome/browser/sessions/session_service_factory.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 sessions::LiveTabContext* ChromeTabRestoreServiceClient::CreateLiveTabContext( | 51 sessions::LiveTabContext* ChromeTabRestoreServiceClient::CreateLiveTabContext( |
52 int host_desktop_type, | |
53 const std::string& app_name) { | 52 const std::string& app_name) { |
54 #if defined(OS_ANDROID) | 53 #if defined(OS_ANDROID) |
55 // Android does not support LiveTabContext, as tab persistence | 54 // Android does not support LiveTabContext, as tab persistence |
56 // is implemented on the Java side. | 55 // is implemented on the Java side. |
57 return nullptr; | 56 return nullptr; |
58 #else | 57 #else |
59 return BrowserLiveTabContext::Create( | 58 return BrowserLiveTabContext::Create(profile_, app_name); |
60 profile_, static_cast<chrome::HostDesktopType>(host_desktop_type), | |
61 app_name); | |
62 #endif | 59 #endif |
63 } | 60 } |
64 | 61 |
65 sessions::LiveTabContext* | 62 sessions::LiveTabContext* |
66 ChromeTabRestoreServiceClient::FindLiveTabContextForTab( | 63 ChromeTabRestoreServiceClient::FindLiveTabContextForTab( |
67 const sessions::LiveTab* tab) { | 64 const sessions::LiveTab* tab) { |
68 #if defined(OS_ANDROID) | 65 #if defined(OS_ANDROID) |
69 // Android does not support LiveTabContext, as tab persistence | 66 // Android does not support LiveTabContext, as tab persistence |
70 // is implemented on the Java side. | 67 // is implemented on the Java side. |
71 return nullptr; | 68 return nullptr; |
72 #else | 69 #else |
73 return BrowserLiveTabContext::FindContextForWebContents( | 70 return BrowserLiveTabContext::FindContextForWebContents( |
74 static_cast<const sessions::ContentLiveTab*>(tab)->web_contents()); | 71 static_cast<const sessions::ContentLiveTab*>(tab)->web_contents()); |
75 #endif | 72 #endif |
76 } | 73 } |
77 | 74 |
78 sessions::LiveTabContext* | 75 sessions::LiveTabContext* |
79 ChromeTabRestoreServiceClient::FindLiveTabContextWithID( | 76 ChromeTabRestoreServiceClient::FindLiveTabContextWithID( |
80 SessionID::id_type desired_id, | 77 SessionID::id_type desired_id) { |
81 int host_desktop_type) { | |
82 #if defined(OS_ANDROID) | 78 #if defined(OS_ANDROID) |
83 // Android does not support LiveTabContext, as tab persistence | 79 // Android does not support LiveTabContext, as tab persistence |
84 // is implemented on the Java side. | 80 // is implemented on the Java side. |
85 return nullptr; | 81 return nullptr; |
86 #else | 82 #else |
87 return BrowserLiveTabContext::FindContextWithID( | 83 return BrowserLiveTabContext::FindContextWithID(desired_id); |
88 desired_id, static_cast<chrome::HostDesktopType>(host_desktop_type)); | |
89 #endif | 84 #endif |
90 } | 85 } |
91 | 86 |
92 bool ChromeTabRestoreServiceClient::ShouldTrackURLForRestore(const GURL& url) { | 87 bool ChromeTabRestoreServiceClient::ShouldTrackURLForRestore(const GURL& url) { |
93 return ::ShouldTrackURLForRestore(url); | 88 return ::ShouldTrackURLForRestore(url); |
94 } | 89 } |
95 | 90 |
96 std::string ChromeTabRestoreServiceClient::GetExtensionAppIDForTab( | 91 std::string ChromeTabRestoreServiceClient::GetExtensionAppIDForTab( |
97 sessions::LiveTab* tab) { | 92 sessions::LiveTab* tab) { |
98 std::string extension_app_id; | 93 std::string extension_app_id; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 DCHECK(HasLastSession()); | 144 DCHECK(HasLastSession()); |
150 #if defined(ENABLE_SESSION_SERVICE) | 145 #if defined(ENABLE_SESSION_SERVICE) |
151 SessionServiceFactory::GetForProfile(profile_) | 146 SessionServiceFactory::GetForProfile(profile_) |
152 ->GetLastSession(callback, tracker); | 147 ->GetLastSession(callback, tracker); |
153 #endif | 148 #endif |
154 } | 149 } |
155 | 150 |
156 void ChromeTabRestoreServiceClient::OnTabRestored(const GURL& url) { | 151 void ChromeTabRestoreServiceClient::OnTabRestored(const GURL& url) { |
157 RecordAppLaunch(profile_, url); | 152 RecordAppLaunch(profile_, url); |
158 } | 153 } |
OLD | NEW |