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.browser.widget.accessibility; | 5 package org.chromium.chrome.browser.widget.accessibility; |
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.View; | 9 import android.view.View; |
10 import android.widget.ImageButton; | 10 import android.widget.ImageButton; |
(...skipping 21 matching lines...) Expand all Loading... |
32 private TabModelSelector.ChangeListener mTabModelChangeListener = | 32 private TabModelSelector.ChangeListener mTabModelChangeListener = |
33 new TabModelSelector.ChangeListener() { | 33 new TabModelSelector.ChangeListener() { |
34 | 34 |
35 @Override | 35 @Override |
36 public void onChange() { | 36 public void onChange() { |
37 getAdapter().notifyDataSetChanged(); | 37 getAdapter().notifyDataSetChanged(); |
38 } | 38 } |
39 | 39 |
40 @Override | 40 @Override |
41 public void onNewTabCreated(Tab tab) { | 41 public void onNewTabCreated(Tab tab) { |
| 42 getAdapter().notifyDataSetChanged(); |
42 } | 43 } |
43 }; | 44 }; |
44 | 45 |
45 // TODO(bauerb): Use View#isAttachedToWindow() as soon as we are guaranteed | 46 // TODO(bauerb): Use View#isAttachedToWindow() as soon as we are guaranteed |
46 // to run against API version 19. | 47 // to run against API version 19. |
47 private boolean mIsAttachedToWindow; | 48 private boolean mIsAttachedToWindow; |
48 | 49 |
49 private class ButtonOnClickListener implements View.OnClickListener { | 50 private class ButtonOnClickListener implements View.OnClickListener { |
50 private final boolean mIncognito; | 51 private final boolean mIncognito; |
51 | 52 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 153 |
153 @Override | 154 @Override |
154 protected void onAttachedToWindow() { | 155 protected void onAttachedToWindow() { |
155 mTabModelSelector.registerChangeListener(mTabModelChangeListener); | 156 mTabModelSelector.registerChangeListener(mTabModelChangeListener); |
156 mIsAttachedToWindow = true; | 157 mIsAttachedToWindow = true; |
157 super.onAttachedToWindow(); | 158 super.onAttachedToWindow(); |
158 } | 159 } |
159 | 160 |
160 @Override | 161 @Override |
161 protected void onDetachedFromWindow() { | 162 protected void onDetachedFromWindow() { |
162 mTabModelSelector.unregisterChangeListener(mTabModelChangeListener); | |
163 mIsAttachedToWindow = false; | 163 mIsAttachedToWindow = false; |
164 super.onDetachedFromWindow(); | 164 super.onDetachedFromWindow(); |
165 } | 165 } |
166 } | 166 } |
OLD | NEW |