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

Unified Diff: ash/launcher/launcher_view.cc

Issue 10142005: Revert 133089 - Implement LauncherIconObserver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/launcher/launcher_view.h ('k') | ash/launcher/launcher_view_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/launcher/launcher_view.cc
===================================================================
--- ash/launcher/launcher_view.cc (revision 133102)
+++ ash/launcher/launcher_view.cc (working copy)
@@ -6,7 +6,6 @@
#include "ash/launcher/launcher_button.h"
#include "ash/launcher/launcher_delegate.h"
-#include "ash/launcher/launcher_icon_observer.h"
#include "ash/launcher/launcher_model.h"
#include "ash/launcher/tabbed_launcher_button.h"
#include "ash/shell.h"
@@ -256,7 +255,6 @@
: model_(model),
delegate_(delegate),
view_model_(new views::ViewModel),
- last_visible_index_(-1),
overflow_button_(NULL),
dragging_(NULL),
drag_view_(NULL),
@@ -307,7 +305,7 @@
gfx::Rect LauncherView::GetIdealBoundsOfItemIcon(LauncherID id) {
int index = model_->ItemIndexByID(id);
- if (index == -1 || index > last_visible_index_)
+ if (index == -1 || !view_model_->view_at(index)->visible())
return gfx::Rect();
const gfx::Rect& ideal_bounds(view_model_->ideal_bounds(index));
DCHECK_NE(TYPE_APP_LIST, model_->items()[index].type);
@@ -366,19 +364,19 @@
}
bounds->overflow_bounds.set_size(gfx::Size(kButtonWidth, kButtonHeight));
- last_visible_index_ = DetermineLastVisibleIndex(
+ int last_visible_index = DetermineLastVisibleIndex(
available_width - kLeadingInset - bounds->overflow_bounds.width() -
kButtonSpacing - kButtonWidth);
bool show_overflow =
- (last_visible_index_ + 1 != view_model_->view_size());
+ (last_visible_index + 1 != view_model_->view_size());
int app_list_index = view_model_->view_size() - 1;
if (overflow_button_->visible() != show_overflow) {
// Only change visibility of the views if the visibility of the overflow
// button changes. Otherwise we'll effect the insertion animation, which
// changes the visibility.
- for (int i = 0; i <= last_visible_index_; ++i)
+ for (int i = 0; i <= last_visible_index; ++i)
view_model_->view_at(i)->SetVisible(true);
- for (int i = last_visible_index_ + 1; i < view_model_->view_size(); ++i) {
+ for (int i = last_visible_index + 1; i < view_model_->view_size(); ++i) {
if (i != app_list_index)
view_model_->view_at(i)->SetVisible(false);
}
@@ -388,8 +386,8 @@
DCHECK_NE(0, view_model_->view_size());
// We always want the app list visible.
gfx::Rect app_list_bounds = view_model_->ideal_bounds(app_list_index);
- x = last_visible_index_ == -1 ?
- kLeadingInset : view_model_->ideal_bounds(last_visible_index_).right();
+ x = last_visible_index == -1 ?
+ kLeadingInset : view_model_->ideal_bounds(last_visible_index).right();
app_list_bounds.set_x(x);
view_model_->set_ideal_bounds(app_list_index, app_list_bounds);
x = app_list_bounds.right() + kButtonSpacing;
@@ -406,14 +404,6 @@
return index;
}
-void LauncherView::AddIconObserver(LauncherIconObserver* observer) {
- observers_.AddObserver(observer);
-}
-
-void LauncherView::RemoveIconObserver(LauncherIconObserver* observer) {
- observers_.RemoveObserver(observer);
-}
-
void LauncherView::AnimateToIdealBounds() {
IdealBounds ideal_bounds;
CalculateIdealBounds(&ideal_bounds);
@@ -551,9 +541,6 @@
view_model_->Move(current_index, target_index);
AnimateToIdealBounds();
bounds_animator_->StopAnimatingView(drag_view_);
-
- FOR_EACH_OBSERVER(LauncherIconObserver, observers_,
- OnLauncherIconPositionsChanged());
}
bool LauncherView::SameDragType(LauncherItemType typea,
@@ -675,8 +662,6 @@
void LauncherView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
LayoutToIdealBounds();
- FOR_EACH_OBSERVER(LauncherIconObserver, observers_,
- OnLauncherIconPositionsChanged());
}
views::FocusTraversable* LauncherView::GetPaneFocusTraversable() {
@@ -708,9 +693,6 @@
bounds_animator_->SetAnimationDelegate(
view, new StartFadeAnimationDelegate(this, view), true);
}
-
- FOR_EACH_OBSERVER(LauncherIconObserver, observers_,
- OnLauncherIconPositionsChanged());
}
void LauncherView::LauncherItemRemoved(int model_index, LauncherID id) {
@@ -726,14 +708,6 @@
bounds_animator_->AnimateViewTo(view, view->bounds());
bounds_animator_->SetAnimationDelegate(
view, new FadeOutAnimationDelegate(this, view), true);
-
- // The animation will eventually update the ideal bounds, but we want to
- // force an update immediately so we can notify launcher icon observers.
- IdealBounds ideal_bounds;
- CalculateIdealBounds(&ideal_bounds);
-
- FOR_EACH_OBSERVER(LauncherIconObserver, observers_,
- OnLauncherIconPositionsChanged());
}
void LauncherView::LauncherItemChanged(int model_index,
@@ -783,8 +757,6 @@
void LauncherView::LauncherItemMoved(int start_index, int target_index) {
view_model_->Move(start_index, target_index);
AnimateToIdealBounds();
- FOR_EACH_OBSERVER(LauncherIconObserver, observers_,
- OnLauncherIconPositionsChanged());
}
void LauncherView::LauncherItemWillChange(int index) {
« no previous file with comments | « ash/launcher/launcher_view.h ('k') | ash/launcher/launcher_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698