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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaSessionTabHelper.java

Issue 1357563002: Expose FormatUrlForSecurityDisplay to Java on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Using a fake scheme in the test makes formatUrlForSecurityDisplay be conservative, breaking the tes… Created 5 years, 3 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 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.media.ui; 5 package org.chromium.chrome.browser.media.ui;
6 6
7 import org.chromium.base.ApplicationStatus; 7 import org.chromium.base.ApplicationStatus;
8 import org.chromium.base.Log; 8 import org.chromium.base.Log;
9 import org.chromium.chrome.browser.UrlUtilities; 9 import org.chromium.chrome.browser.UrlUtilities;
10 import org.chromium.chrome.browser.tab.EmptyTabObserver; 10 import org.chromium.chrome.browser.tab.EmptyTabObserver;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 @Override 62 @Override
63 public void mediaSessionStateChanged(boolean isControllable, boolean isPaused) { 63 public void mediaSessionStateChanged(boolean isControllable, boolean isPaused) {
64 assert mTab != null; 64 assert mTab != null;
65 if (!isControllable) { 65 if (!isControllable) {
66 NotificationMediaPlaybackControls.hide(mTab.getId()); 66 NotificationMediaPlaybackControls.hide(mTab.getId());
67 return; 67 return;
68 } 68 }
69 String origin = mTab.getUrl(); 69 String origin = mTab.getUrl();
70 try { 70 try {
71 origin = UrlUtilities.getOriginForDisplay(new URI(origin), t rue); 71 origin = UrlUtilities.formatUrlForSecurityDisplay(new URI(or igin), true);
72 } catch (URISyntaxException e) { 72 } catch (URISyntaxException e) {
73 Log.e(TAG, "Unable to parse the origin from the URL. " 73 Log.e(TAG, "Unable to parse the origin from the URL. "
74 + "Showing the full URL instead."); 74 + "Showing the full URL instead.");
75 } 75 }
76 NotificationMediaPlaybackControls.show( 76 NotificationMediaPlaybackControls.show(
77 ApplicationStatus.getApplicationContext(), 77 ApplicationStatus.getApplicationContext(),
78 new MediaNotificationInfo( 78 new MediaNotificationInfo(
79 mTab.getTitle(), 79 mTab.getTitle(),
80 isPaused, 80 isPaused,
81 origin, 81 origin,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 127 }
128 128
129 /** 129 /**
130 * Creates the {@link MediaSessionTabHelper} for the given {@link Tab}. 130 * Creates the {@link MediaSessionTabHelper} for the given {@link Tab}.
131 * @param tab the tab to attach the helper to. 131 * @param tab the tab to attach the helper to.
132 */ 132 */
133 public static void createForTab(Tab tab) { 133 public static void createForTab(Tab tab) {
134 new MediaSessionTabHelper(tab); 134 new MediaSessionTabHelper(tab);
135 } 135 }
136 } 136 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698