OLD | NEW |
(Empty) | |
| 1 // Copyright 2012 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 #ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_DELEGATE_IOS_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_DELEGATE_IOS_H_ |
| 7 |
| 8 #include "base/mac/scoped_nsobject.h" |
| 9 #include "base/macros.h" |
| 10 #include "components/toolbar/toolbar_model_delegate.h" |
| 11 |
| 12 @class Tab; |
| 13 @class TabModel; |
| 14 |
| 15 namespace web { |
| 16 class NavigationItem; |
| 17 } |
| 18 |
| 19 // Implementation of ToolbarModelDelegate which uses an instance of |
| 20 // TabModel in order to fulfil its duties. |
| 21 class ToolbarModelDelegateIOS : public ToolbarModelDelegate { |
| 22 public: |
| 23 explicit ToolbarModelDelegateIOS(TabModel* tab_model); |
| 24 ~ToolbarModelDelegateIOS() override; |
| 25 |
| 26 // Sets the |tab_model_| with provided values. |
| 27 void SetTabModel(TabModel* tab_model); |
| 28 |
| 29 // Returns the current tab. |
| 30 Tab* GetCurrentTab() const; |
| 31 |
| 32 private: |
| 33 // Helper method to extract the NavigationItem from which the states are |
| 34 // retrieved. If this returns null (which can happens during initialization), |
| 35 // default values are used. |
| 36 web::NavigationItem* GetNavigationItem() const; |
| 37 |
| 38 // ToolbarModelDelegate implementation: |
| 39 base::string16 FormattedStringWithEquivalentMeaning( |
| 40 const GURL& url, |
| 41 const base::string16& formatted_url) const override; |
| 42 bool GetURL(GURL* url) const override; |
| 43 bool ShouldDisplayURL() const override; |
| 44 SecurityLevel GetSecurityLevel() const override; |
| 45 scoped_refptr<net::X509Certificate> GetCertificate() const override; |
| 46 bool FailsMalwareCheck() const override; |
| 47 |
| 48 base::scoped_nsobject<TabModel> tab_model_; |
| 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(ToolbarModelDelegateIOS); |
| 51 }; |
| 52 |
| 53 #endif // IOS_CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_DELEGATE_IOS_H_ |
OLD | NEW |