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 package org.chromium.chrome.browser.dom_distiller; | 5 package org.chromium.chrome.browser.dom_distiller; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.text.TextUtils; | 8 import android.text.TextUtils; |
9 | 9 |
10 import org.chromium.base.CommandLine; | 10 import org.chromium.base.CommandLine; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 mIsFindToolbarShowing = false; | 149 mIsFindToolbarShowing = false; |
150 requestReaderPanelShow(StateChangeReason.UNKNOWN); | 150 requestReaderPanelShow(StateChangeReason.UNKNOWN); |
151 } | 151 } |
152 }; | 152 }; |
153 } | 153 } |
154 | 154 |
155 // TabModelSelectorTabObserver: | 155 // TabModelSelectorTabObserver: |
156 | 156 |
157 @Override | 157 @Override |
158 public void onShown(Tab shownTab) { | 158 public void onShown(Tab shownTab) { |
| 159 if (mTabModelSelector == null) return; |
| 160 |
159 int shownTabId = shownTab.getId(); | 161 int shownTabId = shownTab.getId(); |
160 Tab previousTab = mTabModelSelector.getTabById(mTabId); | 162 Tab previousTab = mTabModelSelector.getTabById(mTabId); |
161 mTabId = shownTabId; | 163 mTabId = shownTabId; |
162 | 164 |
163 // If the reader panel was dismissed, stop here. | 165 // If the reader panel was dismissed, stop here. |
164 if (mTabStatusMap.containsKey(shownTabId) | 166 if (mTabStatusMap.containsKey(shownTabId) |
165 && mTabStatusMap.get(shownTabId).isDismissed()) { | 167 && mTabStatusMap.get(shownTabId).isDismissed()) { |
166 return; | 168 return; |
167 } | 169 } |
168 | 170 |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 | 643 |
642 boolean enabled = CommandLine.getInstance().hasSwitch(ChromeSwitches.ENA
BLE_DOM_DISTILLER) | 644 boolean enabled = CommandLine.getInstance().hasSwitch(ChromeSwitches.ENA
BLE_DOM_DISTILLER) |
643 && !CommandLine.getInstance().hasSwitch( | 645 && !CommandLine.getInstance().hasSwitch( |
644 ChromeSwitches.DISABLE_READER_MODE_BOTTOM_BAR) | 646 ChromeSwitches.DISABLE_READER_MODE_BOTTOM_BAR) |
645 && !DeviceFormFactor.isTablet(context) | 647 && !DeviceFormFactor.isTablet(context) |
646 && DomDistillerTabUtils.isDistillerHeuristicsEnabled() | 648 && DomDistillerTabUtils.isDistillerHeuristicsEnabled() |
647 && !SysUtils.isLowEndDevice(); | 649 && !SysUtils.isLowEndDevice(); |
648 return enabled; | 650 return enabled; |
649 } | 651 } |
650 } | 652 } |
OLD | NEW |