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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/WebsiteSettingsPopup.java

Issue 1100283002: Add connection info popup within Page Info on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Close WebsiteSettingsPopup when opening ConnectionInfoPopup Created 5 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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.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.animation.ObjectAnimator; 10 import android.animation.ObjectAnimator;
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 mDeprecatedSHA1Present = ToolbarModel.isDeprecatedSHA1Present(mWebConten ts); 376 mDeprecatedSHA1Present = ToolbarModel.isDeprecatedSHA1Present(mWebConten ts);
377 377
378 SpannableStringBuilder urlBuilder = new SpannableStringBuilder(mFullUrl) ; 378 SpannableStringBuilder urlBuilder = new SpannableStringBuilder(mFullUrl) ;
379 OmniboxUrlEmphasizer.emphasizeUrl(urlBuilder, mContext.getResources(), m Profile, 379 OmniboxUrlEmphasizer.emphasizeUrl(urlBuilder, mContext.getResources(), m Profile,
380 mSecurityLevel, mIsInternalPage, true); 380 mSecurityLevel, mIsInternalPage, true);
381 mUrlTitle.setText(urlBuilder); 381 mUrlTitle.setText(urlBuilder);
382 382
383 // Set the URL connection message now, and the URL after layout (so it 383 // Set the URL connection message now, and the URL after layout (so it
384 // can calculate its ideal height). 384 // can calculate its ideal height).
385 mUrlConnectionMessage.setText(getUrlConnectionMessage()); 385 mUrlConnectionMessage.setText(getUrlConnectionMessage());
386 if (isConnectionDetailsLinkVisible()) mUrlConnectionMessage.setOnClickLi stener(this);
386 } 387 }
387 388
388 /** 389 /**
389 * Sets the visibility of the lower area of the dialog (containing the permi ssions and 'Site 390 * Sets the visibility of the lower area of the dialog (containing the permi ssions and 'Site
390 * Settings' button). 391 * Settings' button).
391 * 392 *
392 * @param isVisible Whether to show or hide the dialog area. 393 * @param isVisible Whether to show or hide the dialog area.
393 */ 394 */
394 private void setVisibilityOfLowerDialogArea(boolean isVisible) { 395 private void setVisibilityOfLowerDialogArea(boolean isVisible) {
395 mHorizontalSeparator.setVisibility(isVisible ? View.VISIBLE : View.GONE) ; 396 mHorizontalSeparator.setVisibility(isVisible ? View.VISIBLE : View.GONE) ;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 case ToolbarModelSecurityLevel.SECURITY_WARNING: 448 case ToolbarModelSecurityLevel.SECURITY_WARNING:
448 case ToolbarModelSecurityLevel.SECURITY_POLICY_WARNING: 449 case ToolbarModelSecurityLevel.SECURITY_POLICY_WARNING:
449 return R.string.page_info_connection_mixed; 450 return R.string.page_info_connection_mixed;
450 default: 451 default:
451 assert false : "Invalid security level specified: " + toolbarMod elSecurityLevel; 452 assert false : "Invalid security level specified: " + toolbarMod elSecurityLevel;
452 return R.string.page_info_connection_http; 453 return R.string.page_info_connection_http;
453 } 454 }
454 } 455 }
455 456
456 /** 457 /**
458 * Whether to show a 'Details' link to the connection info popup. The link i s only shown for
459 * HTTPS connections.
460 */
461 private boolean isConnectionDetailsLinkVisible() {
462 return !mIsInternalPage && mSecurityLevel != ToolbarModelSecurityLevel.N ONE;
463 }
464
465 /**
457 * Gets the styled connection message to display below the URL. 466 * Gets the styled connection message to display below the URL.
458 */ 467 */
459 private Spannable getUrlConnectionMessage() { 468 private Spannable getUrlConnectionMessage() {
460 // Display the appropriate connection message. 469 // Display the appropriate connection message.
461 SpannableStringBuilder messageBuilder = new SpannableStringBuilder(); 470 SpannableStringBuilder messageBuilder = new SpannableStringBuilder();
462 if (mDeprecatedSHA1Present) { 471 if (mDeprecatedSHA1Present) {
463 messageBuilder.append( 472 messageBuilder.append(
464 mContext.getResources().getString(R.string.page_info_connect ion_sha1)); 473 mContext.getResources().getString(R.string.page_info_connect ion_sha1));
465 } else if (mSecurityLevel != ToolbarModelSecurityLevel.SECURITY_ERROR) { 474 } else if (mSecurityLevel != ToolbarModelSecurityLevel.SECURITY_ERROR) {
466 messageBuilder.append(mContext.getResources().getString( 475 messageBuilder.append(mContext.getResources().getString(
(...skipping 14 matching lines...) Expand all
481 R.string.page_info_connection_broken_following_text, originT oDisplay); 490 R.string.page_info_connection_broken_following_text, originT oDisplay);
482 messageBuilder.append(leadingText + " " + followingText); 491 messageBuilder.append(leadingText + " " + followingText);
483 final ForegroundColorSpan redSpan = new ForegroundColorSpan(mContext .getResources() 492 final ForegroundColorSpan redSpan = new ForegroundColorSpan(mContext .getResources()
484 .getColor(R.color.website_settings_connection_broken_leading _text)); 493 .getColor(R.color.website_settings_connection_broken_leading _text));
485 final StyleSpan boldSpan = new StyleSpan(android.graphics.Typeface.B OLD); 494 final StyleSpan boldSpan = new StyleSpan(android.graphics.Typeface.B OLD);
486 messageBuilder.setSpan(redSpan, 0, leadingText.length(), 495 messageBuilder.setSpan(redSpan, 0, leadingText.length(),
487 Spannable.SPAN_INCLUSIVE_EXCLUSIVE); 496 Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
488 messageBuilder.setSpan(boldSpan, 0, leadingText.length(), 497 messageBuilder.setSpan(boldSpan, 0, leadingText.length(),
489 Spannable.SPAN_INCLUSIVE_EXCLUSIVE); 498 Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
490 } 499 }
500
501 if (isConnectionDetailsLinkVisible()) {
502 String detailsText = mContext.getResources().getString(R.string.page _info_details_link);
503 messageBuilder.append(" ");
Ted C 2015/04/27 19:04:01 I "assume" this is fine since we do similar things
504 int start = messageBuilder.length();
505 messageBuilder.append(detailsText);
506 final ForegroundColorSpan blueSpan = new ForegroundColorSpan(
507 mContext.getResources().getColor(R.color.website_settings_po pup_text_link));
Ted C 2015/04/27 19:04:01 can the span not be applied prior to appending the
tsergeant 2015/04/28 03:15:00 Done.
508 messageBuilder.setSpan(
509 blueSpan, start, messageBuilder.length(), Spannable.SPAN_INC LUSIVE_EXCLUSIVE);
510 }
511
491 return messageBuilder; 512 return messageBuilder;
492 } 513 }
493 514
494 /** 515 /**
495 * Adds a new row for the given permission. 516 * Adds a new row for the given permission.
496 * 517 *
497 * @param name The title of the permission to display to the user. 518 * @param name The title of the permission to display to the user.
498 * @param type The ContentSettingsType of the permission. 519 * @param type The ContentSettingsType of the permission.
499 * @param currentSetting The ContentSetting of the currently selected settin g. 520 * @param currentSetting The ContentSetting of the currently selected settin g.
500 */ 521 */
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 if (view == mCopyUrlButton) { 623 if (view == mCopyUrlButton) {
603 new Clipboard(mContext).setText(mFullUrl, mFullUrl); 624 new Clipboard(mContext).setText(mFullUrl, mFullUrl);
604 mDialog.dismiss(); 625 mDialog.dismiss();
605 } else if (view == mSiteSettingsButton) { 626 } else if (view == mSiteSettingsButton) {
606 // TODO(sashab,finnur): Make this open the Website Settings dialog. 627 // TODO(sashab,finnur): Make this open the Website Settings dialog.
607 assert false : "No Website Settings here!"; 628 assert false : "No Website Settings here!";
608 mDialog.dismiss(); 629 mDialog.dismiss();
609 } else if (view == mUrlTitle) { 630 } else if (view == mUrlTitle) {
610 // Expand/collapse the displayed URL title. 631 // Expand/collapse the displayed URL title.
611 mUrlTitle.toggleTruncation(); 632 mUrlTitle.toggleTruncation();
633 } else if (view == mUrlConnectionMessage) {
634 if (DeviceFormFactor.isTablet(mContext)) {
635 ConnectionInfoPopup.show(mContext, mWebContents);
636 } else {
637 // Delay while the WebsiteSettingsPopup closes.
638 mContainer.postDelayed(new Runnable() {
639 @Override
640 public void run() {
641 ConnectionInfoPopup.show(mContext, mWebContents);
642 }
643 }, FADE_DURATION + CLOSE_CLEANUP_DELAY);
644 }
645 mDialog.dismiss();
612 } 646 }
613 } 647 }
614 648
615 /** 649 /**
616 * Create a list of all the views which we want to individually fade in. 650 * Create a list of all the views which we want to individually fade in.
617 */ 651 */
618 private List<View> collectAnimatableViews() { 652 private List<View> collectAnimatableViews() {
619 List<View> animatableViews = new ArrayList<View>(); 653 List<View> animatableViews = new ArrayList<View>();
620 animatableViews.add(mUrlTitle); 654 animatableViews.add(mUrlTitle);
621 animatableViews.add(mUrlConnectionMessage); 655 animatableViews.add(mUrlConnectionMessage);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 new WebsiteSettingsPopup(context, profile, webContents); 751 new WebsiteSettingsPopup(context, profile, webContents);
718 } 752 }
719 753
720 private static native long nativeInit(WebsiteSettingsPopup popup, WebContent s webContents); 754 private static native long nativeInit(WebsiteSettingsPopup popup, WebContent s webContents);
721 755
722 private native void nativeDestroy(long nativeWebsiteSettingsPopupAndroid); 756 private native void nativeDestroy(long nativeWebsiteSettingsPopupAndroid);
723 757
724 private native void nativeOnPermissionSettingChanged(long nativeWebsiteSetti ngsPopupAndroid, 758 private native void nativeOnPermissionSettingChanged(long nativeWebsiteSetti ngsPopupAndroid,
725 int type, int setting); 759 int type, int setting);
726 } 760 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698