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

Unified Diff: chrome/android/java_staging/src/org/chromium/chrome/browser/ChromeWindow.java

Issue 1141283003: Upstream oodles of Chrome for Android code into Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: final patch? Created 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/java_staging/src/org/chromium/chrome/browser/ChromeWindow.java
diff --git a/chrome/android/java_staging/src/org/chromium/chrome/browser/ChromeWindow.java b/chrome/android/java_staging/src/org/chromium/chrome/browser/ChromeWindow.java
new file mode 100644
index 0000000000000000000000000000000000000000..7186c6f2a892a4ad457dfee02458cb0982d5f660
--- /dev/null
+++ b/chrome/android/java_staging/src/org/chromium/chrome/browser/ChromeWindow.java
@@ -0,0 +1,55 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser;
+
+import android.app.Activity;
+import android.app.Dialog;
+
+import com.google.android.gms.common.GooglePlayServicesUtil;
+
+import org.chromium.chrome.browser.infobar.MessageInfoBar;
+import org.chromium.ui.base.ActivityWindowAndroid;
+
+/**
+ * The window that has access to the main activity and is able to create and receive intents,
+ * and show error messages.
+ */
+public class ChromeWindow extends ActivityWindowAndroid {
+ /**
+ * Creates Chrome specific ActivityWindowAndroid.
+ * @param activity The activity that owns the ChromeWindow.
+ */
+ public ChromeWindow(ChromeActivity activity) {
+ super(activity);
+ }
+
+ /**
+ * @see GooglePlayServicesUtil#getErrorDialog(int, Activity, int)
+ */
+ public Dialog getGooglePlayServicesErrorDialog(int errorCode, int requestCode) {
+ return GooglePlayServicesUtil.getErrorDialog(errorCode, getActivity().get(), requestCode);
+ }
+
+ /**
+ * Shows an infobar error message overriding the WindowAndroid implementation.
+ */
+ @Override
+ protected void showCallbackNonExistentError(String error) {
+ Activity activity = getActivity().get();
+
+ // We can assume that activity is a ChromeActivity because we require one to be passed in
+ // in the constructor.
+ Tab tab = activity != null ? ((ChromeActivity) activity).getActivityTab() : null;
+
+ if (tab != null) {
+ String message = (error);
+ MessageInfoBar infobar = new MessageInfoBar(message);
+ infobar.setExpireOnNavigation(false);
+ tab.getInfoBarContainer().addInfoBar(infobar);
+ } else {
+ super.showCallbackNonExistentError(error);
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698