Bug 1426864 - Determine private mode via browser toolbar, 2nd edition. r=nechen a=gchang
authorJan Henning <jh+bugzilla@buttercookie.de>
Fri, 22 Dec 2017 18:51:11 +0100
changeset 443126 05bca3daad744ba8fc16a97fbdbdce486309e236
parent 443125 2609db38f7d82c2433ce9d6ecb4ac9d3a85e35f8
child 443127 8520cccd20723c6934360bc8696d20e5052a70c7
push id8492
push useraiakab@mozilla.com
push dateMon, 08 Jan 2018 11:12:27 +0000
treeherdermozilla-beta@8520cccd2072 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnechen, gchang
bugs1426864, 1426613
Bug 1426864 - Determine private mode via browser toolbar, 2nd edition. r=nechen a=gchang Similar to maybeSwitchToTab in bug 1426613, a search might be launched while we don't have a selected tab yet. Therefore we determine private mode state via the browser toolbar instead. MozReview-Commit-ID: 4idUR8v7MCx
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -4327,17 +4327,17 @@ public class BrowserApp extends GeckoApp
     // BrowserSearch.OnSearchListener
     public void onSearch(SearchEngine engine, final String text, final TelemetryContract.Method method) {
         // Don't store searches that happen in private tabs. This assumes the user can only
         // perform a search inside the currently selected tab, which is true for searches
         // that come from SearchEngineRow.
-        if (!Tabs.getInstance().getSelectedTab().isPrivate()) {
+        if (!mBrowserToolbar.isPrivateMode()) {
         // We don't use SearchEngine.getEngineIdentifier because it can
         // return a custom search engine name, which is a privacy concern.
         final String identifierToRecord = (engine.identifier != null) ? engine.identifier : "other";
         recordSearch(GeckoSharedPrefs.forProfile(this), identifierToRecord, method);
         openUrlAndStopEditing(text, engine.name);