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

Unified Diff: chrome/browser/ui/android/infobars/confirm_infobar.cc

Issue 2493013002: Replace the use of WindowAndroid with Tab in permissions code. (Closed)
Patch Set: Comments Created 4 years, 1 month 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/ui/android/infobars/confirm_infobar.cc
diff --git a/chrome/browser/ui/android/infobars/confirm_infobar.cc b/chrome/browser/ui/android/infobars/confirm_infobar.cc
index d5ffed45186d94c9a16668327678a0e8425d05aa..cf6e76693dc5af85ecb0a514f8ba2205f1b298c7 100644
--- a/chrome/browser/ui/android/infobars/confirm_infobar.cc
+++ b/chrome/browser/ui/android/infobars/confirm_infobar.cc
@@ -9,9 +9,9 @@
#include "base/android/jni_string.h"
#include "base/memory/ptr_util.h"
+#include "chrome/browser/android/tab_android.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "components/infobars/core/confirm_infobar_delegate.h"
-#include "content/public/browser/android/content_view_core.h"
#include "content/public/browser/web_contents.h"
#include "jni/ConfirmInfoBar_jni.h"
#include "ui/android/window_android.h"
@@ -37,6 +37,27 @@ ConfirmInfoBar::ConfirmInfoBar(std::unique_ptr<ConfirmInfoBarDelegate> delegate)
ConfirmInfoBar::~ConfirmInfoBar() {
}
+base::string16 ConfirmInfoBar::GetTextFor(
+ ConfirmInfoBarDelegate::InfoBarButton button) {
+ ConfirmInfoBarDelegate* delegate = GetDelegate();
+ return (delegate->GetButtons() & button) ?
+ delegate->GetButtonLabel(button) : base::string16();
+}
+
+ConfirmInfoBarDelegate* ConfirmInfoBar::GetDelegate() {
+ return delegate()->AsConfirmInfoBarDelegate();
+}
+
+TabAndroid* ConfirmInfoBar::GetTab() {
+ content::WebContents* web_contents =
+ InfoBarService::WebContentsFromInfoBar(this);
+ DCHECK(web_contents);
+
+ TabAndroid* tab = TabAndroid::FromWebContents(web_contents);
+ DCHECK(tab);
+ return tab;
+}
+
ScopedJavaLocalRef<jobject> ConfirmInfoBar::CreateRenderInfoBar(JNIEnv* env) {
ScopedJavaLocalRef<jstring> ok_button_text =
base::android::ConvertUTF16ToJavaString(
@@ -61,16 +82,6 @@ ScopedJavaLocalRef<jobject> ConfirmInfoBar::CreateRenderInfoBar(JNIEnv* env) {
cancel_button_text);
}
-ScopedJavaLocalRef<jobject> ConfirmInfoBar::GetWindowAndroid() {
- content::WebContents* web_contents =
- InfoBarService::WebContentsFromInfoBar(this);
- DCHECK(web_contents);
- content::ContentViewCore* cvc =
- content::ContentViewCore::FromWebContents(web_contents);
- DCHECK(cvc);
- return cvc->GetWindowAndroid()->GetJavaObject();
-}
-
void ConfirmInfoBar::OnLinkClicked(JNIEnv* env,
const JavaParamRef<jobject>& obj) {
if (!owner())
@@ -91,14 +102,3 @@ void ConfirmInfoBar::ProcessButton(int action) {
delegate->Accept() : delegate->Cancel())
RemoveSelf();
}
-
-ConfirmInfoBarDelegate* ConfirmInfoBar::GetDelegate() {
- return delegate()->AsConfirmInfoBarDelegate();
-}
-
-base::string16 ConfirmInfoBar::GetTextFor(
- ConfirmInfoBarDelegate::InfoBarButton button) {
- ConfirmInfoBarDelegate* delegate = GetDelegate();
- return (delegate->GetButtons() & button) ?
- delegate->GetButtonLabel(button) : base::string16();
-}
« no previous file with comments | « chrome/browser/ui/android/infobars/confirm_infobar.h ('k') | chrome/browser/ui/android/infobars/grouped_permission_infobar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698