| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 com.android.webview.chromium; | 5 package com.android.webview.chromium; |
| 6 | 6 |
| 7 import android.webkit.WebBackForwardList; | 7 import android.webkit.WebBackForwardList; |
| 8 import android.webkit.WebHistoryItem; | 8 import android.webkit.WebHistoryItem; |
| 9 | 9 |
| 10 import org.chromium.base.annotations.SuppressFBWarnings; |
| 10 import org.chromium.content_public.browser.NavigationHistory; | 11 import org.chromium.content_public.browser.NavigationHistory; |
| 11 | 12 |
| 12 import java.util.ArrayList; | 13 import java.util.ArrayList; |
| 13 import java.util.List; | 14 import java.util.List; |
| 14 | 15 |
| 15 /** | 16 /** |
| 16 * WebView Chromium implementation of WebBackForwardList. Simple immutable | 17 * WebView Chromium implementation of WebBackForwardList. Simple immutable |
| 17 * wrapper around NavigationHistory. | 18 * wrapper around NavigationHistory. |
| 18 */ | 19 */ |
| 20 @SuppressFBWarnings({ |
| 21 "CHROMIUM_SYNCHRONIZED_METHOD", |
| 22 "SE_BAD_FIELD"}) |
| 19 public class WebBackForwardListChromium extends WebBackForwardList { | 23 public class WebBackForwardListChromium extends WebBackForwardList { |
| 20 private final List<WebHistoryItemChromium> mHistroryItemList; | 24 private final List<WebHistoryItemChromium> mHistroryItemList; |
| 21 private final int mCurrentIndex; | 25 private final int mCurrentIndex; |
| 22 | 26 |
| 23 /* package */ WebBackForwardListChromium(NavigationHistory navHistory) { | 27 /* package */ WebBackForwardListChromium(NavigationHistory navHistory) { |
| 24 mCurrentIndex = navHistory.getCurrentEntryIndex(); | 28 mCurrentIndex = navHistory.getCurrentEntryIndex(); |
| 25 mHistroryItemList = new ArrayList<WebHistoryItemChromium>(navHistory.get
EntryCount()); | 29 mHistroryItemList = new ArrayList<WebHistoryItemChromium>(navHistory.get
EntryCount()); |
| 26 for (int i = 0; i < navHistory.getEntryCount(); ++i) { | 30 for (int i = 0; i < navHistory.getEntryCount(); ++i) { |
| 27 mHistroryItemList.add(new WebHistoryItemChromium(navHistory.getEntry
AtIndex(i))); | 31 mHistroryItemList.add(new WebHistoryItemChromium(navHistory.getEntry
AtIndex(i))); |
| 28 } | 32 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 */ | 83 */ |
| 80 @Override | 84 @Override |
| 81 protected synchronized WebBackForwardListChromium clone() { | 85 protected synchronized WebBackForwardListChromium clone() { |
| 82 List<WebHistoryItemChromium> list = new ArrayList<WebHistoryItemChromium
>(getSize()); | 86 List<WebHistoryItemChromium> list = new ArrayList<WebHistoryItemChromium
>(getSize()); |
| 83 for (int i = 0; i < getSize(); ++i) { | 87 for (int i = 0; i < getSize(); ++i) { |
| 84 list.add(mHistroryItemList.get(i).clone()); | 88 list.add(mHistroryItemList.get(i).clone()); |
| 85 } | 89 } |
| 86 return new WebBackForwardListChromium(list, mCurrentIndex); | 90 return new WebBackForwardListChromium(list, mCurrentIndex); |
| 87 } | 91 } |
| 88 } | 92 } |
| OLD | NEW |