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

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

Issue 481803004: Removing ContentViewCore dependencies from few functions which acts as direct wrapper to WebContents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed the nit. Created 6 years, 4 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 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.content.Context; 7 import android.content.Context;
8 import android.content.res.Configuration; 8 import android.content.res.Configuration;
9 import android.graphics.drawable.ClipDrawable; 9 import android.graphics.drawable.ClipDrawable;
10 import android.util.AttributeSet; 10 import android.util.AttributeSet;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 70 }
71 71
72 /** 72 /**
73 * The toolbar will visually represent the state of {@code tab}. 73 * The toolbar will visually represent the state of {@code tab}.
74 * @param tab The Tab that should be represented. 74 * @param tab The Tab that should be represented.
75 */ 75 */
76 public void showTab(ChromeShellTab tab) { 76 public void showTab(ChromeShellTab tab) {
77 if (mTab != null) mTab.removeObserver(mTabObserver); 77 if (mTab != null) mTab.removeObserver(mTabObserver);
78 mTab = tab; 78 mTab = tab;
79 mTab.addObserver(mTabObserver); 79 mTab.addObserver(mTabObserver);
80 mUrlTextView.setText(mTab.getContentViewCore().getUrl()); 80 mUrlTextView.setText(mTab.getContentViewCore().getWebContents().getUrl() );
Yaron 2014/08/18 23:16:24 Tab exposes getWebContents. Please use directly (t
AKVT 2014/09/11 17:19:43 Done.
81 } 81 }
82 82
83 private void onUpdateUrl(String url) { 83 private void onUpdateUrl(String url) {
84 mUrlTextView.setText(url); 84 mUrlTextView.setText(url);
85 } 85 }
86 86
87 private void onLoadProgressChanged(int progress) { 87 private void onLoadProgressChanged(int progress) {
88 removeCallbacks(mClearProgressRunnable); 88 removeCallbacks(mClearProgressRunnable);
89 mProgressDrawable.setLevel(100 * progress); 89 mProgressDrawable.setLevel(100 * progress);
90 if (progress == 100) postDelayed(mClearProgressRunnable, COMPLETED_PROGR ESS_TIMEOUT_MS); 90 if (progress == 100) postDelayed(mClearProgressRunnable, COMPLETED_PROGR ESS_TIMEOUT_MS);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 setKeyboardVisibilityForUrl(false); 128 setKeyboardVisibilityForUrl(false);
129 mTab.getView().requestFocus(); 129 mTab.getView().requestFocus();
130 return true; 130 return true;
131 } 131 }
132 }); 132 });
133 mUrlTextView.setOnFocusChangeListener(new OnFocusChangeListener() { 133 mUrlTextView.setOnFocusChangeListener(new OnFocusChangeListener() {
134 @Override 134 @Override
135 public void onFocusChange(View v, boolean hasFocus) { 135 public void onFocusChange(View v, boolean hasFocus) {
136 setKeyboardVisibilityForUrl(hasFocus); 136 setKeyboardVisibilityForUrl(hasFocus);
137 if (!hasFocus) { 137 if (!hasFocus) {
138 mUrlTextView.setText(mTab.getContentViewCore().getUrl()); 138 mUrlTextView.setText(mTab.getContentViewCore().getWebContent s().getUrl());
139 mSuggestionPopup.dismissPopup(); 139 mSuggestionPopup.dismissPopup();
140 } 140 }
141 } 141 }
142 }); 142 });
143 143
144 mSuggestionPopup = new SuggestionPopup(getContext(), mUrlTextView, this) ; 144 mSuggestionPopup = new SuggestionPopup(getContext(), mUrlTextView, this) ;
145 mUrlTextView.addTextChangedListener(mSuggestionPopup); 145 mUrlTextView.addTextChangedListener(mSuggestionPopup);
146 } 146 }
147 147
148 private void initializeMenuButton() { 148 private void initializeMenuButton() {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 public void onLoadProgressChanged(Tab tab, int progress) { 193 public void onLoadProgressChanged(Tab tab, int progress) {
194 if (tab == mTab) ChromeShellToolbar.this.onLoadProgressChanged(progr ess); 194 if (tab == mTab) ChromeShellToolbar.this.onLoadProgressChanged(progr ess);
195 } 195 }
196 196
197 @Override 197 @Override
198 public void onUpdateUrl(Tab tab, String url) { 198 public void onUpdateUrl(Tab tab, String url) {
199 if (tab == mTab) ChromeShellToolbar.this.onUpdateUrl(url); 199 if (tab == mTab) ChromeShellToolbar.this.onUpdateUrl(url);
200 } 200 }
201 } 201 }
202 } 202 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698