| 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.tabmodel; | 5 package org.chromium.chrome.browser.tabmodel; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.os.Handler; | 8 import android.os.Handler; |
| 9 | 9 |
| 10 import org.chromium.base.VisibleForTesting; | 10 import org.chromium.base.VisibleForTesting; |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 @Override | 220 @Override |
| 221 public void onCrash(Tab tab, boolean sadTabShown) { | 221 public void onCrash(Tab tab, boolean sadTabShown) { |
| 222 if (sadTabShown) { | 222 if (sadTabShown) { |
| 223 mTabContentManager.removeTabThumbnail(tab.getId()); | 223 mTabContentManager.removeTabThumbnail(tab.getId()); |
| 224 } | 224 } |
| 225 mUma.onTabCrashed(tab.getId()); | 225 mUma.onTabCrashed(tab.getId()); |
| 226 } | 226 } |
| 227 }; | 227 }; |
| 228 } | 228 } |
| 229 | 229 |
| 230 /** |
| 231 * Exposed to allow tests to initialize the selector with different tab mode
ls. |
| 232 * @param normalModel The normal tab model. |
| 233 * @param incognitoModel The incognito tab model. |
| 234 */ |
| 235 @VisibleForTesting |
| 236 public void initializeForTesting(TabModel normalModel, TabModel incognitoMod
el) { |
| 237 initialize(isIncognitoSelected(), normalModel, incognitoModel); |
| 238 mActiveState = true; |
| 239 } |
| 240 |
| 230 @Override | 241 @Override |
| 231 public void setCloseAllTabsDelegate(CloseAllTabsDelegate delegate) { | 242 public void setCloseAllTabsDelegate(CloseAllTabsDelegate delegate) { |
| 232 mCloseAllTabsDelegate = delegate; | 243 mCloseAllTabsDelegate = delegate; |
| 233 } | 244 } |
| 234 | 245 |
| 235 @Override | 246 @Override |
| 236 public TabModel getModelAt(int index) { | 247 public TabModel getModelAt(int index) { |
| 237 return mActiveState ? super.getModelAt(index) : EmptyTabModel.getInstanc
e(); | 248 return mActiveState ? super.getModelAt(index) : EmptyTabModel.getInstanc
e(); |
| 238 } | 249 } |
| 239 | 250 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 @Override | 426 @Override |
| 416 public void notifyChanged() { | 427 public void notifyChanged() { |
| 417 super.notifyChanged(); | 428 super.notifyChanged(); |
| 418 } | 429 } |
| 419 | 430 |
| 420 @VisibleForTesting | 431 @VisibleForTesting |
| 421 public TabPersistentStore getTabPersistentStoreForTesting() { | 432 public TabPersistentStore getTabPersistentStoreForTesting() { |
| 422 return mTabSaver; | 433 return mTabSaver; |
| 423 } | 434 } |
| 424 } | 435 } |
| OLD | NEW |