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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser;
6
7 import android.app.Activity;
8 import android.app.Dialog;
9
10 import com.google.android.gms.common.GooglePlayServicesUtil;
11
12 import org.chromium.chrome.browser.infobar.MessageInfoBar;
13 import org.chromium.ui.base.ActivityWindowAndroid;
14
15 /**
16 * The window that has access to the main activity and is able to create and rec eive intents,
17 * and show error messages.
18 */
19 public class ChromeWindow extends ActivityWindowAndroid {
20 /**
21 * Creates Chrome specific ActivityWindowAndroid.
22 * @param activity The activity that owns the ChromeWindow.
23 */
24 public ChromeWindow(ChromeActivity activity) {
25 super(activity);
26 }
27
28 /**
29 * @see GooglePlayServicesUtil#getErrorDialog(int, Activity, int)
30 */
31 public Dialog getGooglePlayServicesErrorDialog(int errorCode, int requestCod e) {
32 return GooglePlayServicesUtil.getErrorDialog(errorCode, getActivity().ge t(), requestCode);
33 }
34
35 /**
36 * Shows an infobar error message overriding the WindowAndroid implementatio n.
37 */
38 @Override
39 protected void showCallbackNonExistentError(String error) {
40 Activity activity = getActivity().get();
41
42 // We can assume that activity is a ChromeActivity because we require on e to be passed in
43 // in the constructor.
44 Tab tab = activity != null ? ((ChromeActivity) activity).getActivityTab( ) : null;
45
46 if (tab != null) {
47 String message = (error);
48 MessageInfoBar infobar = new MessageInfoBar(message);
49 infobar.setExpireOnNavigation(false);
50 tab.getInfoBarContainer().addInfoBar(infobar);
51 } else {
52 super.showCallbackNonExistentError(error);
53 }
54 }
55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698