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 org.chromium.content_public.browser.WebContentsObserver; | 7 import org.chromium.content_public.browser.WebContentsObserver; |
8 | 8 |
9 /** | 9 /** |
10 * This class tracks the per-tab state of reader mode. | 10 * This class tracks the per-tab state of reader mode. |
11 */ | 11 */ |
12 public class ReaderModeTabInfo { | 12 public class ReaderModeTabInfo { |
13 // The WebContentsObserver responsible for updates to the distillation statu
s of the tab. | 13 // The WebContentsObserver responsible for updates to the distillation statu
s of the tab. |
14 private WebContentsObserver mWebContentsObserver; | 14 private WebContentsObserver mWebContentsObserver; |
15 | 15 |
16 // The distillation status of the tab. | 16 // The distillation status of the tab. |
17 private int mStatus; | 17 private int mStatus; |
18 | 18 |
19 // If the panel was closed due to the close button. | 19 // If the panel was closed due to the close button. |
20 private boolean mIsDismissed; | 20 private boolean mIsDismissed; |
21 | 21 |
22 // The URL that distiller is using for this tab. This is used to check if a
result comes | 22 // The URL that distiller is using for this tab. This is used to check if a
result comes |
23 // back from distiller and the user has already loaded a new URL. | 23 // back from distiller and the user has already loaded a new URL. |
24 private String mCurrentUrl; | 24 private String mCurrentUrl; |
25 | 25 |
| 26 // The distillability heuristics now use a callback to notify the manager th
at a page can |
| 27 // be distilled. This flag is used to detect if the callback is set for this
tab. |
| 28 private boolean mIsCallbackSet; |
| 29 |
26 /** | 30 /** |
27 * @param observer The WebContentsObserver for the tab this object represent
s. | 31 * @param observer The WebContentsObserver for the tab this object represent
s. |
28 */ | 32 */ |
29 public void setWebContentsObserver(WebContentsObserver observer) { | 33 public void setWebContentsObserver(WebContentsObserver observer) { |
30 mWebContentsObserver = observer; | 34 mWebContentsObserver = observer; |
31 } | 35 } |
32 | 36 |
33 /** | 37 /** |
34 * @return The WebContentsObserver for the tab this object represents. | 38 * @return The WebContentsObserver for the tab this object represents. |
35 */ | 39 */ |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 public void setUrl(String url) { | 75 public void setUrl(String url) { |
72 mCurrentUrl = url; | 76 mCurrentUrl = url; |
73 } | 77 } |
74 | 78 |
75 /** | 79 /** |
76 * @return The last URL being processed by reader mode. | 80 * @return The last URL being processed by reader mode. |
77 */ | 81 */ |
78 public String getUrl() { | 82 public String getUrl() { |
79 return mCurrentUrl; | 83 return mCurrentUrl; |
80 } | 84 } |
| 85 |
| 86 /** |
| 87 * @return If the distillability callback is set for this object's tab. |
| 88 */ |
| 89 public boolean isCallbackSet() { |
| 90 return mIsCallbackSet; |
| 91 } |
| 92 |
| 93 /** |
| 94 * @param isSet Set if this object's tab has a distillability callback. |
| 95 */ |
| 96 public void setIsCallbackSet(boolean isSet) { |
| 97 mIsCallbackSet = isSet; |
| 98 } |
81 } | 99 } |
82 | 100 |
OLD | NEW |