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.toolbar; | 5 package org.chromium.chrome.browser.toolbar; |
6 | 6 |
7 import android.animation.Animator; | 7 import android.animation.Animator; |
8 import android.animation.AnimatorListenerAdapter; | 8 import android.animation.AnimatorListenerAdapter; |
9 import android.animation.AnimatorSet; | 9 import android.animation.AnimatorSet; |
10 import android.annotation.SuppressLint; | 10 import android.annotation.SuppressLint; |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 // Ensure the the popup is not shown after resuming activity from backgr
ound. | 258 // Ensure the the popup is not shown after resuming activity from backgr
ound. |
259 if (hasWindowFocus && mNavigationPopup != null) { | 259 if (hasWindowFocus && mNavigationPopup != null) { |
260 mNavigationPopup.dismiss(); | 260 mNavigationPopup.dismiss(); |
261 mNavigationPopup = null; | 261 mNavigationPopup = null; |
262 } | 262 } |
263 super.onWindowFocusChanged(hasWindowFocus); | 263 super.onWindowFocusChanged(hasWindowFocus); |
264 } | 264 } |
265 | 265 |
266 private void displayNavigationPopup(boolean isForward, View anchorView) { | 266 private void displayNavigationPopup(boolean isForward, View anchorView) { |
267 Tab tab = getToolbarDataProvider().getTab(); | 267 Tab tab = getToolbarDataProvider().getTab(); |
268 if (tab == null || tab.getNavigationHandler() == null) return; | 268 if (tab == null || tab.getWebContents() == null) return; |
269 mNavigationPopup = new NavigationPopup( | 269 mNavigationPopup = new NavigationPopup(tab.getProfile(), getContext(), |
270 tab.getProfile(), getContext(), tab.getNavigationHandler(), isFo
rward); | 270 tab.getWebContents().getNavigationController(), isForward); |
271 | 271 |
272 mNavigationPopup.setAnchorView(anchorView); | 272 mNavigationPopup.setAnchorView(anchorView); |
273 | 273 |
274 int menuWidth = getResources().getDimensionPixelSize(R.dimen.menu_width)
; | 274 int menuWidth = getResources().getDimensionPixelSize(R.dimen.menu_width)
; |
275 mNavigationPopup.setWidth(menuWidth); | 275 mNavigationPopup.setWidth(menuWidth); |
276 | 276 |
277 if (mNavigationPopup.shouldBeShown()) mNavigationPopup.show(); | 277 if (mNavigationPopup.shouldBeShown()) mNavigationPopup.show(); |
278 } | 278 } |
279 | 279 |
280 @Override | 280 @Override |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 } | 628 } |
629 | 629 |
630 mButtonVisibilityAnimators = null; | 630 mButtonVisibilityAnimators = null; |
631 } | 631 } |
632 }); | 632 }); |
633 | 633 |
634 return set; | 634 return set; |
635 } | 635 } |
636 | 636 |
637 } | 637 } |
OLD | NEW |