Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Commit

Permalink
Merge pull request #30 from bsclifton/master
Browse files Browse the repository at this point in the history
Adding NavigationEntry wrapper method for getting history page title.
  • Loading branch information
bbondy authored and bridiver committed Jul 27, 2016
1 parent 30d5334 commit 11b8318
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions atom/browser/api/atom_api_web_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,14 @@ const GURL& WebContents::GetURLAtIndex(int index) const {
return GURL::EmptyGURL();
}

const base::string16 WebContents::GetTitleAtIndex(int index) const {
auto entry = web_contents()->GetController().GetEntryAtIndex(index);
if (entry)
return entry->GetTitle();
else
return base::string16();
}

// TODO(bridiver) there should be a more generic way
// to set renderer preferences in general
const std::string& WebContents::GetWebRTCIPHandlingPolicy() const {
Expand Down Expand Up @@ -1710,6 +1718,7 @@ void WebContents::BuildPrototype(v8::Isolate* isolate,
.SetMethod("canGoForward", &WebContents::CanGoForward)
.SetMethod("canGoToOffset", &WebContents::CanGoToOffset)
.SetMethod("getURLAtIndex", &WebContents::GetURLAtIndex)
.SetMethod("getTitleAtIndex", &WebContents::GetTitleAtIndex)
.SetMethod("getEntryCount", &WebContents::GetEntryCount)
.SetMethod("getCurrentEntryIndex", &WebContents::GetCurrentEntryIndex)
.SetMethod("getLastCommittedEntryIndex",
Expand Down
1 change: 1 addition & 0 deletions atom/browser/api/atom_api_web_contents.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
bool CanGoForward() const;
void GoToIndex(int index);
const GURL& GetURLAtIndex(int index) const;
const base::string16 GetTitleAtIndex(int index) const;
int GetCurrentEntryIndex() const;
int GetLastCommittedEntryIndex() const;
int GetEntryCount() const;
Expand Down

0 comments on commit 11b8318

Please sign in to comment.