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

Unified Diff: chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellToolbar.java

Issue 541713002: Adding option for Stop/Reload in location bar for chrome_shell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/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.
*/
« no previous file with comments | « chrome/android/java/res/drawable/btn_reload.xml ('k') | chrome/android/shell/res/layout/chrome_shell_activity.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698