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