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 #include "chrome/browser/ui/cocoa/infobars/mock_link_infobar_delegate.h"
      6 
      7 #include "base/utf_string_conversions.h"
      8 #include "third_party/skia/include/core/SkBitmap.h"
      9 
     10 const char MockLinkInfoBarDelegate::kMessage[] = "MockLinkInfoBarMessage ";
     11 const char MockLinkInfoBarDelegate::kLink[] = "http://dev.chromium.org";
     12 
     13 MockLinkInfoBarDelegate::MockLinkInfoBarDelegate()
     14     : LinkInfoBarDelegate(NULL),
     15       closes_on_action_(true),
     16       icon_accessed_(false),
     17       message_text_accessed_(false),
     18       link_text_accessed_(false),
     19       link_clicked_(false),
     20       closed_(false) {
     21 }
     22 
     23 MockLinkInfoBarDelegate::~MockLinkInfoBarDelegate() {
     24 }
     25 
     26 void MockLinkInfoBarDelegate::InfoBarClosed() {
     27   closed_ = true;
     28 }
     29 
     30 SkBitmap* MockLinkInfoBarDelegate::GetIcon() const {
     31   icon_accessed_ = true;
     32   return NULL;
     33 }
     34 
     35 string16 MockLinkInfoBarDelegate::GetMessageTextWithOffset(
     36     size_t* link_offset) const {
     37   message_text_accessed_ = true;
     38   *link_offset = arraysize(kMessage) - 1;
     39   return ASCIIToUTF16(kMessage);
     40 }
     41 
     42 string16 MockLinkInfoBarDelegate::GetLinkText() const {
     43   link_text_accessed_ = true;
     44   return ASCIIToUTF16(kLink);
     45 }
     46 
     47 bool MockLinkInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) {
     48   link_clicked_ = true;
     49   return closes_on_action_;
     50 }
     51