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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 public void didSelectTab(Tab tab, TabSelectionType type, int lastId) { | 51 public void didSelectTab(Tab tab, TabSelectionType type, int lastId) { |
52 assert tab instanceof ChromeShellTab; | 52 assert tab instanceof ChromeShellTab; |
53 setCurrentTab((ChromeShellTab) tab); | 53 setCurrentTab((ChromeShellTab) tab); |
54 hideTabSwitcher(); | 54 hideTabSwitcher(); |
55 } | 55 } |
56 | 56 |
57 @Override | 57 @Override |
58 public void willCloseTab(Tab tab, boolean animate) { | 58 public void willCloseTab(Tab tab, boolean animate) { |
59 if (tab == mCurrentTab) setCurrentTab(null); | 59 if (tab == mCurrentTab) setCurrentTab(null); |
60 } | 60 } |
| 61 |
| 62 @Override |
| 63 public void didCloseTab(Tab tab) { |
| 64 ensureTabExists(); |
| 65 } |
| 66 |
61 }; | 67 }; |
62 | 68 |
63 /** | 69 /** |
64 * @param context The Context the view is running in. | 70 * @param context The Context the view is running in. |
65 * @param attrs The attributes of the XML tag that is inflating the view. | 71 * @param attrs The attributes of the XML tag that is inflating the view. |
66 */ | 72 */ |
67 public TabManager(Context context, AttributeSet attrs) { | 73 public TabManager(Context context, AttributeSet attrs) { |
68 super(context, attrs); | 74 super(context, attrs); |
69 } | 75 } |
70 | 76 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 LoadUrlParams loadUrlParams = new LoadUrlParams(url); | 255 LoadUrlParams loadUrlParams = new LoadUrlParams(url); |
250 loadUrlParams.setTransitionType(PageTransition.TYPED | PageTransition.FR
OM_ADDRESS_BAR); | 256 loadUrlParams.setTransitionType(PageTransition.TYPED | PageTransition.FR
OM_ADDRESS_BAR); |
251 Tab tab = mTabModelSelector.getCurrentTab(); | 257 Tab tab = mTabModelSelector.getCurrentTab(); |
252 if (tab != null) { | 258 if (tab != null) { |
253 tab.loadUrl(loadUrlParams); | 259 tab.loadUrl(loadUrlParams); |
254 return tab; | 260 return tab; |
255 } | 261 } |
256 return createTab(url, TabLaunchType.FROM_KEYBOARD); | 262 return createTab(url, TabLaunchType.FROM_KEYBOARD); |
257 } | 263 } |
258 } | 264 } |
OLD | NEW |