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

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: Remove extraneous line 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;
11 import android.content.Intent; 11 import android.content.Intent;
12 import android.content.res.Resources; 12 import android.content.res.Resources;
13 import android.graphics.Bitmap; 13 import android.graphics.Bitmap;
14 import android.graphics.Color; 14 import android.graphics.Color;
15 import android.graphics.Rect; 15 import android.graphics.Rect;
16 import android.net.Uri; 16 import android.net.Uri;
17 import android.os.Bundle; 17 import android.os.Bundle;
18 import android.provider.Browser; 18 import android.provider.Browser;
19 import android.support.annotation.Nullable; 19 import android.support.annotation.Nullable;
20 import android.support.v4.view.ViewCompat; 20 import android.support.v4.view.ViewCompat;
21 import android.text.TextUtils; 21 import android.text.TextUtils;
22 import android.util.Log; 22 import android.util.Log;
23 import android.view.ContextThemeWrapper; 23 import android.view.ContextThemeWrapper;
24 import android.view.View; 24 import android.view.View;
25 import android.view.View.OnClickListener;
26 import android.view.ViewGroup; 25 import android.view.ViewGroup;
27 import android.view.accessibility.AccessibilityEvent; 26 import android.view.accessibility.AccessibilityEvent;
28 import android.widget.FrameLayout; 27 import android.widget.FrameLayout;
29 import android.widget.FrameLayout.LayoutParams; 28 import android.widget.FrameLayout.LayoutParams;
30 29
31 import org.chromium.base.ApiCompatibilityUtils; 30 import org.chromium.base.ApiCompatibilityUtils;
32 import org.chromium.base.ApplicationStatus; 31 import org.chromium.base.ApplicationStatus;
33 import org.chromium.base.ContextUtils; 32 import org.chromium.base.ContextUtils;
34 import org.chromium.base.ObserverList; 33 import org.chromium.base.ObserverList;
35 import org.chromium.base.ObserverList.RewindableIterator; 34 import org.chromium.base.ObserverList.RewindableIterator;
(...skipping 1652 matching lines...) Expand 10 before | Expand all | Expand 10 after
1688 if (getInterceptNavigationDelegate() != null) { 1687 if (getInterceptNavigationDelegate() != null) {
1689 getInterceptNavigationDelegate().maybeUpdateNavigationHistory(); 1688 getInterceptNavigationDelegate().maybeUpdateNavigationHistory();
1690 } 1689 }
1691 } 1690 }
1692 1691
1693 /** 1692 /**
1694 * Constructs and shows a sad tab (Aw, Snap!). 1693 * Constructs and shows a sad tab (Aw, Snap!).
1695 */ 1694 */
1696 protected void showSadTab() { 1695 protected void showSadTab() {
1697 if (getContentViewCore() != null) { 1696 if (getContentViewCore() != null) {
1698 OnClickListener suggestionAction = new OnClickListener() { 1697 // If the tab has crashed twice in a row change the sad tab view to the "Send Feedback"
1698 // version and change the onClickListener.
1699 final boolean showSendFeedbackView = mSadTabSuccessiveRefreshCounter >= 1;
1700
1701 Runnable suggestionAction = new Runnable() {
1699 @Override 1702 @Override
1700 public void onClick(View view) { 1703 public void run() {
1701 Activity activity = mWindowAndroid.getActivity().get(); 1704 Activity activity = mWindowAndroid.getActivity().get();
1702 assert activity != null; 1705 assert activity != null;
1703 HelpAndFeedback.getInstance(activity).show(activity, 1706 HelpAndFeedback.getInstance(activity).show(activity,
1704 activity.getString(R.string.help_context_sad_tab), 1707 activity.getString(R.string.help_context_sad_tab),
1705 Profile.getLastUsedProfile(), null); 1708 Profile.getLastUsedProfile(), null);
1706 } 1709 }
1707 }; 1710 };
1708 1711
1709 // If the tab has crashed twice in a row change the button to "Send Feedback" and 1712 Runnable buttonAction = new Runnable() {
1710 // change the onClickListener.
1711 final boolean showSendFeedbackButton = mSadTabSuccessiveRefreshCount er >= 1;
1712 OnClickListener buttonAction = new OnClickListener() {
1713
1714 @Override 1713 @Override
1715 public void onClick(View v) { 1714 public void run() {
1716 if (showSendFeedbackButton) { 1715 if (showSendFeedbackView) {
1717 getActivity().startHelpAndFeedback(Tab.this, "MobileSadT abFeedback"); 1716 getActivity().startHelpAndFeedback(Tab.this, "MobileSadT abFeedback");
1718 } else { 1717 } else {
1719 reload(); 1718 reload();
1720 } 1719 }
1721 } 1720 }
1722 }; 1721 };
1723 1722
1724 // Make sure we are not adding the "Aw, snap" view over an existing one. 1723 // Make sure we are not adding the "Aw, snap" view over an existing one.
1725 assert mSadTabView == null; 1724 assert mSadTabView == null;
1726 1725
1727 mSadTabView = SadTabViewFactory.createSadTabView(mThemedApplicationC ontext, 1726 mSadTabView = SadTabViewFactory.createSadTabView(mThemedApplicationC ontext,
1728 suggestionAction, buttonAction, showSendFeedbackButton 1727 suggestionAction, buttonAction, showSendFeedbackView);
1729 ? R.string.sad_tab_send_feedback_label : R.string.sa d_tab_reload_label);
1730 mSadTabSuccessiveRefreshCounter++; 1728 mSadTabSuccessiveRefreshCounter++;
1731 // Show the sad tab inside ContentView. 1729 // Show the sad tab inside ContentView.
1732 getContentViewCore().getContainerView().addView( 1730 getContentViewCore().getContainerView().addView(
1733 mSadTabView, new FrameLayout.LayoutParams( 1731 mSadTabView, new FrameLayout.LayoutParams(
1734 LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT )); 1732 LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT ));
1735 notifyContentChanged(); 1733 notifyContentChanged();
1736 } 1734 }
1737 FullscreenManager fullscreenManager = getFullscreenManager(); 1735 FullscreenManager fullscreenManager = getFullscreenManager();
1738 if (fullscreenManager != null) { 1736 if (fullscreenManager != null) {
1739 fullscreenManager.setPositionsForTabToNonFullscreen(); 1737 fullscreenManager.setPositionsForTabToNonFullscreen();
(...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after
3071 private native void nativeLoadOriginalImage(long nativeTabAndroid); 3069 private native void nativeLoadOriginalImage(long nativeTabAndroid);
3072 private native long nativeGetBookmarkId(long nativeTabAndroid, boolean onlyE ditable); 3070 private native long nativeGetBookmarkId(long nativeTabAndroid, boolean onlyE ditable);
3073 private native void nativeSetInterceptNavigationDelegate(long nativeTabAndro id, 3071 private native void nativeSetInterceptNavigationDelegate(long nativeTabAndro id,
3074 InterceptNavigationDelegate delegate); 3072 InterceptNavigationDelegate delegate);
3075 private native void nativeAttachToTabContentManager(long nativeTabAndroid, 3073 private native void nativeAttachToTabContentManager(long nativeTabAndroid,
3076 TabContentManager tabContentManager); 3074 TabContentManager tabContentManager);
3077 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String url); 3075 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String url);
3078 private native void nativeSetWebappManifestScope(long nativeTabAndroid, Stri ng scope); 3076 private native void nativeSetWebappManifestScope(long nativeTabAndroid, Stri ng scope);
3079 private native void nativeEnableEmbeddedMediaExperience(long nativeTabAndroi d, boolean enabled); 3077 private native void nativeEnableEmbeddedMediaExperience(long nativeTabAndroi d, boolean enabled);
3080 } 3078 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698