blob: 2a23b4a23c56314c649b8dd9a29afc27f83f1c0b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ios/chrome/browser/sessions/ios_chrome_tab_restore_service_client.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/chrome_url_constants.h"
#include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
#include "ios/public/provider/chrome/browser/sessions/live_tab_context_provider.h"
#include "ios/web/public/web_thread.h"
#include "url/gurl.h"
IOSChromeTabRestoreServiceClient::IOSChromeTabRestoreServiceClient(
ios::ChromeBrowserState* browser_state)
: browser_state_(browser_state) {}
IOSChromeTabRestoreServiceClient::~IOSChromeTabRestoreServiceClient() {}
sessions::LiveTabContext*
IOSChromeTabRestoreServiceClient::CreateLiveTabContext(
const std::string& app_name) {
return ios::GetChromeBrowserProvider()->GetLiveTabContextProvider()->Create(
browser_state_);
}
sessions::LiveTabContext*
IOSChromeTabRestoreServiceClient::FindLiveTabContextForTab(
const sessions::LiveTab* tab) {
return ios::GetChromeBrowserProvider()
->GetLiveTabContextProvider()
->FindContextForTab(tab);
}
sessions::LiveTabContext*
IOSChromeTabRestoreServiceClient::FindLiveTabContextWithID(
SessionID::id_type desired_id) {
return ios::GetChromeBrowserProvider()
->GetLiveTabContextProvider()
->FindContextWithID(desired_id);
}
bool IOSChromeTabRestoreServiceClient::ShouldTrackURLForRestore(
const GURL& url) {
// NOTE: In the //chrome client, chrome://quit and chrome://restart are
// blacklisted from being tracked to avoid entering infinite loops. However,
// iOS intentionally does not support those URLs, so there is no need to
// blacklist them here.
return url.is_valid();
}
std::string IOSChromeTabRestoreServiceClient::GetExtensionAppIDForTab(
sessions::LiveTab* tab) {
return std::string();
}
base::SequencedWorkerPool* IOSChromeTabRestoreServiceClient::GetBlockingPool() {
DCHECK_CURRENTLY_ON(web::WebThread::UI);
return web::WebThread::GetBlockingPool();
}
base::FilePath IOSChromeTabRestoreServiceClient::GetPathToSaveTo() {
// Note that this will return a different path in incognito from normal mode.
// In this case, that shouldn't be an issue because the tab restore service
// is not used in incognito mode.
return browser_state_->GetStatePath();
}
GURL IOSChromeTabRestoreServiceClient::GetNewTabURL() {
return GURL(kChromeUINewTabURL);
}
bool IOSChromeTabRestoreServiceClient::HasLastSession() {
return false;
}
void IOSChromeTabRestoreServiceClient::GetLastSession(
const sessions::GetLastSessionCallback& callback,
base::CancelableTaskTracker* tracker) {
NOTREACHED();
}
|