| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_UI_COCOA_INFOBARS_MOCK_LINK_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_INFOBARS_MOCK_ALTERNATE_NAV_INFOBAR_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_INFOBARS_MOCK_LINK_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_COCOA_INFOBARS_MOCK_ALTERNATE_NAV_INFOBAR_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| 11 #include "chrome/browser/api/infobars/link_infobar_delegate.h" | 11 #include "chrome/browser/alternate_nav_infobar_delegate.h" |
| 12 | 12 |
| 13 class MockLinkInfoBarDelegate : public LinkInfoBarDelegate { | 13 class MockAlternateNavInfoBarDelegate : public AlternateNavInfoBarDelegate { |
| 14 public: | 14 public: |
| 15 // Called when |this| is about to be destroyed. | 15 // Called when |this| is about to be destroyed. |
| 16 class Owner { | 16 class Owner { |
| 17 public: | 17 public: |
| 18 virtual void OnInfoBarDelegateClosed() = 0; | 18 virtual void OnInfoBarDelegateClosed() = 0; |
| 19 | 19 |
| 20 protected: | 20 protected: |
| 21 virtual ~Owner() {} | 21 virtual ~Owner() {} |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 explicit MockLinkInfoBarDelegate(Owner* owner); | 24 explicit MockAlternateNavInfoBarDelegate(Owner* owner); |
| 25 virtual ~MockLinkInfoBarDelegate(); | 25 virtual ~MockAlternateNavInfoBarDelegate(); |
| 26 | 26 |
| 27 void set_dont_close_on_action() { closes_on_action_ = false; } | 27 void set_dont_close_on_action() { closes_on_action_ = false; } |
| 28 bool icon_accessed() const { return icon_accessed_; } | 28 bool icon_accessed() const { return icon_accessed_; } |
| 29 bool message_text_accessed() const { return message_text_accessed_; } | 29 bool message_text_accessed() const { return message_text_accessed_; } |
| 30 bool link_text_accessed() const { return link_text_accessed_; } | 30 bool link_text_accessed() const { return link_text_accessed_; } |
| 31 bool link_clicked() const { return link_clicked_; } | 31 bool link_clicked() const { return link_clicked_; } |
| 32 | 32 |
| 33 static const char kMessage[]; | 33 static const char kMessage[]; |
| 34 static const char kLink[]; | 34 static const char kLink[]; |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 // LinkInfoBarDelegate: | 37 // AlternateNavInfoBarDelegate: |
| 38 virtual gfx::Image* GetIcon() const OVERRIDE; | 38 virtual gfx::Image* GetIcon() const OVERRIDE; |
| 39 virtual string16 GetMessageTextWithOffset(size_t* link_offset) const OVERRIDE; | 39 virtual string16 GetMessageTextWithOffset(size_t* link_offset) const OVERRIDE; |
| 40 virtual string16 GetLinkText() const OVERRIDE; | 40 virtual string16 GetLinkText() const OVERRIDE; |
| 41 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; | 41 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; |
| 42 | 42 |
| 43 Owner* owner_; | 43 Owner* owner_; |
| 44 // Determines whether the infobar closes when an action is taken or not. | 44 // Determines whether the infobar closes when an action is taken or not. |
| 45 bool closes_on_action_; | 45 bool closes_on_action_; |
| 46 mutable bool icon_accessed_; | 46 mutable bool icon_accessed_; |
| 47 mutable bool message_text_accessed_; | 47 mutable bool message_text_accessed_; |
| 48 mutable bool link_text_accessed_; | 48 mutable bool link_text_accessed_; |
| 49 bool link_clicked_; | 49 bool link_clicked_; |
| 50 | 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(MockLinkInfoBarDelegate); | 51 DISALLOW_COPY_AND_ASSIGN(MockAlternateNavInfoBarDelegate); |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 #endif // CHROME_BROWSER_UI_COCOA_INFOBARS_MOCK_LINK_INFOBAR_DELEGATE_H_ | 54 #endif // CHROME_BROWSER_UI_COCOA_INFOBARS_MOCK_ALTERNATE_NAV_INFOBAR_DELEGATE_
H_ |
| OLD | NEW |