Chromium Code Reviews| Index: chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellToolbar.java |
| diff --git a/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellToolbar.java b/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellToolbar.java |
| index a4fbf2d71cd3f5b1253d99aabcefe5e1fec1a21f..622fd102d5546b2e76672f87cd02c1697d97bae9 100644 |
| --- a/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellToolbar.java |
| +++ b/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellToolbar.java |
| @@ -52,6 +52,10 @@ public class ChromeShellToolbar extends LinearLayout { |
| private SuggestionPopup mSuggestionPopup; |
| + private boolean mLoading = false; |
| + private ImageButton mStopButton; |
| + private ImageButton mReloadButton; |
| + |
| /** |
| * @param context The Context the view is running in. |
| * @param attrs The attributes of the XML tag that is inflating the view. |
| @@ -87,7 +91,10 @@ public class ChromeShellToolbar extends LinearLayout { |
| private void onLoadProgressChanged(int progress) { |
| removeCallbacks(mClearProgressRunnable); |
| mProgressDrawable.setLevel(100 * progress); |
| - if (progress == 100) postDelayed(mClearProgressRunnable, COMPLETED_PROGRESS_TIMEOUT_MS); |
| + mLoading = progress == 100 ? false : true; |
|
Bernhard Bauer
2014/09/04 13:17:35
Don't use false and true in a ?: expression. Just
|
| + mStopButton.setVisibility(mLoading ? VISIBLE : GONE); |
| + mReloadButton.setVisibility(mLoading ? GONE : VISIBLE); |
| + if (!mLoading) postDelayed(mClearProgressRunnable, COMPLETED_PROGRESS_TIMEOUT_MS); |
| } |
| /** |
| @@ -104,6 +111,7 @@ public class ChromeShellToolbar extends LinearLayout { |
| mProgressDrawable = (ClipDrawable) findViewById(R.id.toolbar).getBackground(); |
| initializeUrlField(); |
| initializeMenuButton(); |
| + initializeStopReloadButton(); |
| } |
| void setMenuHandler(AppMenuHandler menuHandler) { |
| @@ -174,6 +182,23 @@ public class ChromeShellToolbar extends LinearLayout { |
| }); |
| } |
| + private void initializeStopReloadButton() { |
| + mStopButton = (ImageButton)findViewById(R.id.stop); |
| + mStopButton.setOnClickListener(new OnClickListener() { |
| + @Override |
| + public void onClick(View v) { |
| + if (mLoading) mTab.getContentViewCore().stopLoading(); |
|
Bernhard Bauer
2014/09/04 13:17:35
Is the loading check actually necessary? The butto
|
| + } |
| + }); |
| + mReloadButton = (ImageButton)findViewById(R.id.reload); |
| + mReloadButton.setOnClickListener(new OnClickListener() { |
| + @Override |
| + public void onClick(View v) { |
| + mTab.getContentViewCore().reload(true); |
| + } |
| + }); |
| + } |
| + |
| /** |
| * @return Current tab that is shown by ChromeShell. |
| */ |