Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6518)

Unified Diff: chrome/browser/media/protected_media_identifier_infobar_delegate.cc

Issue 22694006: Infobar system refactor. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media/protected_media_identifier_infobar_delegate.cc
===================================================================
--- chrome/browser/media/protected_media_identifier_infobar_delegate.cc (revision 226624)
+++ chrome/browser/media/protected_media_identifier_infobar_delegate.cc (working copy)
@@ -5,6 +5,7 @@
#include "chrome/browser/media/protected_media_identifier_infobar_delegate.h"
#include "chrome/browser/content_settings/permission_queue_controller.h"
+#include "chrome/browser/infobars/infobar.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/navigation_entry.h"
#include "grit/generated_resources.h"
@@ -13,7 +14,7 @@
#include "ui/base/l10n/l10n_util.h"
// static
-InfoBarDelegate* ProtectedMediaIdentifierInfoBarDelegate::Create(
+InfoBar* ProtectedMediaIdentifierInfoBarDelegate::Create(
InfoBarService* infobar_service,
PermissionQueueController* controller,
const PermissionRequestID& id,
@@ -21,34 +22,33 @@
const std::string& display_languages) {
const content::NavigationEntry* committed_entry =
infobar_service->web_contents()->GetController().GetLastCommittedEntry();
- return infobar_service->AddInfoBar(
- scoped_ptr<InfoBarDelegate>(new ProtectedMediaIdentifierInfoBarDelegate(
- infobar_service,
- controller,
- id,
- requesting_frame,
- committed_entry ? committed_entry->GetUniqueID() : 0,
- display_languages)));
+ return infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar(
+ scoped_ptr<ConfirmInfoBarDelegate>(
+ new ProtectedMediaIdentifierInfoBarDelegate(
+ controller, id, requesting_frame,
+ committed_entry ? committed_entry->GetUniqueID() : 0,
+ display_languages))));
}
ProtectedMediaIdentifierInfoBarDelegate::
ProtectedMediaIdentifierInfoBarDelegate(
- InfoBarService* infobar_service,
- PermissionQueueController* controller,
- const PermissionRequestID& id,
- const GURL& requesting_frame,
- int contents_unique_id,
- const std::string& display_languages)
- : ConfirmInfoBarDelegate(infobar_service),
+ PermissionQueueController* controller,
+ const PermissionRequestID& id,
+ const GURL& requesting_frame,
+ int contents_unique_id,
+ const std::string& display_languages)
+ : ConfirmInfoBarDelegate(),
controller_(controller),
id_(id),
requesting_frame_(requesting_frame),
contents_unique_id_(contents_unique_id),
- display_languages_(display_languages) {}
+ display_languages_(display_languages) {
+}
ProtectedMediaIdentifierInfoBarDelegate::
- ~ProtectedMediaIdentifierInfoBarDelegate() {}
+ ~ProtectedMediaIdentifierInfoBarDelegate() {
+}
bool ProtectedMediaIdentifierInfoBarDelegate::Accept() {
SetPermission(true, true);
@@ -58,11 +58,9 @@
void ProtectedMediaIdentifierInfoBarDelegate::SetPermission(
bool update_content_setting,
bool allowed) {
- controller_->OnPermissionSet(id_,
- requesting_frame_,
+ controller_->OnPermissionSet(id_, requesting_frame_,
web_contents()->GetLastCommittedURL(),
- update_content_setting,
- allowed);
+ update_content_setting, allowed);
}
void ProtectedMediaIdentifierInfoBarDelegate::InfoBarDismissed() {
@@ -73,8 +71,8 @@
return IDR_PROTECTED_MEDIA_IDENTIFIER_INFOBAR_ICON;
}
-InfoBarDelegate::Type ProtectedMediaIdentifierInfoBarDelegate::GetInfoBarType()
- const {
+InfoBarDelegate::Type
+ ProtectedMediaIdentifierInfoBarDelegate::GetInfoBarType() const {
return PAGE_ACTION_TYPE;
}
@@ -97,9 +95,9 @@
string16 ProtectedMediaIdentifierInfoBarDelegate::GetButtonLabel(
InfoBarButton button) const {
- return l10n_util::GetStringUTF16(
- (button == BUTTON_OK) ? IDS_PROTECTED_MEDIA_IDENTIFIER_ALLOW_BUTTON
- : IDS_PROTECTED_MEDIA_IDENTIFIER_DENY_BUTTON);
+ return l10n_util::GetStringUTF16((button == BUTTON_OK) ?
+ IDS_PROTECTED_MEDIA_IDENTIFIER_ALLOW_BUTTON :
+ IDS_PROTECTED_MEDIA_IDENTIFIER_DENY_BUTTON);
}
bool ProtectedMediaIdentifierInfoBarDelegate::Cancel() {

Powered by Google App Engine
This is Rietveld 408576698