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

Unified Diff: chrome/android/java_staging/src/org/chromium/chrome/browser/ntp/NativePageDialog.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/ntp/NativePageDialog.java
diff --git a/chrome/android/java_staging/src/org/chromium/chrome/browser/ntp/NativePageDialog.java b/chrome/android/java_staging/src/org/chromium/chrome/browser/ntp/NativePageDialog.java
new file mode 100644
index 0000000000000000000000000000000000000000..5da3125204bbcdb2cceb6049c8c4a212bf5009f3
--- /dev/null
+++ b/chrome/android/java_staging/src/org/chromium/chrome/browser/ntp/NativePageDialog.java
@@ -0,0 +1,62 @@
+// 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.ntp;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup.LayoutParams;
+import android.view.WindowManager;
+import android.widget.FrameLayout;
+import android.widget.ImageButton;
+import android.widget.TextView;
+
+import com.google.android.apps.chrome.R;
+
+import org.chromium.chrome.browser.NativePage;
+
+/**
+ * Displays a NativePage in a full screen dialog instead of like a regular Chrome page.
+ */
+public class NativePageDialog extends Dialog {
+ private final NativePage mPage;
+
+ public NativePageDialog(Context context, NativePage page) {
+ super(context, R.style.DialogWhenLarge);
+ mPage = page;
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ FrameLayout view = (FrameLayout) LayoutInflater.from(getContext()).inflate(
+ R.layout.dialog_with_titlebar, null);
+ view.addView(mPage.getView(), 0);
+ setContentView(view);
+
+ getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
+ getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
+
+ TextView title = (TextView) view.findViewById(R.id.title);
+ title.setText(mPage.getTitle());
+
+ ImageButton closeButton = (ImageButton) view.findViewById(R.id.close_button);
+ closeButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ dismiss();
+ }
+ });
+ }
+
+ @Override
+ public void dismiss() {
+ super.dismiss();
+ if (mPage != null) mPage.destroy();
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698