Chromium Code Reviews| Index: blimp/client/app/android/java/src/org/chromium/blimp/toolbar/Toolbar.java |
| diff --git a/blimp/client/app/android/java/src/org/chromium/blimp/toolbar/Toolbar.java b/blimp/client/app/android/java/src/org/chromium/blimp/toolbar/Toolbar.java |
| index 816e33d90d683d4373b1994d9dc6a5c80b111c44..0156c02a6a98287a833b2a2bf7cb53943bc5832d 100644 |
| --- a/blimp/client/app/android/java/src/org/chromium/blimp/toolbar/Toolbar.java |
| +++ b/blimp/client/app/android/java/src/org/chromium/blimp/toolbar/Toolbar.java |
| @@ -24,6 +24,7 @@ import org.chromium.base.annotations.CalledByNative; |
| import org.chromium.base.annotations.JNINamespace; |
| import org.chromium.blimp.R; |
| import org.chromium.blimp.session.BlimpClientSession; |
| +import org.chromium.blimp.settings.Preferences; |
| /** |
| * A {@link View} that visually represents the Blimp toolbar, which lets users issue navigation |
| @@ -35,6 +36,7 @@ public class Toolbar extends LinearLayout implements UrlBar.UrlBarObserver, |
| private long mNativeToolbarPtr; |
| private Context mContext; |
| + private BlimpClientSession mBlimpClientSession; |
|
Khushal
2016/04/01 17:20:46
Is it necessary to give the Toolbar a reference to
shaktisahu
2016/04/06 06:50:25
Acknowledged.
|
| private UrlBar mUrlBar; |
| private ImageButton mReloadButton; |
| private ImageButton mMenuButton; |
| @@ -42,6 +44,7 @@ public class Toolbar extends LinearLayout implements UrlBar.UrlBarObserver, |
| private ProgressBar mProgressBar; |
| private static final int ID_OPEN_IN_CHROME = 0; |
| + private static final int ID_VERSION_INFO = 1; |
| /** |
| * A URL to load when this object is initialized. This handles the case where there is a URL |
| @@ -69,6 +72,7 @@ public class Toolbar extends LinearLayout implements UrlBar.UrlBarObserver, |
| assert mNativeToolbarPtr == 0; |
| mNativeToolbarPtr = nativeInit(blimpClientSession); |
| + mBlimpClientSession = blimpClientSession; |
| sendUrlTextInternal(mUrlToLoad); |
| } |
| @@ -186,7 +190,8 @@ public class Toolbar extends LinearLayout implements UrlBar.UrlBarObserver, |
| private void initializeMenu(View anchorView) { |
| mPopupMenu = new ListPopupWindow(mContext); |
| mPopupMenu.setAdapter(new ArrayAdapter<String>(mContext, R.layout.toolbar_popup_item, |
| - new String[] {mContext.getString(R.string.open_in_chrome)})); |
| + new String[] {mContext.getString(R.string.open_in_chrome), |
| + mContext.getString(R.string.version_info)})); |
| mPopupMenu.setAnchorView(anchorView); |
| mPopupMenu.setWidth(getResources().getDimensionPixelSize(R.dimen.toolbar_popup_item_width)); |
| mPopupMenu.setVerticalOffset(-anchorView.getHeight()); |
| @@ -196,6 +201,8 @@ public class Toolbar extends LinearLayout implements UrlBar.UrlBarObserver, |
| public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
| if (position == ID_OPEN_IN_CHROME) { |
| openInChrome(); |
| + } else if (position == ID_VERSION_INFO) { |
| + showVersionInfo(); |
| } |
| mPopupMenu.dismiss(); |
| } |
| @@ -215,6 +222,15 @@ public class Toolbar extends LinearLayout implements UrlBar.UrlBarObserver, |
| } |
| } |
| + private void showVersionInfo() { |
| + Intent intent = new Intent(); |
| + intent.setClass(mContext, Preferences.class); |
| + intent.putExtra("ENGINE_IP", mBlimpClientSession.getEngineIPAddress()); |
| + intent.putExtra("ENGINE_VERSION", mBlimpClientSession.getEngineVersion()); |
| + // intent.putExtra("ASSIGNER_URL", mBlimpClientSession.GetDefaultAssignerURL()); |
|
Kevin M
2016/03/31 19:41:49
Uncomment or remove this
shaktisahu
2016/04/06 06:50:25
Done.
|
| + mContext.startActivity(intent); |
| + } |
| + |
| // Methods that are called by native via JNI. |
| @CalledByNative |
| private void onEngineSentUrl(String url) { |