| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/collected_cookies_infobar_delegate.h" | 5 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/infobars/infobar_service.h" | 8 #include "chrome/browser/infobars/infobar_service.h" |
| 9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
| 10 #include "grit/generated_resources.h" | 10 #include "grit/generated_resources.h" |
| 11 #include "grit/theme_resources.h" | 11 #include "grit/theme_resources.h" |
| 12 #include "ui/base/l10n/l10n_util.h" | 12 #include "ui/base/l10n/l10n_util.h" |
| 13 #include "ui/base/resource/resource_bundle.h" | |
| 14 | 13 |
| 15 // static | 14 // static |
| 16 void CollectedCookiesInfoBarDelegate::Create(InfoBarService* infobar_service) { | 15 void CollectedCookiesInfoBarDelegate::Create(InfoBarService* infobar_service) { |
| 17 infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>( | 16 infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>( |
| 18 new CollectedCookiesInfoBarDelegate(infobar_service))); | 17 new CollectedCookiesInfoBarDelegate(infobar_service))); |
| 19 } | 18 } |
| 20 | 19 |
| 21 CollectedCookiesInfoBarDelegate::CollectedCookiesInfoBarDelegate( | 20 CollectedCookiesInfoBarDelegate::CollectedCookiesInfoBarDelegate( |
| 22 InfoBarService* infobar_service) | 21 InfoBarService* infobar_service) |
| 23 : ConfirmInfoBarDelegate(infobar_service) { | 22 : ConfirmInfoBarDelegate(infobar_service) { |
| 24 } | 23 } |
| 25 | 24 |
| 26 gfx::Image* CollectedCookiesInfoBarDelegate::GetIcon() const { | 25 int CollectedCookiesInfoBarDelegate::GetIconID() const { |
| 27 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 26 return IDR_INFOBAR_COOKIE; |
| 28 IDR_INFOBAR_COOKIE); | |
| 29 } | 27 } |
| 30 | 28 |
| 31 InfoBarDelegate::Type CollectedCookiesInfoBarDelegate::GetInfoBarType() const { | 29 InfoBarDelegate::Type CollectedCookiesInfoBarDelegate::GetInfoBarType() const { |
| 32 return PAGE_ACTION_TYPE; | 30 return PAGE_ACTION_TYPE; |
| 33 } | 31 } |
| 34 | 32 |
| 35 string16 CollectedCookiesInfoBarDelegate::GetMessageText() const { | 33 string16 CollectedCookiesInfoBarDelegate::GetMessageText() const { |
| 36 return l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_INFOBAR_MESSAGE); | 34 return l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_INFOBAR_MESSAGE); |
| 37 } | 35 } |
| 38 | 36 |
| 39 int CollectedCookiesInfoBarDelegate::GetButtons() const { | 37 int CollectedCookiesInfoBarDelegate::GetButtons() const { |
| 40 return BUTTON_OK; | 38 return BUTTON_OK; |
| 41 } | 39 } |
| 42 | 40 |
| 43 string16 CollectedCookiesInfoBarDelegate::GetButtonLabel( | 41 string16 CollectedCookiesInfoBarDelegate::GetButtonLabel( |
| 44 InfoBarButton button) const { | 42 InfoBarButton button) const { |
| 45 DCHECK_EQ(BUTTON_OK, button); | 43 DCHECK_EQ(BUTTON_OK, button); |
| 46 return l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_INFOBAR_BUTTON); | 44 return l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_INFOBAR_BUTTON); |
| 47 } | 45 } |
| 48 | 46 |
| 49 bool CollectedCookiesInfoBarDelegate::Accept() { | 47 bool CollectedCookiesInfoBarDelegate::Accept() { |
| 50 web_contents()->GetController().Reload(true); | 48 web_contents()->GetController().Reload(true); |
| 51 return true; | 49 return true; |
| 52 } | 50 } |
| OLD | NEW |