OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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 | |
9 const char MockLinkInfoBarDelegate::kMessage[] = "MockLinkInfoBarMessage "; | |
10 const char MockLinkInfoBarDelegate::kLink[] = "http://dev.chromium.org"; | |
11 | |
12 MockLinkInfoBarDelegate::MockLinkInfoBarDelegate(Owner* owner) | |
13 : LinkInfoBarDelegate(NULL), | |
14 owner_(owner), | |
15 closes_on_action_(true), | |
16 icon_accessed_(false), | |
17 message_text_accessed_(false), | |
18 link_text_accessed_(false), | |
19 link_clicked_(false) { | |
20 } | |
21 | |
22 MockLinkInfoBarDelegate::~MockLinkInfoBarDelegate() { | |
23 if (owner_) | |
24 owner_->OnInfoBarDelegateClosed(); | |
25 } | |
26 | |
27 gfx::Image* MockLinkInfoBarDelegate::GetIcon() const { | |
28 icon_accessed_ = true; | |
29 return NULL; | |
30 } | |
31 | |
32 string16 MockLinkInfoBarDelegate::GetMessageTextWithOffset( | |
33 size_t* link_offset) const { | |
34 message_text_accessed_ = true; | |
35 *link_offset = arraysize(kMessage) - 1; | |
36 return ASCIIToUTF16(kMessage); | |
37 } | |
38 | |
39 string16 MockLinkInfoBarDelegate::GetLinkText() const { | |
40 link_text_accessed_ = true; | |
41 return ASCIIToUTF16(kLink); | |
42 } | |
43 | |
44 bool MockLinkInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { | |
45 link_clicked_ = true; | |
46 return closes_on_action_; | |
47 } | |
OLD | NEW |