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

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: Removed high res images 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..1161c24ace81062bf0d71cfcdedf436e396268df 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,9 @@ public class ChromeShellToolbar extends LinearLayout {
private SuggestionPopup mSuggestionPopup;
+ 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 +90,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);
+ boolean isLoading = progress != 100;
+ mStopButton.setVisibility(isLoading ? VISIBLE : GONE);
+ mReloadButton.setVisibility(isLoading ? GONE : VISIBLE);
+ if (!isLoading) postDelayed(mClearProgressRunnable, COMPLETED_PROGRESS_TIMEOUT_MS);
}
/**
@@ -104,6 +110,7 @@ public class ChromeShellToolbar extends LinearLayout {
mProgressDrawable = (ClipDrawable) findViewById(R.id.toolbar).getBackground();
initializeUrlField();
initializeMenuButton();
+ initializeStopReloadButton();
}
void setMenuHandler(AppMenuHandler menuHandler) {
@@ -174,6 +181,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) {
+ mTab.getContentViewCore().stopLoading();
+ }
+ });
+ 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-mdpi/btn_reload_normal.png ('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