Commit a0bf8e71 authored by mariakhomenko's avatar mariakhomenko Committed by Commit bot

Move setCoveredByChild methods to Tab.

Moves a subclass Tab method up to superclass to eliminate the dependency
on the downstream Tab implementation. Removes the no longer necessary
method from TabDelegate.

BUG=464934

Review URL: https://codereview.chromium.org/988323005

Cr-Commit-Position: refs/heads/master@{#319737}
parent 1994b54e
...@@ -2603,6 +2603,23 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener, ...@@ -2603,6 +2603,23 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
return nativeHasPrerenderedUrl(mNativeTabAndroid, url); return nativeHasPrerenderedUrl(mNativeTabAndroid, url);
} }
/**
* Check if the tab is covered by its child activity.
* @return Whether the tab is covered by its child activity.
*/
public boolean isCoveredByChildActivity() {
// Default return value, this is only used by subclasses.
return false;
}
/**
* Update whether the tab is covered by its child activity.
* @param isCoveredByChildActivity Whether the tab is covered by its child activity.
*/
public void setCoveredByChildActivity(boolean isCoveredByChildActivity) {
// Empty implementation, only used by subclasses.
}
/** /**
* Ensures the counter is at least as high as the specified value. The counter should always * Ensures the counter is at least as high as the specified value. The counter should always
* point to an unused ID (which will be handed out next time a request comes in). Exposed so * point to an unused ID (which will be handed out next time a request comes in). Exposed so
......
...@@ -439,7 +439,7 @@ public class DocumentTabModelImpl extends TabModelJniBridge implements DocumentT ...@@ -439,7 +439,7 @@ public class DocumentTabModelImpl extends TabModelJniBridge implements DocumentT
Entry currentEntry = mEntryMap.get(id); Entry currentEntry = mEntryMap.get(id);
String currentUrl = tab.getUrl(); String currentUrl = tab.getUrl();
boolean canGoBack = tab.canGoBack(); boolean canGoBack = tab.canGoBack();
boolean isCoveredByChildActivity = mTabDelegate.isTabCoveredByChildActivity(tab); boolean isCoveredByChildActivity = tab.isCoveredByChildActivity();
TabState state = tab.getState(); TabState state = tab.getState();
if (currentEntry != null if (currentEntry != null
&& currentEntry.tabId == id && currentEntry.tabId == id
......
...@@ -53,11 +53,4 @@ public interface TabDelegate { ...@@ -53,11 +53,4 @@ public interface TabDelegate {
* @param url URL to spawn a Tab for. * @param url URL to spawn a Tab for.
*/ */
void createTabForDevTools(String url); void createTabForDevTools(String url);
/**
* Check if the tab is covered by its child activity.
* @param tab Tab to be checked.
* @return Whether the tab is covered by its child activity.
*/
boolean isTabCoveredByChildActivity(Tab tab);
} }
\ No newline at end of file
...@@ -41,9 +41,4 @@ public class MockTabDelegate implements TabDelegate { ...@@ -41,9 +41,4 @@ public class MockTabDelegate implements TabDelegate {
@Override @Override
public void createTabForDevTools(String url) { public void createTabForDevTools(String url) {
} }
@Override
public boolean isTabCoveredByChildActivity(Tab tab) {
return false;
}
} }
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment