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
15InfoBarDelegate::~InfoBarDelegate() {
16}
17
18bool InfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const {
19  return false;
20}
21
22bool 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
29void InfoBarDelegate::InfoBarDismissed() {
30}
31
32void InfoBarDelegate::InfoBarClosed() {
33}
34
35SkBitmap* InfoBarDelegate::GetIcon() const {
36  return NULL;
37}
38
39InfoBarDelegate::Type InfoBarDelegate::GetInfoBarType() const {
40  return WARNING_TYPE;
41}
42
43ConfirmInfoBarDelegate* InfoBarDelegate::AsConfirmInfoBarDelegate() {
44  return NULL;
45}
46
47ExtensionInfoBarDelegate* InfoBarDelegate::AsExtensionInfoBarDelegate() {
48  return NULL;
49}
50
51LinkInfoBarDelegate* InfoBarDelegate::AsLinkInfoBarDelegate() {
52  return NULL;
53}
54
55PluginInstallerInfoBarDelegate*
56    InfoBarDelegate::AsPluginInstallerInfoBarDelegate() {
57  return NULL;
58}
59
60ThemeInstalledInfoBarDelegate*
61    InfoBarDelegate::AsThemePreviewInfobarDelegate() {
62  return NULL;
63}
64
65TranslateInfoBarDelegate* InfoBarDelegate::AsTranslateInfoBarDelegate() {
66  return NULL;
67}
68
69InfoBarDelegate::InfoBarDelegate(TabContents* contents)
70    : contents_unique_id_(0) {
71  if (contents)
72    StoreActiveEntryUniqueID(contents);
73}
74
75void InfoBarDelegate::StoreActiveEntryUniqueID(TabContents* contents) {
76  NavigationEntry* active_entry = contents->controller().GetActiveEntry();
77  contents_unique_id_ = active_entry ? active_entry->unique_id() : 0;
78}
79