| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.ntp.cards; | 5 package org.chromium.chrome.browser.ntp.cards; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * A node in the tree that has a parent and can notify it about changes. | 8 * A node in the tree that has a parent and can notify it about changes. |
| 9 * | 9 * |
| 10 * This class mostly serves as a convenience base class for implementations of {
@link TreeNode}. | 10 * This class mostly serves as a convenience base class for implementations of {
@link TreeNode}. |
| 11 */ | 11 */ |
| 12 public abstract class ChildNode implements TreeNode { | 12 public abstract class ChildNode implements TreeNode { |
| 13 private final NodeParent mParent; | 13 private final NodeParent mParent; |
| 14 | 14 |
| 15 protected ChildNode(NodeParent parent) { | 15 protected ChildNode(NodeParent parent) { |
| 16 mParent = parent; | 16 mParent = parent; |
| 17 } | 17 } |
| 18 | 18 |
| 19 @Override |
| 20 public void init() {} |
| 21 |
| 19 protected void notifyItemRangeChanged(int index, int count) { | 22 protected void notifyItemRangeChanged(int index, int count) { |
| 20 mParent.onItemRangeChanged(this, index, count); | 23 mParent.onItemRangeChanged(this, index, count); |
| 21 } | 24 } |
| 22 | 25 |
| 23 protected void notifyItemRangeInserted(int index, int count) { | 26 protected void notifyItemRangeInserted(int index, int count) { |
| 24 mParent.onItemRangeInserted(this, index, count); | 27 mParent.onItemRangeInserted(this, index, count); |
| 25 } | 28 } |
| 26 | 29 |
| 27 protected void notifyItemRangeRemoved(int index, int count) { | 30 protected void notifyItemRangeRemoved(int index, int count) { |
| 28 mParent.onItemRangeRemoved(this, index, count); | 31 mParent.onItemRangeRemoved(this, index, count); |
| 29 } | 32 } |
| 30 | 33 |
| 31 protected void notifyItemChanged(int index) { | 34 protected void notifyItemChanged(int index) { |
| 32 notifyItemRangeChanged(index, 1); | 35 notifyItemRangeChanged(index, 1); |
| 33 } | 36 } |
| 34 | 37 |
| 35 protected void notifyItemInserted(int index) { | 38 protected void notifyItemInserted(int index) { |
| 36 notifyItemRangeInserted(index, 1); | 39 notifyItemRangeInserted(index, 1); |
| 37 } | 40 } |
| 38 | 41 |
| 39 protected void notifyItemRemoved(int index) { | 42 protected void notifyItemRemoved(int index) { |
| 40 notifyItemRangeRemoved(index, 1); | 43 notifyItemRangeRemoved(index, 1); |
| 41 } | 44 } |
| 42 } | 45 } |
| OLD | NEW |