| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/tab_contents/infobar_delegate.h" | 5 #include "chrome/browser/tab_contents/infobar_delegate.h" |
| 6 | 6 |
| 7 namespace { | 7 namespace { |
| 8 const wchar_t* kMockAlertInfoBarMessage = L"MockAlertInfoBarMessage"; | 8 const wchar_t* kMockAlertInfoBarMessage = L"MockAlertInfoBarMessage"; |
| 9 const wchar_t* kMockLinkInfoBarMessage = L"MockLinkInfoBarMessage"; | 9 const wchar_t* kMockLinkInfoBarMessage = L"MockLinkInfoBarMessage"; |
| 10 const wchar_t* kMockLinkInfoBarLink = L"http://dev.chromium.org"; | 10 const wchar_t* kMockLinkInfoBarLink = L"http://dev.chromium.org"; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 class MockConfirmInfoBarDelegate : public ConfirmInfoBarDelegate { | 94 class MockConfirmInfoBarDelegate : public ConfirmInfoBarDelegate { |
| 95 public: | 95 public: |
| 96 explicit MockConfirmInfoBarDelegate() | 96 explicit MockConfirmInfoBarDelegate() |
| 97 : ConfirmInfoBarDelegate(NULL), | 97 : ConfirmInfoBarDelegate(NULL), |
| 98 message_text_accessed(false), | 98 message_text_accessed(false), |
| 99 link_text_accessed(false), | 99 link_text_accessed(false), |
| 100 icon_accessed(false), | 100 icon_accessed(false), |
| 101 ok_clicked(false), | 101 ok_clicked(false), |
| 102 cancel_clicked(false), | 102 cancel_clicked(false), |
| 103 link_clicked(false), |
| 103 closed(false), | 104 closed(false), |
| 104 closes_on_action(true) { | 105 closes_on_action(true) { |
| 105 } | 106 } |
| 106 | 107 |
| 107 virtual int GetButtons() const { | 108 virtual int GetButtons() const { |
| 108 return (BUTTON_OK | BUTTON_CANCEL); | 109 return (BUTTON_OK | BUTTON_CANCEL); |
| 109 } | 110 } |
| 110 | 111 |
| 111 virtual std::wstring GetButtonLabel(InfoBarButton button) const { | 112 virtual std::wstring GetButtonLabel(InfoBarButton button) const { |
| 112 if (button == BUTTON_OK) | 113 if (button == BUTTON_OK) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 132 | 133 |
| 133 virtual SkBitmap* GetIcon() const { | 134 virtual SkBitmap* GetIcon() const { |
| 134 icon_accessed = true; | 135 icon_accessed = true; |
| 135 return NULL; | 136 return NULL; |
| 136 } | 137 } |
| 137 | 138 |
| 138 virtual void InfoBarClosed() { | 139 virtual void InfoBarClosed() { |
| 139 closed = true; | 140 closed = true; |
| 140 } | 141 } |
| 141 | 142 |
| 143 virtual std::wstring GetLinkText() { |
| 144 link_text_accessed = true; |
| 145 return std::wstring(); |
| 146 } |
| 147 |
| 148 virtual bool LinkClicked(WindowOpenDisposition disposition) { |
| 149 link_clicked = true; |
| 150 return closes_on_action; |
| 151 } |
| 152 |
| 142 // These are declared mutable to get around const-ness issues. | 153 // These are declared mutable to get around const-ness issues. |
| 143 mutable bool message_text_accessed; | 154 mutable bool message_text_accessed; |
| 144 mutable bool link_text_accessed; | 155 mutable bool link_text_accessed; |
| 145 mutable bool icon_accessed; | 156 mutable bool icon_accessed; |
| 146 bool ok_clicked; | 157 bool ok_clicked; |
| 147 bool cancel_clicked; | 158 bool cancel_clicked; |
| 159 bool link_clicked; |
| 148 bool closed; | 160 bool closed; |
| 149 | 161 |
| 150 // Determines whether the infobar closes when an action is taken or not. | 162 // Determines whether the infobar closes when an action is taken or not. |
| 151 bool closes_on_action; | 163 bool closes_on_action; |
| 152 }; | 164 }; |
| OLD | NEW |