| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/android/fullscreen/fullscreen_infobar_delegate.h" | 5 #include "chrome/browser/android/fullscreen/fullscreen_infobar_delegate.h" |
| 6 | 6 |
| 7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "chrome/browser/android/tab_android.h" | 10 #include "chrome/browser/android/tab_android.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 } | 45 } |
| 46 | 46 |
| 47 FullscreenInfoBarDelegate::~FullscreenInfoBarDelegate() { | 47 FullscreenInfoBarDelegate::~FullscreenInfoBarDelegate() { |
| 48 if (!j_delegate_.is_null()) { | 48 if (!j_delegate_.is_null()) { |
| 49 Java_FullscreenInfoBarDelegate_onInfoBarDismissed( | 49 Java_FullscreenInfoBarDelegate_onInfoBarDismissed( |
| 50 base::android::AttachCurrentThread(), j_delegate_.obj()); | 50 base::android::AttachCurrentThread(), j_delegate_.obj()); |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 | 53 |
| 54 void FullscreenInfoBarDelegate::CloseFullscreenInfoBar( | 54 void FullscreenInfoBarDelegate::CloseFullscreenInfoBar( |
| 55 JNIEnv* env, jobject obj, jobject tab) { | 55 JNIEnv* env, jobject obj) { |
| 56 j_delegate_.Reset(); | 56 j_delegate_.Reset(); |
| 57 TabAndroid* tab_android = TabAndroid::GetNativeTab(env, tab); | 57 if (infobar() && infobar()->owner()) |
| 58 InfoBarService::FromWebContents(tab_android->web_contents())->RemoveInfoBar( | 58 infobar()->owner()->RemoveInfoBar(infobar()); |
| 59 infobar()); | |
| 60 } | 59 } |
| 61 | 60 |
| 62 int FullscreenInfoBarDelegate::GetIconID() const { | 61 int FullscreenInfoBarDelegate::GetIconID() const { |
| 63 return IDR_INFOBAR_FULLSCREEN; | 62 return IDR_INFOBAR_FULLSCREEN; |
| 64 } | 63 } |
| 65 | 64 |
| 66 base::string16 FullscreenInfoBarDelegate::GetMessageText() const { | 65 base::string16 FullscreenInfoBarDelegate::GetMessageText() const { |
| 67 Profile* profile = | 66 Profile* profile = |
| 68 ProfileManager::GetActiveUserProfile()->GetOriginalProfile(); | 67 ProfileManager::GetActiveUserProfile()->GetOriginalProfile(); |
| 69 std::string language = | 68 std::string language = |
| (...skipping 17 matching lines...) Expand all Loading... |
| 87 Java_FullscreenInfoBarDelegate_onFullscreenAllowed( | 86 Java_FullscreenInfoBarDelegate_onFullscreenAllowed( |
| 88 env, j_delegate_.obj(), j_origin.obj()); | 87 env, j_delegate_.obj(), j_origin.obj()); |
| 89 return true; | 88 return true; |
| 90 } | 89 } |
| 91 | 90 |
| 92 bool FullscreenInfoBarDelegate::Cancel() { | 91 bool FullscreenInfoBarDelegate::Cancel() { |
| 93 Java_FullscreenInfoBarDelegate_onFullscreenCancelled( | 92 Java_FullscreenInfoBarDelegate_onFullscreenCancelled( |
| 94 base::android::AttachCurrentThread(), j_delegate_.obj()); | 93 base::android::AttachCurrentThread(), j_delegate_.obj()); |
| 95 return true; | 94 return true; |
| 96 } | 95 } |
| OLD | NEW |