Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: chrome/browser/ui/cocoa/infobars/mock_confirm_infobar_delegate.h

Issue 6926001: Replace the virtual InfoBarDelegate::InfoBarClosed() function with a non-virtual one. This is a ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_CONFIRM_INFOBAR_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_INFOBARS_MOCK_CONFIRM_INFOBAR_DELEGATE_H_
6 #define CHROME_BROWSER_UI_COCOA_INFOBARS_MOCK_CONFIRM_INFOBAR_DELEGATE_H_ 6 #define CHROME_BROWSER_UI_COCOA_INFOBARS_MOCK_CONFIRM_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/confirm_infobar_delegate.h" 12 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
13 13
14 class SkBitmap; 14 class SkBitmap;
15 15
16 class MockConfirmInfoBarDelegate : public ConfirmInfoBarDelegate { 16 class MockConfirmInfoBarDelegate : public ConfirmInfoBarDelegate {
17 public: 17 public:
18 MockConfirmInfoBarDelegate(); 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 MockConfirmInfoBarDelegate(Owner* owner);
19 virtual ~MockConfirmInfoBarDelegate(); 28 virtual ~MockConfirmInfoBarDelegate();
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 ok_clicked() const { return ok_clicked_; } 34 bool ok_clicked() const { return ok_clicked_; }
26 bool cancel_clicked() const { return cancel_clicked_; } 35 bool cancel_clicked() const { return cancel_clicked_; }
27 bool link_clicked() const { return link_clicked_; } 36 bool link_clicked() const { return link_clicked_; }
28 bool closed() const { return closed_; }
29 37
30 static const char kMessage[]; 38 static const char kMessage[];
31 39
32 private: 40 private:
33 // ConfirmInfoBarDelegate: 41 // ConfirmInfoBarDelegate:
34 virtual void InfoBarClosed() OVERRIDE;
35 virtual gfx::Image* GetIcon() const OVERRIDE; 42 virtual gfx::Image* GetIcon() const OVERRIDE;
36 virtual string16 GetMessageText() const OVERRIDE; 43 virtual string16 GetMessageText() const OVERRIDE;
37 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; 44 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
38 virtual bool Accept() OVERRIDE; 45 virtual bool Accept() OVERRIDE;
39 virtual bool Cancel() OVERRIDE; 46 virtual bool Cancel() OVERRIDE;
40 virtual string16 GetLinkText() OVERRIDE; 47 virtual string16 GetLinkText() OVERRIDE;
41 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; 48 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE;
42 49
50 Owner* owner_;
43 // Determines whether the infobar closes when an action is taken or not. 51 // Determines whether the infobar closes when an action is taken or not.
44 bool closes_on_action_; 52 bool closes_on_action_;
45 mutable bool icon_accessed_; 53 mutable bool icon_accessed_;
46 mutable bool message_text_accessed_; 54 mutable bool message_text_accessed_;
47 mutable bool link_text_accessed_; 55 mutable bool link_text_accessed_;
48 bool ok_clicked_; 56 bool ok_clicked_;
49 bool cancel_clicked_; 57 bool cancel_clicked_;
50 bool link_clicked_; 58 bool link_clicked_;
51 bool closed_;
52 59
53 DISALLOW_COPY_AND_ASSIGN(MockConfirmInfoBarDelegate); 60 DISALLOW_COPY_AND_ASSIGN(MockConfirmInfoBarDelegate);
54 }; 61 };
55 62
56 #endif // CHROME_BROWSER_UI_COCOA_INFOBARS_MOCK_CONFIRM_INFOBAR_DELEGATE_H_ 63 #endif // CHROME_BROWSER_UI_COCOA_INFOBARS_MOCK_CONFIRM_INFOBAR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698