| OLD | NEW |
| (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 |
| OLD | NEW |