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; | 5 package org.chromium.chrome.browser; |
6 | 6 |
7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
8 import android.annotation.TargetApi; | 8 import android.annotation.TargetApi; |
9 import android.app.Activity; | 9 import android.app.Activity; |
10 import android.app.ActivityManager; | 10 import android.app.ActivityManager; |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 intent.getAction())) { | 619 intent.getAction())) { |
620 // Handled. | 620 // Handled. |
621 } | 621 } |
622 } | 622 } |
623 | 623 |
624 private void initializeUI() { | 624 private void initializeUI() { |
625 try { | 625 try { |
626 TraceEvent.begin("ChromeTabbedActivity.initializeUI"); | 626 TraceEvent.begin("ChromeTabbedActivity.initializeUI"); |
627 | 627 |
628 CompositorViewHolder compositorViewHolder = getCompositorViewHolder(
); | 628 CompositorViewHolder compositorViewHolder = getCompositorViewHolder(
); |
629 if (DeviceFormFactor.isTablet(this)) { | 629 if (DeviceFormFactor.isTablet()) { |
630 mLayoutManager = new LayoutManagerChromeTablet(compositorViewHol
der); | 630 mLayoutManager = new LayoutManagerChromeTablet(compositorViewHol
der); |
631 } else { | 631 } else { |
632 mLayoutManager = new LayoutManagerChromePhone(compositorViewHold
er); | 632 mLayoutManager = new LayoutManagerChromePhone(compositorViewHold
er); |
633 } | 633 } |
634 mLayoutManager.setEnableAnimations(DeviceClassManager.enableAnimatio
ns()); | 634 mLayoutManager.setEnableAnimations(DeviceClassManager.enableAnimatio
ns()); |
635 mLayoutManager.addOverviewModeObserver(this); | 635 mLayoutManager.addOverviewModeObserver(this); |
636 | 636 |
637 // TODO(yusufo): get rid of findViewById(R.id.url_bar). | 637 // TODO(yusufo): get rid of findViewById(R.id.url_bar). |
638 initializeCompositorContent(mLayoutManager, findViewById(R.id.url_ba
r), | 638 initializeCompositorContent(mLayoutManager, findViewById(R.id.url_ba
r), |
639 mContentContainer, mControlContainer); | 639 mContentContainer, mControlContainer); |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1216 @Override | 1216 @Override |
1217 protected int getControlContainerLayoutId() { | 1217 protected int getControlContainerLayoutId() { |
1218 if (FeatureUtilities.isChromeHomeEnabled()) { | 1218 if (FeatureUtilities.isChromeHomeEnabled()) { |
1219 return R.layout.bottom_control_container; | 1219 return R.layout.bottom_control_container; |
1220 } | 1220 } |
1221 return R.layout.control_container; | 1221 return R.layout.control_container; |
1222 } | 1222 } |
1223 | 1223 |
1224 @Override | 1224 @Override |
1225 protected int getToolbarLayoutId() { | 1225 protected int getToolbarLayoutId() { |
1226 if (DeviceFormFactor.isTablet(getApplicationContext())) return R.layout.
toolbar_tablet; | 1226 if (DeviceFormFactor.isTablet()) return R.layout.toolbar_tablet; |
1227 | 1227 |
1228 if (FeatureUtilities.isChromeHomeEnabled()) return R.layout.bottom_toolb
ar_phone; | 1228 if (FeatureUtilities.isChromeHomeEnabled()) return R.layout.bottom_toolb
ar_phone; |
1229 return R.layout.toolbar_phone; | 1229 return R.layout.toolbar_phone; |
1230 } | 1230 } |
1231 | 1231 |
1232 @Override | 1232 @Override |
1233 public void postInflationStartup() { | 1233 public void postInflationStartup() { |
1234 super.postInflationStartup(); | 1234 super.postInflationStartup(); |
1235 | 1235 |
1236 // Critical path for startup. Create the minimum objects needed | 1236 // Critical path for startup. Create the minimum objects needed |
1237 // to allow a blank screen draw (without depending on any native code) | 1237 // to allow a blank screen draw (without depending on any native code) |
1238 // and then yield ASAP. | 1238 // and then yield ASAP. |
1239 if (isFinishing()) return; | 1239 if (isFinishing()) return; |
1240 | 1240 |
1241 // Don't show the keyboard until user clicks in. | 1241 // Don't show the keyboard until user clicks in. |
1242 getWindow().setSoftInputMode( | 1242 getWindow().setSoftInputMode( |
1243 WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN | 1243 WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN |
1244 | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); | 1244 | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); |
1245 | 1245 |
1246 mContentContainer = (ViewGroup) findViewById(android.R.id.content); | 1246 mContentContainer = (ViewGroup) findViewById(android.R.id.content); |
1247 mControlContainer = (ToolbarControlContainer) findViewById(R.id.control_
container); | 1247 mControlContainer = (ToolbarControlContainer) findViewById(R.id.control_
container); |
1248 | 1248 |
1249 mUndoBarPopupController = new UndoBarController(this, mTabModelSelectorI
mpl, | 1249 mUndoBarPopupController = new UndoBarController(this, mTabModelSelectorI
mpl, |
1250 getSnackbarManager()); | 1250 getSnackbarManager()); |
1251 } | 1251 } |
1252 | 1252 |
1253 @Override | 1253 @Override |
1254 protected void initializeToolbar() { | 1254 protected void initializeToolbar() { |
1255 super.initializeToolbar(); | 1255 super.initializeToolbar(); |
1256 if (DeviceFormFactor.isTablet(getApplicationContext())) { | 1256 if (DeviceFormFactor.isTablet()) { |
1257 getToolbarManager().setShouldUpdateToolbarPrimaryColor(false); | 1257 getToolbarManager().setShouldUpdateToolbarPrimaryColor(false); |
1258 } | 1258 } |
1259 } | 1259 } |
1260 | 1260 |
1261 @Override | 1261 @Override |
1262 protected TabModelSelector createTabModelSelector() { | 1262 protected TabModelSelector createTabModelSelector() { |
1263 assert mTabModelSelectorImpl == null; | 1263 assert mTabModelSelectorImpl == null; |
1264 | 1264 |
1265 Bundle savedInstanceState = getSavedInstanceState(); | 1265 Bundle savedInstanceState = getSavedInstanceState(); |
1266 | 1266 |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1906 @Override | 1906 @Override |
1907 public void onOverviewModeFinishedHiding() { | 1907 public void onOverviewModeFinishedHiding() { |
1908 if (getAssistStatusHandler() != null) getAssistStatusHandler().updateAss
istState(); | 1908 if (getAssistStatusHandler() != null) getAssistStatusHandler().updateAss
istState(); |
1909 if (getActivityTab() != null) { | 1909 if (getActivityTab() != null) { |
1910 setStatusBarColor(getActivityTab(), getActivityTab().getThemeColor()
); | 1910 setStatusBarColor(getActivityTab(), getActivityTab().getThemeColor()
); |
1911 } | 1911 } |
1912 } | 1912 } |
1913 | 1913 |
1914 @Override | 1914 @Override |
1915 protected void setStatusBarColor(Tab tab, int color) { | 1915 protected void setStatusBarColor(Tab tab, int color) { |
1916 if (DeviceFormFactor.isTablet(getApplicationContext())) return; | 1916 if (DeviceFormFactor.isTablet()) return; |
1917 super.setStatusBarColor(tab, isInOverviewMode() ? Color.BLACK : color); | 1917 super.setStatusBarColor(tab, isInOverviewMode() ? Color.BLACK : color); |
1918 } | 1918 } |
1919 | 1919 |
1920 @Override | 1920 @Override |
1921 public void onMultiWindowModeChanged(boolean isInMultiWindowMode) { | 1921 public void onMultiWindowModeChanged(boolean isInMultiWindowMode) { |
1922 super.onMultiWindowModeChanged(isInMultiWindowMode); | 1922 super.onMultiWindowModeChanged(isInMultiWindowMode); |
1923 if (!FeatureUtilities.isTabModelMergingEnabled()) return; | 1923 if (!FeatureUtilities.isTabModelMergingEnabled()) return; |
1924 if (!isInMultiWindowMode) { | 1924 if (!isInMultiWindowMode) { |
1925 // If the activity is currently resumed when multi-window mode is ex
ited, try to merge | 1925 // If the activity is currently resumed when multi-window mode is ex
ited, try to merge |
1926 // tabs from the other activity instance. | 1926 // tabs from the other activity instance. |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2046 if (info.id == sMergedInstanceTaskId) return true; | 2046 if (info.id == sMergedInstanceTaskId) return true; |
2047 } | 2047 } |
2048 return false; | 2048 return false; |
2049 } | 2049 } |
2050 | 2050 |
2051 @Override | 2051 @Override |
2052 public boolean supportsFullscreenActivity() { | 2052 public boolean supportsFullscreenActivity() { |
2053 return true; | 2053 return true; |
2054 } | 2054 } |
2055 } | 2055 } |
OLD | NEW |