| Index: chrome/browser/chromeos/notifications/notification_panel.cc
|
| ===================================================================
|
| --- chrome/browser/chromeos/notifications/notification_panel.cc (revision 74231)
|
| +++ chrome/browser/chromeos/notifications/notification_panel.cc (working copy)
|
| @@ -170,7 +170,7 @@
|
| virtual void Layout() {
|
| // Layout bottom up
|
| int height = 0;
|
| - for (int i = GetChildViewCount() - 1; i >= 0; --i) {
|
| + for (int i = child_count() - 1; i >= 0; --i) {
|
| views::View* child = GetChildViewAt(i);
|
| child->SetBounds(0, height, child->width(), child->height());
|
| height += child->height() + margin_;
|
| @@ -182,7 +182,7 @@
|
| void UpdateBounds() {
|
| int height = 0;
|
| int max_width = 0;
|
| - for (int i = GetChildViewCount() - 1; i >= 0; --i) {
|
| + for (int i = child_count() - 1; i >= 0; --i) {
|
| views::View* child = GetChildViewAt(i);
|
| height += child->height() + margin_;
|
| max_width = std::max(max_width, child->width());
|
| @@ -197,7 +197,7 @@
|
| // Returns the bounds that covers new notifications.
|
| gfx::Rect GetNewBounds() {
|
| gfx::Rect rect;
|
| - for (int i = GetChildViewCount() - 1; i >= 0; --i) {
|
| + for (int i = child_count() - 1; i >= 0; --i) {
|
| BalloonViewImpl* view =
|
| static_cast<BalloonViewImpl*>(GetChildViewAt(i));
|
| if (!view->stale()) {
|
| @@ -214,7 +214,7 @@
|
| // Returns # of new notifications.
|
| int GetNewCount() {
|
| int count = 0;
|
| - for (int i = GetChildViewCount() - 1; i >= 0; --i) {
|
| + for (int i = child_count() - 1; i >= 0; --i) {
|
| BalloonViewImpl* view =
|
| static_cast<BalloonViewImpl*>(GetChildViewAt(i));
|
| if (!view->stale())
|
| @@ -225,7 +225,7 @@
|
|
|
| // Make all notifications stale.
|
| void MakeAllStale() {
|
| - for (int i = GetChildViewCount() - 1; i >= 0; --i) {
|
| + for (int i = child_count() - 1; i >= 0; --i) {
|
| BalloonViewImpl* view =
|
| static_cast<BalloonViewImpl*>(GetChildViewAt(i));
|
| view->set_stale();
|
| @@ -233,7 +233,7 @@
|
| }
|
|
|
| void DismissAll() {
|
| - for (int i = GetChildViewCount() - 1; i >= 0; --i) {
|
| + for (int i = child_count() - 1; i >= 0; --i) {
|
| BalloonViewImpl* view =
|
| static_cast<BalloonViewImpl*>(GetChildViewAt(i));
|
| view->Close(true);
|
| @@ -241,7 +241,7 @@
|
| }
|
|
|
| BalloonViewImpl* FindBalloonView(const Notification& notification) {
|
| - for (int i = GetChildViewCount() - 1; i >= 0; --i) {
|
| + for (int i = child_count() - 1; i >= 0; --i) {
|
| BalloonViewImpl* view =
|
| static_cast<BalloonViewImpl*>(GetChildViewAt(i));
|
| if (view->IsFor(notification)) {
|
| @@ -254,7 +254,7 @@
|
| BalloonViewImpl* FindBalloonView(const gfx::Point point) {
|
| gfx::Point copy(point);
|
| ConvertPointFromWidget(this, ©);
|
| - for (int i = GetChildViewCount() - 1; i >= 0; --i) {
|
| + for (int i = child_count() - 1; i >= 0; --i) {
|
| views::View* view = GetChildViewAt(i);
|
| if (view->bounds().Contains(copy))
|
| return static_cast<BalloonViewImpl*>(view);
|
| @@ -287,8 +287,8 @@
|
| // views::View overrides.
|
| virtual void Layout() {
|
| int margin =
|
| - (sticky_container_->GetChildViewCount() != 0 &&
|
| - non_sticky_container_->GetChildViewCount() != 0) ?
|
| + (sticky_container_->child_count() != 0 &&
|
| + non_sticky_container_->child_count() != 0) ?
|
| margin_ : 0;
|
| sticky_container_->SetBounds(
|
| 0, 0, width(), sticky_container_->height());
|
| @@ -322,9 +322,9 @@
|
| bool Update(Balloon* balloon) {
|
| BalloonViewImpl* view = GetBalloonViewOf(balloon);
|
| View* container = NULL;
|
| - if (sticky_container_->HasChildView(view)) {
|
| + if (view->parent() == sticky_container_) {
|
| container = sticky_container_;
|
| - } else if (non_sticky_container_->HasChildView(view)) {
|
| + } else if (view->parent() == non_sticky_container_) {
|
| container = non_sticky_container_;
|
| }
|
| if (container) {
|
| @@ -345,8 +345,8 @@
|
|
|
| // Returns the number of notifications added to the panel.
|
| int GetNotificationCount() {
|
| - return sticky_container_->GetChildViewCount() +
|
| - non_sticky_container_->GetChildViewCount();
|
| + return sticky_container_->child_count() +
|
| + non_sticky_container_->child_count();
|
| }
|
|
|
| // Returns the # of new notifications.
|
| @@ -357,19 +357,19 @@
|
|
|
| // Returns the # of sticky and new notifications.
|
| int GetStickyNewNotificationCount() {
|
| - return sticky_container_->GetChildViewCount() +
|
| + return sticky_container_->child_count() +
|
| non_sticky_container_->GetNewCount();
|
| }
|
|
|
| // Returns the # of sticky notifications.
|
| int GetStickyNotificationCount() {
|
| - return sticky_container_->GetChildViewCount();
|
| + return sticky_container_->child_count();
|
| }
|
|
|
| // Returns true if the |view| is contained in the panel.
|
| bool HasBalloonView(View* view) {
|
| - return sticky_container_->HasChildView(view) ||
|
| - non_sticky_container_->HasChildView(view);
|
| + return view->parent() == sticky_container_ ||
|
| + view->parent() == non_sticky_container_;
|
| }
|
|
|
| // Updates the bounds so that all notifications are visible.
|
|
|