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

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

Issue 2866273003: [Android] Improve sad tab strings (Closed)
Patch Set: Fix spacing Created 3 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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.tab; 5 package org.chromium.chrome.browser.tab;
6 6
7 import android.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.app.Activity; 8 import android.app.Activity;
9 import android.app.Application; 9 import android.app.Application;
10 import android.content.Context; 10 import android.content.Context;
(...skipping 1677 matching lines...) Expand 10 before | Expand all | Expand 10 after
1688 if (getInterceptNavigationDelegate() != null) { 1688 if (getInterceptNavigationDelegate() != null) {
1689 getInterceptNavigationDelegate().maybeUpdateNavigationHistory(); 1689 getInterceptNavigationDelegate().maybeUpdateNavigationHistory();
1690 } 1690 }
1691 } 1691 }
1692 1692
1693 /** 1693 /**
1694 * Constructs and shows a sad tab (Aw, Snap!). 1694 * Constructs and shows a sad tab (Aw, Snap!).
1695 */ 1695 */
1696 protected void showSadTab() { 1696 protected void showSadTab() {
1697 if (getContentViewCore() != null) { 1697 if (getContentViewCore() != null) {
1698 // If the tab has crashed twice in a row change the sad tab view to the "Send Feedback"
1699 // version and change the onClickListener.
1700 final boolean showSendFeedbackView = mSadTabSuccessiveRefreshCounter >= 1;
1701
1698 OnClickListener suggestionAction = new OnClickListener() { 1702 OnClickListener suggestionAction = new OnClickListener() {
1699 @Override 1703 @Override
1700 public void onClick(View view) { 1704 public void onClick(View view) {
1705 SadTabViewFactory.recordEvent(showSendFeedbackView,
1706 SadTabViewFactory.SAD_TAB_EVENT_HELP_LINK_CLICKED);
1707
1701 Activity activity = mWindowAndroid.getActivity().get(); 1708 Activity activity = mWindowAndroid.getActivity().get();
1702 assert activity != null; 1709 assert activity != null;
1703 HelpAndFeedback.getInstance(activity).show(activity, 1710 HelpAndFeedback.getInstance(activity).show(activity,
1704 activity.getString(R.string.help_context_sad_tab), 1711 activity.getString(R.string.help_context_sad_tab),
1705 Profile.getLastUsedProfile(), null); 1712 Profile.getLastUsedProfile(), null);
1706 } 1713 }
1707 }; 1714 };
1708 1715
1709 // If the tab has crashed twice in a row change the button to "Send Feedback" and
1710 // change the onClickListener.
1711 final boolean showSendFeedbackButton = mSadTabSuccessiveRefreshCount er >= 1;
1712 OnClickListener buttonAction = new OnClickListener() { 1716 OnClickListener buttonAction = new OnClickListener() {
1713
1714 @Override 1717 @Override
1715 public void onClick(View v) { 1718 public void onClick(View v) {
1716 if (showSendFeedbackButton) { 1719 SadTabViewFactory.recordEvent(
1720 showSendFeedbackView, SadTabViewFactory.SAD_TAB_EVEN T_BUTTON_CLICKED);
1721 if (showSendFeedbackView) {
1717 getActivity().startHelpAndFeedback(Tab.this, "MobileSadT abFeedback"); 1722 getActivity().startHelpAndFeedback(Tab.this, "MobileSadT abFeedback");
1718 } else { 1723 } else {
1719 reload(); 1724 reload();
1720 } 1725 }
1721 } 1726 }
1722 }; 1727 };
1723 1728
1724 // Make sure we are not adding the "Aw, snap" view over an existing one. 1729 // Make sure we are not adding the "Aw, snap" view over an existing one.
1725 assert mSadTabView == null; 1730 assert mSadTabView == null;
1726 1731
1727 mSadTabView = SadTabViewFactory.createSadTabView(mThemedApplicationC ontext, 1732 mSadTabView = SadTabViewFactory.createSadTabView(mThemedApplicationC ontext,
1728 suggestionAction, buttonAction, showSendFeedbackButton 1733 suggestionAction, buttonAction, showSendFeedbackView);
1729 ? R.string.sad_tab_send_feedback_label : R.string.sa d_tab_reload_label);
1730 mSadTabSuccessiveRefreshCounter++; 1734 mSadTabSuccessiveRefreshCounter++;
1731 // Show the sad tab inside ContentView. 1735 // Show the sad tab inside ContentView.
1732 getContentViewCore().getContainerView().addView( 1736 getContentViewCore().getContainerView().addView(
1733 mSadTabView, new FrameLayout.LayoutParams( 1737 mSadTabView, new FrameLayout.LayoutParams(
1734 LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT )); 1738 LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT ));
1735 notifyContentChanged(); 1739 notifyContentChanged();
1740
1741 SadTabViewFactory.recordEvent(
1742 showSendFeedbackView, SadTabViewFactory.SAD_TAB_EVENT_DISPLA YED);
1736 } 1743 }
1737 FullscreenManager fullscreenManager = getFullscreenManager(); 1744 FullscreenManager fullscreenManager = getFullscreenManager();
1738 if (fullscreenManager != null) { 1745 if (fullscreenManager != null) {
1739 fullscreenManager.setPositionsForTabToNonFullscreen(); 1746 fullscreenManager.setPositionsForTabToNonFullscreen();
1740 } 1747 }
1741 } 1748 }
1742 1749
1743 /** 1750 /**
1744 * Removes the sad tab view if present. 1751 * Removes the sad tab view if present.
1745 */ 1752 */
(...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after
3071 private native void nativeLoadOriginalImage(long nativeTabAndroid); 3078 private native void nativeLoadOriginalImage(long nativeTabAndroid);
3072 private native long nativeGetBookmarkId(long nativeTabAndroid, boolean onlyE ditable); 3079 private native long nativeGetBookmarkId(long nativeTabAndroid, boolean onlyE ditable);
3073 private native void nativeSetInterceptNavigationDelegate(long nativeTabAndro id, 3080 private native void nativeSetInterceptNavigationDelegate(long nativeTabAndro id,
3074 InterceptNavigationDelegate delegate); 3081 InterceptNavigationDelegate delegate);
3075 private native void nativeAttachToTabContentManager(long nativeTabAndroid, 3082 private native void nativeAttachToTabContentManager(long nativeTabAndroid,
3076 TabContentManager tabContentManager); 3083 TabContentManager tabContentManager);
3077 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String url); 3084 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String url);
3078 private native void nativeSetWebappManifestScope(long nativeTabAndroid, Stri ng scope); 3085 private native void nativeSetWebappManifestScope(long nativeTabAndroid, Stri ng scope);
3079 private native void nativeEnableEmbeddedMediaExperience(long nativeTabAndroi d, boolean enabled); 3086 private native void nativeEnableEmbeddedMediaExperience(long nativeTabAndroi d, boolean enabled);
3080 } 3087 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698