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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/ChildNode.java

Issue 2396523002: Unify NewTabPageItem and ItemGroup into a single tree-structured interface. (Closed)
Patch Set: review Created 4 years, 2 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
(Empty)
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
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.ntp.cards;
6
7 /**
8 * A node in the tree that has a parent and can notify it about changes.
9 *
10 * This class mostly serves as a convenience base class for implementations of { @link TreeNode}.
11 */
12 public abstract class ChildNode implements TreeNode {
13 private final NodeParent mParent;
14
15 protected ChildNode(NodeParent parent) {
16 mParent = parent;
17 }
18
19 protected void notifyItemRangeChanged(int index, int count) {
20 mParent.onItemRangeChanged(this, index, count);
21 }
22
23 protected void notifyItemRangeInserted(int index, int count) {
24 mParent.onItemRangeInserted(this, index, count);
25 }
26
27 protected void notifyItemRangeRemoved(int index, int count) {
28 mParent.onItemRangeRemoved(this, index, count);
29 }
30
31 protected void notifyItemChanged(int index) {
32 notifyItemRangeChanged(index, 1);
33 }
34
35 protected void notifyItemInserted(int index) {
36 notifyItemRangeInserted(index, 1);
37 }
38
39 protected void notifyItemRemoved(int index) {
40 notifyItemRangeRemoved(index, 1);
41 }
42 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698