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

Unified Diff: ash/launcher/launcher_view.cc

Issue 10905201: Move app list (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review issues Created 8 years, 3 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_navigator_unittest.cc ('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
diff --git a/ash/launcher/launcher_view.cc b/ash/launcher/launcher_view.cc
index 17eb877b28b6f8dab12f6a9f21c3ac53d3ffc389..618f0609696b7235c30307ee06858bae4a879b47 100644
--- a/ash/launcher/launcher_view.cc
+++ b/ash/launcher/launcher_view.cc
@@ -393,9 +393,9 @@ void LauncherView::CalculateIdealBounds(IdealBounds* bounds) {
y = primary_axis_coordinate(0, y + kLauncherPreferredSize + kButtonSpacing);
}
- int app_list_index = view_model_->view_size() - 1;
+ int last_view_index = view_model_->view_size() - 1;
if (is_overflow_mode()) {
- last_visible_index_ = app_list_index - 1;
+ last_visible_index_ = last_view_index;
for (int i = 0; i < view_model_->view_size(); ++i) {
view_model_->view_at(i)->SetVisible(
i >= first_visible_index_ && i <= last_visible_index_);
@@ -417,11 +417,10 @@ void LauncherView::CalculateIdealBounds(IdealBounds* bounds) {
last_visible_index_ = DetermineLastVisibleIndex(
available_size - leading_inset() - kLauncherPreferredSize -
kButtonSpacing - kLauncherPreferredSize);
- bool show_overflow = (last_visible_index_ + 1 < app_list_index);
+ bool show_overflow = (last_visible_index_ < last_view_index);
for (int i = 0; i < view_model_->view_size(); ++i) {
- view_model_->view_at(i)->SetVisible(
- i == app_list_index || i <= last_visible_index_);
+ view_model_->view_at(i)->SetVisible(i <= last_visible_index_);
}
overflow_button_->SetVisible(show_overflow);
@@ -436,14 +435,8 @@ void LauncherView::CalculateIdealBounds(IdealBounds* bounds) {
y = primary_axis_coordinate(0,
view_model_->ideal_bounds(last_visible_index_).bottom());
}
- gfx::Rect app_list_bounds = view_model_->ideal_bounds(app_list_index);
bounds->overflow_bounds.set_x(x);
bounds->overflow_bounds.set_y(y);
- x = primary_axis_coordinate(x + kLauncherPreferredSize + kButtonSpacing, 0);
- y = primary_axis_coordinate(0, y + kLauncherPreferredSize + kButtonSpacing);
- app_list_bounds.set_x(x);
- app_list_bounds.set_y(y);
- view_model_->set_ideal_bounds(app_list_index, app_list_bounds);
} else {
if (overflow_bubble_.get())
overflow_bubble_->Hide();
@@ -722,9 +715,14 @@ int LauncherView::CancelDrag(int modified_index) {
return modified_index;
// Restore previous position, tracking the position of the modified view.
+ model_->Move(drag_view_index, start_drag_index_);
+
+ // Adding a new view at end.
+ if (modified_index == view_model_->view_size())
+ return modified_index;
+
views::View* removed_view =
(modified_index >= 0) ? view_model_->view_at(modified_index) : NULL;
- model_->Move(drag_view_index, start_drag_index_);
return removed_view ? view_model_->GetIndexOfView(removed_view) : -1;
}
@@ -732,12 +730,9 @@ gfx::Size LauncherView::GetPreferredSize() {
IdealBounds ideal_bounds;
CalculateIdealBounds(&ideal_bounds);
- const int app_list_index = view_model_->view_size() - 1;
- const int last_button_index = is_overflow_mode() ?
- last_visible_index_ : app_list_index;
const gfx::Rect last_button_bounds =
- last_button_index >= first_visible_index_ ?
- view_model_->view_at(last_button_index)->bounds() :
+ last_visible_index_ >= first_visible_index_ ?
+ view_model_->view_at(last_visible_index_)->bounds() :
gfx::Rect(gfx::Size(kLauncherPreferredSize,
kLauncherPreferredSize));
« no previous file with comments | « ash/launcher/launcher_navigator_unittest.cc ('k') | ash/launcher/launcher_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698