Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: chrome/android/java_staging/src/org/chromium/chrome/browser/document/DocumentActivity.java

Issue 1187623004: Merge ToolbarHelper to ToolbarManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits and fixed an NPE Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java_staging/src/org/chromium/chrome/browser/document/DocumentActivity.java
diff --git a/chrome/android/java_staging/src/org/chromium/chrome/browser/document/DocumentActivity.java b/chrome/android/java_staging/src/org/chromium/chrome/browser/document/DocumentActivity.java
index 60d75eed29ca70d3f0fcbd3fcfd1de6a5bb756c6..7d9cc45d91da6af6f08227cad8015df828808252 100644
--- a/chrome/android/java_staging/src/org/chromium/chrome/browser/document/DocumentActivity.java
+++ b/chrome/android/java_staging/src/org/chromium/chrome/browser/document/DocumentActivity.java
@@ -59,7 +59,7 @@ import org.chromium.chrome.browser.tabmodel.document.DocumentTabModel.Initializa
import org.chromium.chrome.browser.tabmodel.document.DocumentTabModelImpl;
import org.chromium.chrome.browser.tabmodel.document.DocumentTabModelSelector;
import org.chromium.chrome.browser.toolbar.ToolbarControlContainer;
-import org.chromium.chrome.browser.toolbar.ToolbarHelper;
+import org.chromium.chrome.browser.toolbar.ToolbarManager;
import org.chromium.chrome.browser.util.FeatureUtilities;
import org.chromium.chrome.browser.util.IntentUtils;
import org.chromium.chrome.browser.widget.ControlContainer;
@@ -108,7 +108,7 @@ public class DocumentActivity extends ChromeActivity {
private int mDefaultThemeColor;
private DocumentTab mDocumentTab;
- private ToolbarHelper mToolbarHelper;
+ private ToolbarManager mToolbarManager;
private ChromeAppMenuPropertiesDelegate mChromeAppMenuPropertiesDelegate;
private AppMenuHandler mAppMenuHandler;
@@ -182,7 +182,7 @@ public class DocumentActivity extends ChromeActivity {
mChromeAppMenuPropertiesDelegate = new ChromeAppMenuPropertiesDelegate(this);
mAppMenuHandler = new AppMenuHandler(this, mChromeAppMenuPropertiesDelegate,
R.menu.main_menu);
- mToolbarHelper = new ToolbarHelper(this, controlContainer, mAppMenuHandler,
+ mToolbarManager = new ToolbarManager(this, controlContainer, mAppMenuHandler,
mChromeAppMenuPropertiesDelegate, getCompositorViewHolder().getInvalidator());
final int tabId = ActivityDelegate.getTabIdFromIntent(getIntent());
@@ -279,12 +279,12 @@ public class DocumentActivity extends ChromeActivity {
@Override
protected void onDeferredStartup() {
super.onDeferredStartup();
- mToolbarHelper.onDeferredStartup();
+ mToolbarManager.onDeferredStartup(getOnCreateTimestampMs(), getClass().getSimpleName());
}
@Override
public boolean hasDoneFirstDraw() {
- return mToolbarHelper.hasDoneFirstDraw();
+ return mToolbarManager.hasDoneFirstDraw();
}
/**
@@ -411,7 +411,7 @@ public class DocumentActivity extends ChromeActivity {
@Override
protected void onDestroyInternal() {
- if (mToolbarHelper != null) mToolbarHelper.destroy();
+ if (mToolbarManager != null) mToolbarManager.destroy();
super.onDestroyInternal();
}
@@ -441,13 +441,13 @@ public class DocumentActivity extends ChromeActivity {
@Override
public void onOrientationChange(int orientation) {
super.onOrientationChange(orientation);
- mToolbarHelper.onOrientationChange();
+ mToolbarManager.onOrientationChange();
}
@Override
protected void onAccessibilityModeChanged(boolean enabled) {
super.onAccessibilityModeChanged(enabled);
- mToolbarHelper.onAccessibilityStatusChanged(enabled);
+ mToolbarManager.onAccessibilityStatusChanged(enabled);
}
private void loadLastKnownUrl(PendingDocumentData pendingData) {
@@ -595,10 +595,10 @@ public class DocumentActivity extends ChromeActivity {
(ViewGroup) findViewById(android.R.id.content), controlContainer);
mFindToolbarManager = new FindToolbarManager(this, getTabModelSelector(),
- mToolbarHelper.getContextualMenuBar()
+ mToolbarManager.getContextualMenuBar()
.getCustomSelectionActionModeCallback());
- mToolbarHelper.initializeControls(
+ mToolbarManager.initializeWithNative(getTabModelSelector(), getFullscreenManager(),
mFindToolbarManager, null, layoutDriver, null, null, null, null);
mDocumentTab.setFullscreenManager(getFullscreenManager());
@@ -830,12 +830,12 @@ public class DocumentActivity extends ChromeActivity {
RecordUserAction.record("MobileShortcutFindInPage");
}
} else if (id == R.id.show_menu) {
- if (mToolbarHelper.isInitialized()) {
- mAppMenuHandler.showAppMenu(mToolbarHelper.getMenuAnchor(), true,
+ if (mToolbarManager.isInitialized()) {
+ mAppMenuHandler.showAppMenu(mToolbarManager.getMenuAnchor(), true,
false);
}
} else if (id == R.id.focus_url_bar) {
- if (mToolbarHelper.isInitialized()) mToolbarHelper.setUrlBarFocus(true);
+ if (mToolbarManager.isInitialized()) mToolbarManager.setUrlBarFocus(true);
} else {
return super.onMenuOrKeyboardAction(id, fromMenu);
}
@@ -845,20 +845,20 @@ public class DocumentActivity extends ChromeActivity {
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
Boolean result = KeyboardShortcuts.dispatchKeyEvent(event, this,
- mToolbarHelper.isInitialized());
+ mToolbarManager.isInitialized());
return result != null ? result : super.dispatchKeyEvent(event);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
- if (!mToolbarHelper.isInitialized()) return false;
+ if (!mToolbarManager.isInitialized()) return false;
return KeyboardShortcuts.onKeyDown(event, this, true, false)
|| super.onKeyDown(keyCode, event);
}
@Override
public boolean shouldShowAppMenu() {
- if (mDocumentTab == null || !mToolbarHelper.isInitialized()) {
+ if (mDocumentTab == null || !mToolbarManager.isInitialized()) {
return false;
}
@@ -919,7 +919,7 @@ public class DocumentActivity extends ChromeActivity {
int color = getThemeColor();
DocumentUtils.updateTaskDescription(this, label, icon, color,
shouldUseDefaultStatusBarColor());
- mToolbarHelper.setThemeColor(color);
+ mToolbarManager.updatePrimaryColor(color);
ControlContainer controlContainer =
(ControlContainer) findViewById(R.id.control_container);

Powered by Google App Engine
This is Rietveld 408576698