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

Unified Diff: content/renderer/browser_plugin/browser_plugin.cc

Issue 11092023: Browser Plugin: Implement CanGoBack/CanGoForward (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/browser_plugin/browser_plugin.cc
diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc
index ed0f293678b2d13a4c5398ce6640fec90470115a..5581eeb2fe586a8b03397a0972e3ab6c8a47df89 100644
--- a/content/renderer/browser_plugin/browser_plugin.cc
+++ b/content/renderer/browser_plugin/browser_plugin.cc
@@ -72,7 +72,9 @@ BrowserPlugin::BrowserPlugin(
navigate_src_sent_(false),
process_id_(-1),
persist_storage_(false),
- visible_(true) {
+ visible_(true),
+ current_nav_entry_index_(0),
+ nav_entry_count_(0) {
BrowserPluginManager::Get()->AddBrowserPlugin(instance_id, this);
bindings_.reset(new BrowserPluginBindings(this));
@@ -149,6 +151,15 @@ std::string BrowserPlugin::GetPartitionAttribute() const {
return value;
}
+bool BrowserPlugin::CanGoBack() const {
+ return nav_entry_count_ > 1 && current_nav_entry_index_ > 0;
+}
+
+bool BrowserPlugin::CanGoForward() const {
+ return current_nav_entry_index_ >= 0 &&
+ current_nav_entry_index_ < (nav_entry_count_ - 1);
+}
+
bool BrowserPlugin::SetPartitionAttribute(const std::string& partition_id,
std::string& error_message) {
if (navigate_src_sent_) {
@@ -337,6 +348,13 @@ void BrowserPlugin::GuestCrashed() {
}
}
+void BrowserPlugin::NavigationStateUpdate(int current_entry_index,
+ int entry_count) {
+ current_nav_entry_index_ = current_entry_index;
+ nav_entry_count_ = entry_count;
+}
+
+
void BrowserPlugin::DidNavigate(const GURL& url, int process_id) {
src_ = url.spec();
process_id_ = process_id;

Powered by Google App Engine
This is Rietveld 408576698