| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef IOS_WEB_NAVIGATION_NAVIGATION_ITEM_IMPL_H_ | 5 #ifndef IOS_WEB_NAVIGATION_NAVIGATION_ITEM_IMPL_H_ |
| 6 #define IOS_WEB_NAVIGATION_NAVIGATION_ITEM_IMPL_H_ | 6 #define IOS_WEB_NAVIGATION_NAVIGATION_ITEM_IMPL_H_ |
| 7 | 7 |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 | 9 |
| 10 #include <memory> |
| 11 |
| 10 #include "base/mac/scoped_nsobject.h" | 12 #include "base/mac/scoped_nsobject.h" |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 13 #include "ios/web/navigation/navigation_item_facade_delegate.h" | 14 #include "ios/web/navigation/navigation_item_facade_delegate.h" |
| 14 #include "ios/web/public/favicon_status.h" | 15 #include "ios/web/public/favicon_status.h" |
| 15 #include "ios/web/public/navigation_item.h" | 16 #include "ios/web/public/navigation_item.h" |
| 16 #include "ios/web/public/referrer.h" | 17 #include "ios/web/public/referrer.h" |
| 17 #include "ios/web/public/ssl_status.h" | 18 #include "ios/web/public/ssl_status.h" |
| 18 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 19 | 20 |
| 20 namespace web { | 21 namespace web { |
| 21 | 22 |
| 22 class NavigationItemFacadeDelegate; | 23 class NavigationItemFacadeDelegate; |
| 23 | 24 |
| 24 // Implementation of NavigationItem. | 25 // Implementation of NavigationItem. |
| 25 class NavigationItemImpl : public web::NavigationItem { | 26 class NavigationItemImpl : public web::NavigationItem { |
| 26 public: | 27 public: |
| 27 // Creates a default NavigationItemImpl. | 28 // Creates a default NavigationItemImpl. |
| 28 NavigationItemImpl(); | 29 NavigationItemImpl(); |
| 29 ~NavigationItemImpl() override; | 30 ~NavigationItemImpl() override; |
| 30 | 31 |
| 31 // Since NavigationItemImpls own their facade delegates, there is no implicit | 32 // Since NavigationItemImpls own their facade delegates, there is no implicit |
| 32 // copy constructor (scoped_ptrs can't be copied), so one is defined here. | 33 // copy constructor (scoped_ptrs can't be copied), so one is defined here. |
| 33 NavigationItemImpl(const NavigationItemImpl& item); | 34 NavigationItemImpl(const NavigationItemImpl& item); |
| 34 | 35 |
| 35 // Accessors for the delegate used to drive the navigation entry facade. | 36 // Accessors for the delegate used to drive the navigation entry facade. |
| 36 // NOTE: to minimize facade synchronization code, NavigationItems take | 37 // NOTE: to minimize facade synchronization code, NavigationItems take |
| 37 // ownership of their facade delegates. | 38 // ownership of their facade delegates. |
| 38 void SetFacadeDelegate( | 39 void SetFacadeDelegate( |
| 39 scoped_ptr<NavigationItemFacadeDelegate> facade_delegate); | 40 std::unique_ptr<NavigationItemFacadeDelegate> facade_delegate); |
| 40 NavigationItemFacadeDelegate* GetFacadeDelegate() const; | 41 NavigationItemFacadeDelegate* GetFacadeDelegate() const; |
| 41 | 42 |
| 42 // NavigationItem implementation: | 43 // NavigationItem implementation: |
| 43 int GetUniqueID() const override; | 44 int GetUniqueID() const override; |
| 44 void SetURL(const GURL& url) override; | 45 void SetURL(const GURL& url) override; |
| 45 const GURL& GetURL() const override; | 46 const GURL& GetURL() const override; |
| 46 void SetReferrer(const web::Referrer& referrer) override; | 47 void SetReferrer(const web::Referrer& referrer) override; |
| 47 const web::Referrer& GetReferrer() const override; | 48 const web::Referrer& GetReferrer() const override; |
| 48 void SetVirtualURL(const GURL& url) override; | 49 void SetVirtualURL(const GURL& url) override; |
| 49 const GURL& GetVirtualURL() const override; | 50 const GURL& GetVirtualURL() const override; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 bool is_renderer_initiated_; | 132 bool is_renderer_initiated_; |
| 132 | 133 |
| 133 // Whether the navigation contains unsafe resources. | 134 // Whether the navigation contains unsafe resources. |
| 134 bool is_unsafe_; | 135 bool is_unsafe_; |
| 135 | 136 |
| 136 // This is a cached version of the result of GetTitleForDisplay. When the URL, | 137 // This is a cached version of the result of GetTitleForDisplay. When the URL, |
| 137 // virtual URL, or title is set, this should be cleared to force a refresh. | 138 // virtual URL, or title is set, this should be cleared to force a refresh. |
| 138 mutable base::string16 cached_display_title_; | 139 mutable base::string16 cached_display_title_; |
| 139 | 140 |
| 140 // Weak pointer to the facade delegate. | 141 // Weak pointer to the facade delegate. |
| 141 scoped_ptr<NavigationItemFacadeDelegate> facade_delegate_; | 142 std::unique_ptr<NavigationItemFacadeDelegate> facade_delegate_; |
| 142 | 143 |
| 143 // Copy and assignment is explicitly allowed for this class. | 144 // Copy and assignment is explicitly allowed for this class. |
| 144 }; | 145 }; |
| 145 | 146 |
| 146 } // namespace web | 147 } // namespace web |
| 147 | 148 |
| 148 #endif // IOS_WEB_NAVIGATION_NAVIGATION_ITEM_IMPL_H_ | 149 #endif // IOS_WEB_NAVIGATION_NAVIGATION_ITEM_IMPL_H_ |
| OLD | NEW |