| 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/tab_contents/infobar_delegate.h" | 5 #include "chrome/browser/tab_contents/infobar_delegate.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "chrome/browser/tab_contents/navigation_entry.h" | 9 #include "chrome/browser/tab_contents/navigation_entry.h" |
| 10 #include "chrome/browser/tab_contents/navigation_controller.h" | 10 #include "chrome/browser/tab_contents/navigation_controller.h" |
| 11 #include "chrome/browser/tab_contents/tab_contents.h" | 11 #include "chrome/browser/tab_contents/tab_contents.h" |
| 12 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
| 13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
| 14 | 14 |
| 15 // InfoBarDelegate ------------------------------------------------------------ | |
| 16 | |
| 17 InfoBarDelegate::~InfoBarDelegate() { | |
| 18 } | |
| 19 | |
| 20 bool InfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const { | |
| 21 return false; | |
| 22 } | |
| 23 | |
| 24 bool InfoBarDelegate::ShouldExpire( | |
| 25 const NavigationController::LoadCommittedDetails& details) const { | |
| 26 return (contents_unique_id_ != details.entry->unique_id()) || | |
| 27 (PageTransition::StripQualifier(details.entry->transition_type()) == | |
| 28 PageTransition::RELOAD); | |
| 29 } | |
| 30 | |
| 31 void InfoBarDelegate::InfoBarDismissed() { | |
| 32 } | |
| 33 | |
| 34 void InfoBarDelegate::InfoBarClosed() { | |
| 35 } | |
| 36 | |
| 37 SkBitmap* InfoBarDelegate::GetIcon() const { | |
| 38 return NULL; | |
| 39 } | |
| 40 | |
| 41 InfoBarDelegate::Type InfoBarDelegate::GetInfoBarType() const { | |
| 42 return WARNING_TYPE; | |
| 43 } | |
| 44 | |
| 45 ConfirmInfoBarDelegate* InfoBarDelegate::AsConfirmInfoBarDelegate() { | |
| 46 return NULL; | |
| 47 } | |
| 48 | |
| 49 CrashedExtensionInfoBarDelegate* | |
| 50 InfoBarDelegate::AsCrashedExtensionInfoBarDelegate() { | |
| 51 return NULL; | |
| 52 } | |
| 53 | |
| 54 ExtensionInfoBarDelegate* InfoBarDelegate::AsExtensionInfoBarDelegate() { | |
| 55 return NULL; | |
| 56 } | |
| 57 | |
| 58 LinkInfoBarDelegate* InfoBarDelegate::AsLinkInfoBarDelegate() { | |
| 59 return NULL; | |
| 60 } | |
| 61 | |
| 62 PluginInstallerInfoBarDelegate* | |
| 63 InfoBarDelegate::AsPluginInstallerInfoBarDelegate() { | |
| 64 return NULL; | |
| 65 } | |
| 66 | |
| 67 ThemeInstalledInfoBarDelegate* | |
| 68 InfoBarDelegate::AsThemePreviewInfobarDelegate() { | |
| 69 return NULL; | |
| 70 } | |
| 71 | |
| 72 TranslateInfoBarDelegate* InfoBarDelegate::AsTranslateInfoBarDelegate() { | |
| 73 return NULL; | |
| 74 } | |
| 75 | |
| 76 InfoBarDelegate::InfoBarDelegate(TabContents* contents) | |
| 77 : contents_unique_id_(0) { | |
| 78 if (contents) | |
| 79 StoreActiveEntryUniqueID(contents); | |
| 80 } | |
| 81 | |
| 82 void InfoBarDelegate::StoreActiveEntryUniqueID(TabContents* contents) { | |
| 83 NavigationEntry* active_entry = contents->controller().GetActiveEntry(); | |
| 84 contents_unique_id_ = active_entry ? active_entry->unique_id() : 0; | |
| 85 } | |
| 86 | |
| 87 | |
| 88 // LinkInfoBarDelegate -------------------------------------------------------- | 15 // LinkInfoBarDelegate -------------------------------------------------------- |
| 89 | 16 |
| 90 string16 LinkInfoBarDelegate::GetMessageTextWithOffset( | 17 string16 LinkInfoBarDelegate::GetMessageTextWithOffset( |
| 91 size_t* link_offset) const { | 18 size_t* link_offset) const { |
| 92 *link_offset = string16::npos; | 19 *link_offset = string16::npos; |
| 93 return string16(); | 20 return string16(); |
| 94 } | 21 } |
| 95 | 22 |
| 96 bool LinkInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { | 23 bool LinkInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { |
| 97 return true; | 24 return true; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 return icon_; | 114 return icon_; |
| 188 } | 115 } |
| 189 | 116 |
| 190 string16 SimpleAlertInfoBarDelegate::GetMessageText() const { | 117 string16 SimpleAlertInfoBarDelegate::GetMessageText() const { |
| 191 return message_; | 118 return message_; |
| 192 } | 119 } |
| 193 | 120 |
| 194 int SimpleAlertInfoBarDelegate::GetButtons() const { | 121 int SimpleAlertInfoBarDelegate::GetButtons() const { |
| 195 return BUTTON_NONE; | 122 return BUTTON_NONE; |
| 196 } | 123 } |
| OLD | NEW |