Chromium Code Reviews

Side by Side Diff: chrome/browser/android/fullscreen/fullscreen_infobar_delegate.cc

Issue 1340693002: Speculative hardening of fullscreen infobar code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2490
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « chrome/browser/android/fullscreen/fullscreen_infobar_delegate.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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...)
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...)
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 }
OLDNEW
« no previous file with comments | « chrome/browser/android/fullscreen/fullscreen_infobar_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine