OLD | NEW |
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.util.AttributeSet; | 8 import android.util.AttributeSet; |
9 import android.view.LayoutInflater; | 9 import android.view.LayoutInflater; |
10 import android.view.View; | 10 import android.view.View; |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 * Hide the tab switcher. | 220 * Hide the tab switcher. |
221 */ | 221 */ |
222 public void hideTabSwitcher() { | 222 public void hideTabSwitcher() { |
223 if (mTabModelWrapper == null) return; | 223 if (mTabModelWrapper == null) return; |
224 if (!isTabSwitcherVisible()) return; | 224 if (!isTabSwitcherVisible()) return; |
225 ViewParent parent = mTabModelWrapper.getParent(); | 225 ViewParent parent = mTabModelWrapper.getParent(); |
226 if (parent != null) { | 226 if (parent != null) { |
227 assert parent == mContentViewHolder; | 227 assert parent == mContentViewHolder; |
228 mContentViewHolder.removeView(mTabModelWrapper); | 228 mContentViewHolder.removeView(mTabModelWrapper); |
229 } | 229 } |
230 mToolbar.showAddButton(false); | 230 mToolbar.updateToolBarButtonState(); |
231 } | 231 } |
232 | 232 |
233 /** | 233 /** |
234 * Shows the tab switcher. | 234 * Shows the tab switcher. |
235 */ | 235 */ |
236 private void showTabSwitcher() { | 236 private void showTabSwitcher() { |
237 if (mTabModelWrapper == null) { | 237 if (mTabModelWrapper == null) { |
238 mTabModelWrapper = (AccessibilityTabModelWrapper) LayoutInflater.fro
m( | 238 mTabModelWrapper = (AccessibilityTabModelWrapper) LayoutInflater.fro
m( |
239 mContentViewHolder.getContext()).inflate( | 239 mContentViewHolder.getContext()).inflate( |
240 R.layout.accessibility_tab_switcher, null); | 240 R.layout.accessibility_tab_switcher, null); |
241 mTabModelWrapper.setup(null); | 241 mTabModelWrapper.setup(null); |
242 mTabModelWrapper.setTabModelSelector(mTabModelSelector); | 242 mTabModelWrapper.setTabModelSelector(mTabModelSelector); |
243 } | 243 } |
244 | 244 |
245 if (mTabModelWrapper.getParent() == null) { | 245 if (mTabModelWrapper.getParent() == null) { |
246 mContentViewHolder.addView(mTabModelWrapper); | 246 mContentViewHolder.addView(mTabModelWrapper); |
247 } | 247 } |
248 mToolbar.showAddButton(true); | 248 mToolbar.updateToolBarButtonState(); |
249 InputMethodManager mImm = (InputMethodManager) getContext().getSystemSer
vice( | 249 InputMethodManager mImm = (InputMethodManager) getContext().getSystemSer
vice( |
250 Context.INPUT_METHOD_SERVICE); | 250 Context.INPUT_METHOD_SERVICE); |
251 mImm.hideSoftInputFromWindow(mContentViewHolder.getWindowToken(), 0); | 251 mImm.hideSoftInputFromWindow(mContentViewHolder.getWindowToken(), 0); |
252 } | 252 } |
253 | 253 |
254 /** | 254 /** |
255 * Returns the visibility status of the tab switcher. | 255 * Returns the visibility status of the tab switcher. |
256 */ | 256 */ |
257 public boolean isTabSwitcherVisible() { | 257 public boolean isTabSwitcherVisible() { |
258 return mTabModelWrapper != null && mTabModelWrapper.getParent() == mCont
entViewHolder; | 258 return mTabModelWrapper != null && mTabModelWrapper.getParent() == mCont
entViewHolder; |
(...skipping 26 matching lines...) Expand all Loading... |
285 return createTab(url, TabLaunchType.FROM_KEYBOARD); | 285 return createTab(url, TabLaunchType.FROM_KEYBOARD); |
286 } | 286 } |
287 | 287 |
288 /** | 288 /** |
289 * Returns the TabModelSelector containing the tabs. | 289 * Returns the TabModelSelector containing the tabs. |
290 */ | 290 */ |
291 public TabModelSelector getTabModelSelector() { | 291 public TabModelSelector getTabModelSelector() { |
292 return mTabModelSelector; | 292 return mTabModelSelector; |
293 } | 293 } |
294 } | 294 } |
OLD | NEW |