Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
customtabs: Fix a crash when clicking on the lock icon.
Browse files Browse the repository at this point in the history
When the user clicks on the lock icon in a Custom Tab, the click
listener creates a new piece of UI. This inflation fails if the context
passed to WebSiteSettingsPopup#show() is not an Activity.

BUG=524005

Review URL: https://codereview.chromium.org/1318483002

Cr-Commit-Position: refs/heads/master@{#345858}
(cherry picked from commit 63c9943)

Review URL: https://codereview.chromium.org/1315713004 .

Cr-Commit-Position: refs/branch-heads/2490@{#49}
Cr-Branched-From: 7790a35-refs/heads/master@{#344925}
  • Loading branch information
Benoit Lize committed Aug 27, 2015
1 parent a81e55d commit b893511
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package org.chromium.chrome.browser.toolbar;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
Expand Down Expand Up @@ -113,8 +114,9 @@ public void onNativeLibraryReady() {
public void onClick(View v) {
Tab currentTab = getToolbarDataProvider().getTab();
if (currentTab == null || currentTab.getWebContents() == null) return;

WebsiteSettingsPopup.show(getContext(), currentTab.getProfile(),
Activity activity = currentTab.getWindowAndroid().getActivity().get();
if (activity == null) return;
WebsiteSettingsPopup.show(activity, currentTab.getProfile(),
currentTab.getWebContents());
}
});
Expand Down

0 comments on commit b893511

Please sign in to comment.