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