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#include "chrome/browser/ui/cocoa/infobars/mock_confirm_infobar_delegate.h" 6 7#include "base/utf_string_conversions.h" 8#include "third_party/skia/include/core/SkBitmap.h" 9 10const char MockConfirmInfoBarDelegate::kMessage[] = "MockConfirmInfoBarMessage"; 11 12MockConfirmInfoBarDelegate::MockConfirmInfoBarDelegate() 13 : ConfirmInfoBarDelegate(NULL), 14 closes_on_action_(true), 15 icon_accessed_(false), 16 message_text_accessed_(false), 17 link_text_accessed_(false), 18 ok_clicked_(false), 19 cancel_clicked_(false), 20 link_clicked_(false), 21 closed_(false) { 22} 23 24MockConfirmInfoBarDelegate::~MockConfirmInfoBarDelegate() { 25} 26 27void MockConfirmInfoBarDelegate::InfoBarClosed() { 28 closed_ = true; 29} 30 31SkBitmap* MockConfirmInfoBarDelegate::GetIcon() const { 32 icon_accessed_ = true; 33 return NULL; 34} 35 36string16 MockConfirmInfoBarDelegate::GetMessageText() const { 37 message_text_accessed_ = true; 38 return ASCIIToUTF16(kMessage); 39} 40 41string16 MockConfirmInfoBarDelegate::GetButtonLabel( 42 InfoBarButton button) const { 43 return ASCIIToUTF16((button == BUTTON_OK) ? "OK" : "Cancel"); 44} 45 46bool MockConfirmInfoBarDelegate::Accept() { 47 ok_clicked_ = true; 48 return closes_on_action_; 49} 50 51bool MockConfirmInfoBarDelegate::Cancel() { 52 cancel_clicked_ = true; 53 return closes_on_action_; 54} 55 56string16 MockConfirmInfoBarDelegate::GetLinkText() { 57 link_text_accessed_ = true; 58 return string16(); 59} 60 61bool MockConfirmInfoBarDelegate::LinkClicked( 62 WindowOpenDisposition disposition) { 63 link_clicked_ = true; 64 return closes_on_action_; 65} 66