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/ui/collected_cookies_infobar_delegate.h"
6
7#include "base/logging.h"
8#include "content/browser/tab_contents/tab_contents.h"
9#include "grit/generated_resources.h"
10#include "grit/theme_resources.h"
11#include "ui/base/l10n/l10n_util.h"
12#include "ui/base/resource/resource_bundle.h"
13
14CollectedCookiesInfoBarDelegate::CollectedCookiesInfoBarDelegate(
15    TabContents* tab_contents)
16    : ConfirmInfoBarDelegate(tab_contents),
17      tab_contents_(tab_contents) {
18}
19
20SkBitmap* CollectedCookiesInfoBarDelegate::GetIcon() const {
21  return ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_INFOBAR_COOKIE);
22}
23
24InfoBarDelegate::Type CollectedCookiesInfoBarDelegate::GetInfoBarType() const {
25  return PAGE_ACTION_TYPE;
26}
27
28string16 CollectedCookiesInfoBarDelegate::GetMessageText() const {
29  return l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_INFOBAR_MESSAGE);
30}
31
32int CollectedCookiesInfoBarDelegate::GetButtons() const {
33  return BUTTON_OK;
34}
35
36string16 CollectedCookiesInfoBarDelegate::GetButtonLabel(InfoBarButton button)
37    const {
38  DCHECK_EQ(BUTTON_OK, button);
39  return l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_INFOBAR_BUTTON);
40}
41
42bool CollectedCookiesInfoBarDelegate::Accept() {
43  tab_contents_->controller().Reload(true);
44  return true;
45}
46