Chromium Code Reviews| 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.webapps; | 5 package org.chromium.chrome.browser.webapps; |
| 6 | 6 |
| 7 import android.content.Intent; | 7 import android.content.Intent; |
| 8 import android.graphics.Bitmap; | 8 import android.graphics.Bitmap; |
| 9 import android.graphics.Color; | 9 import android.graphics.Color; |
| 10 import android.graphics.drawable.Drawable; | 10 import android.graphics.drawable.Drawable; |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 374 | 374 |
| 375 protected TabObserver createTabObserver() { | 375 protected TabObserver createTabObserver() { |
| 376 return new EmptyTabObserver() { | 376 return new EmptyTabObserver() { |
| 377 | 377 |
| 378 @Override | 378 @Override |
| 379 public void onSSLStateUpdated(Tab tab) { | 379 public void onSSLStateUpdated(Tab tab) { |
| 380 updateUrlBar(); | 380 updateUrlBar(); |
| 381 } | 381 } |
| 382 | 382 |
| 383 @Override | 383 @Override |
| 384 public void onDidStartProvisionalLoadForFrame( | 384 public void onDidStartNavigation( |
| 385 Tab tab, boolean isMainFrame, String validatedUrl) { | 385 Tab tab, String url, boolean isInMainFrame, boolean isErrorP age) { |
| 386 if (isMainFrame) updateUrlBar(); | 386 if (isInMainFrame) updateUrlBar(); |
|
jam
2017/02/07 05:10:32
same comment ToolbarManager.java, I think yo ualso
shaktisahu
2017/02/08 01:00:46
Done.
| |
| 387 } | 387 } |
| 388 | 388 |
| 389 @Override | 389 @Override |
| 390 public void onDidFinishNavigation(Tab tab, String url, boolean isInM ainFrame, | |
| 391 boolean isErrorPage, boolean hasCommitted, boolean isSamePag e, | |
| 392 boolean isFragmentNavigation, Integer pageTransition, int er rorCode, | |
| 393 int httpStatusCode) { | |
| 394 if (hasCommitted && isInMainFrame) updateUrlBar(); | |
| 395 } | |
| 396 | |
| 397 @Override | |
| 390 public void onDidChangeThemeColor(Tab tab, int color) { | 398 public void onDidChangeThemeColor(Tab tab, int color) { |
| 391 if (!isWebappDomain()) return; | 399 if (!isWebappDomain()) return; |
| 392 mBrandColor = color; | 400 mBrandColor = color; |
| 393 updateTaskDescription(); | 401 updateTaskDescription(); |
| 394 } | 402 } |
| 395 | 403 |
| 396 @Override | 404 @Override |
| 397 public void onTitleUpdated(Tab tab) { | 405 public void onTitleUpdated(Tab tab) { |
| 398 if (!isWebappDomain()) return; | 406 if (!isWebappDomain()) return; |
| 399 updateTaskDescription(); | 407 updateTaskDescription(); |
| 400 } | 408 } |
| 401 | 409 |
| 402 @Override | 410 @Override |
| 403 public void onFaviconUpdated(Tab tab, Bitmap icon) { | 411 public void onFaviconUpdated(Tab tab, Bitmap icon) { |
| 404 if (!isWebappDomain()) return; | 412 if (!isWebappDomain()) return; |
| 405 // No need to cache the favicon if there is an icon declared in app manifest. | 413 // No need to cache the favicon if there is an icon declared in app manifest. |
| 406 if (mWebappInfo.icon() != null) return; | 414 if (mWebappInfo.icon() != null) return; |
| 407 if (icon == null) return; | 415 if (icon == null) return; |
| 408 if (mLargestFavicon == null || icon.getWidth() > mLargestFavicon .getWidth() | 416 if (mLargestFavicon == null || icon.getWidth() > mLargestFavicon .getWidth() |
| 409 || icon.getHeight() > mLargestFavicon.getHeight()) { | 417 || icon.getHeight() > mLargestFavicon.getHeight()) { |
| 410 mLargestFavicon = icon; | 418 mLargestFavicon = icon; |
| 411 updateTaskDescription(); | 419 updateTaskDescription(); |
| 412 } | 420 } |
| 413 } | 421 } |
| 414 | 422 |
| 415 @Override | 423 @Override |
| 416 public void onDidNavigateMainFrame(Tab tab, String url, String baseU rl, | |
| 417 boolean isNavigationToDifferentPage, boolean isNavigationInP age, | |
| 418 int statusCode) { | |
| 419 updateUrlBar(); | |
| 420 } | |
| 421 | |
| 422 @Override | |
| 423 public void onDidAttachInterstitialPage(Tab tab) { | 424 public void onDidAttachInterstitialPage(Tab tab) { |
| 424 updateUrlBar(); | 425 updateUrlBar(); |
| 425 | 426 |
| 426 int state = ApplicationStatus.getStateForActivity(WebappActivity .this); | 427 int state = ApplicationStatus.getStateForActivity(WebappActivity .this); |
| 427 if (state == ActivityState.PAUSED || state == ActivityState.STOP PED | 428 if (state == ActivityState.PAUSED || state == ActivityState.STOP PED |
| 428 || state == ActivityState.DESTROYED) { | 429 || state == ActivityState.DESTROYED) { |
| 429 return; | 430 return; |
| 430 } | 431 } |
| 431 | 432 |
| 432 // Kick the interstitial navigation to Chrome. | 433 // Kick the interstitial navigation to Chrome. |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 583 return new WebappDelegateFactory(this); | 584 return new WebappDelegateFactory(this); |
| 584 } | 585 } |
| 585 | 586 |
| 586 // We're temporarily disable CS on webapp since there are some issues. (http ://crbug.com/471950) | 587 // We're temporarily disable CS on webapp since there are some issues. (http ://crbug.com/471950) |
| 587 // TODO(changwan): re-enable it once the issues are resolved. | 588 // TODO(changwan): re-enable it once the issues are resolved. |
| 588 @Override | 589 @Override |
| 589 protected boolean isContextualSearchAllowed() { | 590 protected boolean isContextualSearchAllowed() { |
| 590 return false; | 591 return false; |
| 591 } | 592 } |
| 592 } | 593 } |
| OLD | NEW |