Home | History | Annotate | Download | only in infobars
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef 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
      8 
      9 #include "base/basictypes.h"
     10 #include "base/compiler_specific.h"
     11 #include "base/string16.h"
     12 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
     13 
     14 class SkBitmap;
     15 
     16 class MockConfirmInfoBarDelegate : public ConfirmInfoBarDelegate {
     17  public:
     18   MockConfirmInfoBarDelegate();
     19   virtual ~MockConfirmInfoBarDelegate();
     20 
     21   void set_dont_close_on_action() { closes_on_action_ = false; }
     22   bool icon_accessed() const { return icon_accessed_; }
     23   bool message_text_accessed() const { return message_text_accessed_; }
     24   bool link_text_accessed() const { return link_text_accessed_; }
     25   bool ok_clicked() const { return ok_clicked_; }
     26   bool cancel_clicked() const { return cancel_clicked_; }
     27   bool link_clicked() const { return link_clicked_; }
     28   bool closed() const { return closed_; }
     29 
     30   static const char kMessage[];
     31 
     32  private:
     33   // ConfirmInfoBarDelegate:
     34   virtual void InfoBarClosed() OVERRIDE;
     35   virtual SkBitmap* GetIcon() const OVERRIDE;
     36   virtual string16 GetMessageText() const OVERRIDE;
     37   virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
     38   virtual bool Accept() OVERRIDE;
     39   virtual bool Cancel() OVERRIDE;
     40   virtual string16 GetLinkText() OVERRIDE;
     41   virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE;
     42 
     43   // Determines whether the infobar closes when an action is taken or not.
     44   bool closes_on_action_;
     45   mutable bool icon_accessed_;
     46   mutable bool message_text_accessed_;
     47   mutable bool link_text_accessed_;
     48   bool ok_clicked_;
     49   bool cancel_clicked_;
     50   bool link_clicked_;
     51   bool closed_;
     52 
     53   DISALLOW_COPY_AND_ASSIGN(MockConfirmInfoBarDelegate);
     54 };
     55 
     56 #endif  // CHROME_BROWSER_UI_COCOA_INFOBARS_MOCK_CONFIRM_INFOBAR_DELEGATE_H_
     57