19258b6bc66e09368ada54001f619d53b4fc976d5ager@chromium.org// Copyright (c) 2012 The Chromium Authors. All rights reserved.
29a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// Use of this source code is governed by a BSD-style license that can be
39a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// found in the LICENSE file.
49a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com
59a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com#include "chrome/browser/ui/collected_cookies_infobar_delegate.h"
69a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com
79a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com#include "base/logging.h"
89a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com#include "chrome/browser/infobars/infobar_service.h"
99a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com#include "chrome/grit/generated_resources.h"
109a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com#include "components/infobars/core/infobar.h"
119a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com#include "content/public/browser/web_contents.h"
129a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com#include "grit/theme_resources.h"
139a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com#include "ui/base/l10n/l10n_util.h"
149a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com
159a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com
169a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// static
179a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comvoid CollectedCookiesInfoBarDelegate::Create(InfoBarService* infobar_service) {
189a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com  infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar(
199a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com      scoped_ptr<ConfirmInfoBarDelegate>(
209a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com          new CollectedCookiesInfoBarDelegate())));
219a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com}
229a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com
239a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comCollectedCookiesInfoBarDelegate::CollectedCookiesInfoBarDelegate()
249a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com    : ConfirmInfoBarDelegate() {
259a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com}
269a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com
279a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comCollectedCookiesInfoBarDelegate::~CollectedCookiesInfoBarDelegate() {
289a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com}
299a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com
309a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comint CollectedCookiesInfoBarDelegate::GetIconID() const {
319a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com  return IDR_INFOBAR_COOKIE;
329a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com}
339a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com
349a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.cominfobars::InfoBarDelegate::Type
359a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comCollectedCookiesInfoBarDelegate::GetInfoBarType() const {
369a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com  return PAGE_ACTION_TYPE;
379a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com}
389a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com
399a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.combase::string16 CollectedCookiesInfoBarDelegate::GetMessageText() const {
409a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com  return l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_INFOBAR_MESSAGE);
419a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com}
429a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com
439a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comint CollectedCookiesInfoBarDelegate::GetButtons() const {
449a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com  return BUTTON_OK;
459a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com}
469a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com
479a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.combase::string16 CollectedCookiesInfoBarDelegate::GetButtonLabel(
489a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com    InfoBarButton button) const {
499a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com  DCHECK_EQ(BUTTON_OK, button);
509a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com  return l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_INFOBAR_BUTTON);
519a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com}
529a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com
539a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.combool CollectedCookiesInfoBarDelegate::Accept() {
549a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com  content::WebContents* web_contents =
559a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com      InfoBarService::WebContentsFromInfoBar(infobar());
569a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com  web_contents->GetController().Reload(true);
579a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com  return true;
58a55512615f5adc085d23bc8589d155c4b579fb7bkasperl@chromium.org}
599a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com