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/tab_contents/infobar_delegate.h" 6 7 #include "base/logging.h" 8 #include "build/build_config.h" 9 #include "content/browser/tab_contents/navigation_controller.h" 10 #include "content/browser/tab_contents/navigation_entry.h" 11 #include "content/browser/tab_contents/tab_contents.h" 12 13 // InfoBarDelegate ------------------------------------------------------------ 14 15 InfoBarDelegate::~InfoBarDelegate() { 16 } 17 18 bool InfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const { 19 return false; 20 } 21 22 bool InfoBarDelegate::ShouldExpire( 23 const NavigationController::LoadCommittedDetails& details) const { 24 return (contents_unique_id_ != details.entry->unique_id()) || 25 (PageTransition::StripQualifier(details.entry->transition_type()) == 26 PageTransition::RELOAD); 27 } 28 29 void InfoBarDelegate::InfoBarDismissed() { 30 } 31 32 void InfoBarDelegate::InfoBarClosed() { 33 } 34 35 SkBitmap* InfoBarDelegate::GetIcon() const { 36 return NULL; 37 } 38 39 InfoBarDelegate::Type InfoBarDelegate::GetInfoBarType() const { 40 return WARNING_TYPE; 41 } 42 43 ConfirmInfoBarDelegate* InfoBarDelegate::AsConfirmInfoBarDelegate() { 44 return NULL; 45 } 46 47 ExtensionInfoBarDelegate* InfoBarDelegate::AsExtensionInfoBarDelegate() { 48 return NULL; 49 } 50 51 LinkInfoBarDelegate* InfoBarDelegate::AsLinkInfoBarDelegate() { 52 return NULL; 53 } 54 55 PluginInstallerInfoBarDelegate* 56 InfoBarDelegate::AsPluginInstallerInfoBarDelegate() { 57 return NULL; 58 } 59 60 ThemeInstalledInfoBarDelegate* 61 InfoBarDelegate::AsThemePreviewInfobarDelegate() { 62 return NULL; 63 } 64 65 TranslateInfoBarDelegate* InfoBarDelegate::AsTranslateInfoBarDelegate() { 66 return NULL; 67 } 68 69 InfoBarDelegate::InfoBarDelegate(TabContents* contents) 70 : contents_unique_id_(0) { 71 if (contents) 72 StoreActiveEntryUniqueID(contents); 73 } 74 75 void InfoBarDelegate::StoreActiveEntryUniqueID(TabContents* contents) { 76 NavigationEntry* active_entry = contents->controller().GetActiveEntry(); 77 contents_unique_id_ = active_entry ? active_entry->unique_id() : 0; 78 } 79