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

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

Issue 683203006: Adding option for adding new tab in tab manager for chrome shell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review changes Created 6 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.shell; 5 package org.chromium.chrome.shell;
6 6
7 import android.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.res.Configuration; 9 import android.content.res.Configuration;
10 import android.graphics.drawable.ClipDrawable; 10 import android.graphics.drawable.ClipDrawable;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 private final TabObserver mTabObserver; 65 private final TabObserver mTabObserver;
66 66
67 private AppMenuHandler mMenuHandler; 67 private AppMenuHandler mMenuHandler;
68 private AppMenuButtonHelper mAppMenuButtonHelper; 68 private AppMenuButtonHelper mAppMenuButtonHelper;
69 69
70 private TabManager mTabManager; 70 private TabManager mTabManager;
71 71
72 private SuggestionPopup mSuggestionPopup; 72 private SuggestionPopup mSuggestionPopup;
73 73
74 private ImageButton mStopReloadButton; 74 private ImageButton mStopReloadButton;
75 private ImageButton mAddButton;
76
75 private int mProgress = 0; 77 private int mProgress = 0;
76 private boolean mLoading = true; 78 private boolean mLoading = true;
77 79
78 /** 80 /**
79 * @param context The Context the view is running in. 81 * @param context The Context the view is running in.
80 * @param attrs The attributes of the XML tag that is inflating the view. 82 * @param attrs The attributes of the XML tag that is inflating the view.
81 */ 83 */
82 public ChromeShellToolbar(Context context, AttributeSet attrs) { 84 public ChromeShellToolbar(Context context, AttributeSet attrs) {
83 super(context, attrs); 85 super(context, attrs);
84 // When running performance benchmark, we don't want to observe the tab 86 // When running performance benchmark, we don't want to observe the tab
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 if (mTab == null) return; 237 if (mTab == null) return;
236 if (mLoading) { 238 if (mLoading) {
237 mTab.getWebContents().stop(); 239 mTab.getWebContents().stop();
238 } else { 240 } else {
239 mTab.getWebContents().getNavigationController().reload(true) ; 241 mTab.getWebContents().getNavigationController().reload(true) ;
240 } 242 }
241 } 243 }
242 }); 244 });
243 } 245 }
244 246
247
248 public void initializeAddButton(boolean tabswitcher) {
Bernhard Bauer 2014/11/05 10:01:53 This should have a Javadoc comment. Also, |tabswit
249 mAddButton = (ImageButton) findViewById(R.id.add_button);
250 mAddButton.setVisibility(tabswitcher ? VISIBLE : GONE);
251 mStopReloadButton.setVisibility(tabswitcher ? GONE : VISIBLE);
252 mAddButton.setOnClickListener(new OnClickListener() {
253 @Override
254 public void onClick(View v) {
255 mTabManager.createNewTab();
256 }
257 });
258 }
259
260
245 /** 261 /**
246 * @return Current tab that is shown by ChromeShell. 262 * @return Current tab that is shown by ChromeShell.
247 */ 263 */
248 public ChromeShellTab getCurrentTab() { 264 public ChromeShellTab getCurrentTab() {
249 return mTab; 265 return mTab;
250 } 266 }
251 267
252 /** 268 /**
253 * Change the visibility of the software keyboard. 269 * Change the visibility of the software keyboard.
254 * @param visible Whether the keyboard should be shown or hidden. 270 * @param visible Whether the keyboard should be shown or hidden.
(...skipping 19 matching lines...) Expand all
274 public void onLoadProgressChanged(Tab tab, int progress) { 290 public void onLoadProgressChanged(Tab tab, int progress) {
275 if (tab == mTab) ChromeShellToolbar.this.onLoadProgressChanged(progr ess); 291 if (tab == mTab) ChromeShellToolbar.this.onLoadProgressChanged(progr ess);
276 } 292 }
277 293
278 @Override 294 @Override
279 public void onUpdateUrl(Tab tab, String url) { 295 public void onUpdateUrl(Tab tab, String url) {
280 if (tab == mTab) ChromeShellToolbar.this.onUpdateUrl(url); 296 if (tab == mTab) ChromeShellToolbar.this.onUpdateUrl(url);
281 } 297 }
282 } 298 }
283 } 299 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698