| Index: chrome/browser/android/permissions/permission_group_infobar_delegate_android.cc
|
| diff --git a/chrome/browser/android/permissions/permission_group_infobar_delegate_android.cc b/chrome/browser/android/permissions/permission_group_infobar_delegate_android.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..62d74e1f9fed78d97c5cdb8304bd218e915472d8
|
| --- /dev/null
|
| +++ b/chrome/browser/android/permissions/permission_group_infobar_delegate_android.cc
|
| @@ -0,0 +1,70 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/browser/android/permissions/permission_group_infobar_delegate_android.h"
|
| +
|
| +#include "base/android/jni_android.h"
|
| +#include "base/android/jni_string.h"
|
| +#include "base/strings/string16.h"
|
| +#include "base/strings/utf_string_conversions.h"
|
| +#include "chrome/browser/infobars/infobar_service.h"
|
| +#include "chrome/browser/permissions/permission_infobar_request.h"
|
| +#include "chrome/browser/ui/android/infobars/permission_group_infobar_android.h"
|
| +#include "chrome/grit/generated_resources.h"
|
| +#include "components/url_formatter/elide_url.h"
|
| +#include "ui/base/l10n/l10n_util.h"
|
| +
|
| +PermissionGroupInfoBarDelegateAndroid::
|
| +PermissionGroupInfoBarDelegateAndroid(
|
| + const GURL& requesting_frame,
|
| + const std::string& display_languages,
|
| + const base::Callback<void(
|
| + bool, const std::vector<ContentSetting>&)>& callback)
|
| + : requesting_frame_(requesting_frame),
|
| + display_languages_(display_languages),
|
| + callback_(callback) {
|
| +}
|
| +
|
| +PermissionGroupInfoBarDelegateAndroid::
|
| +~PermissionGroupInfoBarDelegateAndroid() {
|
| +}
|
| +
|
| +void PermissionGroupInfoBarDelegateAndroid::OnCheckedStateUpdate(
|
| + jboolean* raw_checked_states,
|
| + int array_size) {
|
| + checked_states_.clear();
|
| +
|
| + for (int i = 0; i < array_size; ++i) {
|
| + checked_states_.push_back(raw_checked_states[i] == JNI_TRUE
|
| + ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK);
|
| + }
|
| +}
|
| +
|
| +gfx::Image PermissionGroupInfoBarDelegateAndroid::GetIcon() const {
|
| + return gfx::Image();
|
| +}
|
| +
|
| +base::string16 PermissionGroupInfoBarDelegateAndroid::GetMessageText() const {
|
| + return l10n_util::GetStringFUTF16(IDS_COALESCED_PERMISSION_INFOBAR_QUESTION,
|
| + url_formatter::FormatUrlForSecurityDisplay(
|
| + requesting_frame_, display_languages_));
|
| +}
|
| +
|
| +int PermissionGroupInfoBarDelegateAndroid::GetButtons() const {
|
| + return BUTTON_OK;
|
| +}
|
| +
|
| +bool PermissionGroupInfoBarDelegateAndroid::Accept() {
|
| + callback_.Run(true, checked_states_);
|
| + return true;
|
| +}
|
| +
|
| +void PermissionGroupInfoBarDelegateAndroid::InfoBarDismissed() {
|
| + callback_.Run(false, checked_states_);
|
| +}
|
| +
|
| +bool PermissionGroupInfoBarDelegateAndroid::LinkClicked(
|
| + WindowOpenDisposition disposition) {
|
| + return true;
|
| +}
|
|
|