Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: components/sessions/content/content_open_tab.cc

Issue 1321713005: Abstract WebContents/NavigationController from core TabRestore code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "components/sessions/content/content_open_tab.h"
6
7 #include "content/public/browser/web_contents.h"
8
9 DEFINE_WEB_CONTENTS_USER_DATA_KEY(sessions::ContentOpenTab);
10
11 namespace sessions {
12
13 ContentOpenTab::ContentOpenTab(content::WebContents* contents)
14 : web_contents_(contents) {}
15
16 ContentOpenTab::~ContentOpenTab() {}
17
18 int ContentOpenTab::GetCurrentEntryIndex() {
19 return navigation_controller().GetCurrentEntryIndex();
20 }
21
22 int ContentOpenTab::GetPendingEntryIndex() {
23 return navigation_controller().GetPendingEntryIndex();
24 }
25
26 sessions::SerializedNavigationEntry ContentOpenTab::GetEntryAtIndex(int index) {
27 return sessions::ContentSerializedNavigationBuilder::FromNavigationEntry(
28 index, *navigation_controller().GetEntryAtIndex(index));
29 }
30
31 sessions::SerializedNavigationEntry ContentOpenTab::GetPendingEntry() {
32 return sessions::ContentSerializedNavigationBuilder::FromNavigationEntry(
33 GetPendingEntryIndex(), *navigation_controller().GetPendingEntry());
34 }
35
36 int ContentOpenTab::GetEntryCount() {
37 return navigation_controller().GetEntryCount();
38 }
39
40 void ContentOpenTab::LoadIfNecessary() {
41 navigation_controller().LoadIfNecessary();
42 }
43
44 const std::string& ContentOpenTab::GetUserAgentOverride() const {
45 return web_contents()->GetUserAgentOverride();
46 }
47
48 } // namespace sessions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698