Index: ios/web/navigation/navigation_item_impl.h |
diff --git a/ios/web/navigation/navigation_item_impl.h b/ios/web/navigation/navigation_item_impl.h |
index 26cc2bc36d42b36ee14cd15ff56848f84847f076..9abd992f2b81dec2a74ca45f8002033f8922491f 100644 |
--- a/ios/web/navigation/navigation_item_impl.h |
+++ b/ios/web/navigation/navigation_item_impl.h |
@@ -8,14 +8,18 @@ |
#include "base/basictypes.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/strings/string16.h" |
+#include "ios/web/navigation/navigation_item_facade_delegate.h" |
#include "ios/web/public/favicon_status.h" |
#include "ios/web/public/navigation_item.h" |
#include "ios/web/public/referrer.h" |
#include "ios/web/public/ssl_status.h" |
#include "url/gurl.h" |
+ |
namespace web { |
+class NavigationItemFacadeDelegate; |
+ |
// Implementation of NavigationItem. |
class NavigationItemImpl : public web::NavigationItem { |
public: |
@@ -23,6 +27,17 @@ class NavigationItemImpl : public web::NavigationItem { |
NavigationItemImpl(); |
~NavigationItemImpl() override; |
+ // Since NavigationItemImpls own their facade delegates, there is no implicit |
+ // copy constructor (scoped_ptrs can't be copied), so one is defined here. |
+ NavigationItemImpl(const NavigationItemImpl& item); |
+ |
+ // Accessors for the delegate used to drive the navigation entry facade. |
+ // NOTE: to minimize facade synchronization code, NavigationItems take |
+ // ownership of their facade delegates. |
+ void SetFacadeDelegate( |
+ scoped_ptr<NavigationItemFacadeDelegate> facade_delegate); |
+ NavigationItemFacadeDelegate* GetFacadeDelegate() const; |
+ |
// NavigationItem implementation: |
int GetUniqueID() const override; |
void SetURL(const GURL& url) override; |
@@ -35,6 +50,8 @@ class NavigationItemImpl : public web::NavigationItem { |
const base::string16& GetTitle() const override; |
void SetPageID(int page_id) override; |
int32 GetPageID() const override; |
+ void SetPageScrollState(const PageScrollState& scroll_state) override; |
+ const PageScrollState& GetPageScrollState() const override; |
const base::string16& GetTitleForDisplay( |
const std::string& languages) const override; |
void SetTransitionType(ui::PageTransition transition_type) override; |
@@ -45,6 +62,19 @@ class NavigationItemImpl : public web::NavigationItem { |
SSLStatus& GetSSL() override; |
void SetTimestamp(base::Time timestamp) override; |
base::Time GetTimestamp() const override; |
+ void SetUnsafe(bool is_unsafe) override; |
+ bool IsUnsafe() const override; |
+ |
+ // Once a navigation item is committed, we should no longer track |
+ // non-persisted state, as documented on the members below. |
+ void ResetForCommit(); |
+ |
+ // Whether this (pending) navigation is renderer-initiated. Resets to false |
+ // for all types of navigations after commit. |
+ void set_is_renderer_initiated(bool is_renderer_initiated) { |
+ is_renderer_initiated_ = is_renderer_initiated; |
+ } |
+ bool is_renderer_initiated() const { return is_renderer_initiated_; } |
private: |
int unique_id_; |
@@ -53,15 +83,27 @@ class NavigationItemImpl : public web::NavigationItem { |
GURL virtual_url_; |
base::string16 title_; |
int32 page_id_; |
+ PageScrollState page_scroll_state_; |
ui::PageTransition transition_type_; |
FaviconStatus favicon_; |
SSLStatus ssl_; |
base::Time timestamp_; |
+ // Whether the item, while loading, was created for a renderer-initiated |
+ // navigation. This dictates whether the URL should be displayed before the |
+ // navigation commits. It is cleared in |ResetForCommit| and not persisted. |
+ bool is_renderer_initiated_; |
+ |
+ // Whether the navigation contains unsafe resources. |
+ bool is_unsafe_; |
+ |
// This is a cached version of the result of GetTitleForDisplay. When the URL, |
// virtual URL, or title is set, this should be cleared to force a refresh. |
mutable base::string16 cached_display_title_; |
+ // Weak pointer to the facade delegate. |
+ scoped_ptr<NavigationItemFacadeDelegate> facade_delegate_; |
+ |
// Copy and assignment is explicitly allowed for this class. |
}; |