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.compositor.bottombar.readermode; | 5 package org.chromium.chrome.browser.compositor.bottombar.readermode; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.graphics.RectF; | 9 import android.graphics.RectF; |
10 | 10 |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 mStartTime = System.currentTimeMillis(); | 260 mStartTime = System.currentTimeMillis(); |
261 mTimerRunning = true; | 261 mTimerRunning = true; |
262 if (mManagerDelegate != null && mManagerDelegate.getBasePageWebConte
nts() != null) { | 262 if (mManagerDelegate != null && mManagerDelegate.getBasePageWebConte
nts() != null) { |
263 String url = mManagerDelegate.getBasePageWebContents().getUrl(); | 263 String url = mManagerDelegate.getBasePageWebContents().getUrl(); |
264 RapporServiceBridge.sampleDomainAndRegistryFromURL( | 264 RapporServiceBridge.sampleDomainAndRegistryFromURL( |
265 "DomDistiller.OpenPanel", url); | 265 "DomDistiller.OpenPanel", url); |
266 } | 266 } |
267 } else if (mTimerRunning && !animatingToOpenState) { | 267 } else if (mTimerRunning && !animatingToOpenState) { |
268 onTimerEnded(); | 268 onTimerEnded(); |
269 } | 269 } |
270 | |
271 if (getPanelState() == PanelState.PEEKED) { | |
272 mManagerDelegate.onPeek(); | |
273 } | |
274 } | 270 } |
275 | 271 |
276 @Override | 272 @Override |
277 public void peekPanel(StateChangeReason reason) { | 273 public void peekPanel(StateChangeReason reason) { |
278 super.peekPanel(reason); | 274 super.peekPanel(reason); |
279 if (mManagerDelegate == null) return; | 275 if (mManagerDelegate == null) return; |
280 mManagerDelegate.onPanelShown(); | 276 mManagerDelegate.onPanelShown(); |
281 } | 277 } |
282 | 278 |
283 @Override | 279 @Override |
(...skipping 30 matching lines...) Expand all Loading... |
314 // This will cause the reader mode bar to behave like the browser contro
ls; sliding out of | 310 // This will cause the reader mode bar to behave like the browser contro
ls; sliding out of |
315 // view as the page scrolls. | 311 // view as the page scrolls. |
316 return super.getOffsetY() + (shouldAutoHide ? getBrowserControlsOffsetDp
() : 0.0f); | 312 return super.getOffsetY() + (shouldAutoHide ? getBrowserControlsOffsetDp
() : 0.0f); |
317 } | 313 } |
318 | 314 |
319 @Override | 315 @Override |
320 public void onLayoutChanged(float width, float height, float visibleViewport
OffsetY) { | 316 public void onLayoutChanged(float width, float height, float visibleViewport
OffsetY) { |
321 if (width != getWidth()) destroyReaderModeBarControl(); | 317 if (width != getWidth()) destroyReaderModeBarControl(); |
322 | 318 |
323 super.onLayoutChanged(width, height, visibleViewportOffsetY); | 319 super.onLayoutChanged(width, height, visibleViewportOffsetY); |
324 | |
325 if (mManagerDelegate != null) { | |
326 mManagerDelegate.onLayoutChanged(); | |
327 } | |
328 } | 320 } |
329 | 321 |
330 @Override | 322 @Override |
331 protected float calculateBasePageDesiredOffset() { | 323 protected float calculateBasePageDesiredOffset() { |
332 return -getToolbarHeight(); | 324 return -getToolbarHeight(); |
333 } | 325 } |
334 | 326 |
335 @Override | 327 @Override |
336 public void onActivityStateChange(Activity activity, int newState) { | 328 public void onActivityStateChange(Activity activity, int newState) { |
337 // If the activity is only resuming, don't do anything. | 329 // If the activity is only resuming, don't do anything. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 /** | 364 /** |
373 * Destroys the ReaderModeBarControl. | 365 * Destroys the ReaderModeBarControl. |
374 */ | 366 */ |
375 protected void destroyReaderModeBarControl() { | 367 protected void destroyReaderModeBarControl() { |
376 if (mReaderModeBarControl != null) { | 368 if (mReaderModeBarControl != null) { |
377 mReaderModeBarControl.destroy(); | 369 mReaderModeBarControl.destroy(); |
378 mReaderModeBarControl = null; | 370 mReaderModeBarControl = null; |
379 } | 371 } |
380 } | 372 } |
381 } | 373 } |
OLD | NEW |