1 // Copyright (c) 2013 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.
5 #include "chrome/browser/ui/content_settings/media_setting_changed_infobar_delegate.h"
7 #include "base/logging.h"
8 #include "chrome/browser/infobars/infobar_service.h"
9 #include "content/public/browser/web_contents.h"
10 #include "grit/generated_resources.h"
11 #include "grit/theme_resources.h"
12 #include "ui/base/l10n/l10n_util.h"
15 void MediaSettingChangedInfoBarDelegate::Create(
16 InfoBarService* infobar_service) {
17 infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>(
18 new MediaSettingChangedInfoBarDelegate(infobar_service)));
21 MediaSettingChangedInfoBarDelegate::MediaSettingChangedInfoBarDelegate(
22 InfoBarService* infobar_service)
23 : ConfirmInfoBarDelegate(infobar_service) {
26 MediaSettingChangedInfoBarDelegate::~MediaSettingChangedInfoBarDelegate() {
29 int MediaSettingChangedInfoBarDelegate::GetIconID() const {
30 return IDR_INFOBAR_MEDIA_STREAM_CAMERA;
34 MediaSettingChangedInfoBarDelegate::GetInfoBarType() const {
35 return PAGE_ACTION_TYPE;
38 string16 MediaSettingChangedInfoBarDelegate::GetMessageText() const {
39 return l10n_util::GetStringUTF16(
40 IDS_MEDIASTREAM_SETTING_CHANGED_INFOBAR_MESSAGE);
43 int MediaSettingChangedInfoBarDelegate::GetButtons() const {
47 string16 MediaSettingChangedInfoBarDelegate::GetButtonLabel(
48 InfoBarButton button) const {
49 DCHECK_EQ(BUTTON_OK, button);
50 return l10n_util::GetStringUTF16(IDS_CONTENT_SETTING_CHANGED_INFOBAR_BUTTON);
53 bool MediaSettingChangedInfoBarDelegate::Accept() {
54 web_contents()->GetController().Reload(true);