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

Side by Side Diff: ash/shelf/shelf_view.cc

Issue 302653008: Moving default minimize location to the app launcher item. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changed some comments Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « ash/shelf/shelf_view.h ('k') | ash/shelf/shelf_view_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "ash/shelf/shelf_view.h" 5 #include "ash/shelf/shelf_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/ash_constants.h" 9 #include "ash/ash_constants.h"
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 for (int i = 0; i < view_model_->view_size(); ++i) { 447 for (int i = 0; i < view_model_->view_size(); ++i) {
448 if (i >= first_visible_index_ && i <= last_visible_index_) 448 if (i >= first_visible_index_ && i <= last_visible_index_)
449 view_model_->view_at(i)->SchedulePaint(); 449 view_model_->view_at(i)->SchedulePaint();
450 } 450 }
451 if (overflow_button_ && overflow_button_->visible()) 451 if (overflow_button_ && overflow_button_->visible())
452 overflow_button_->SchedulePaint(); 452 overflow_button_->SchedulePaint();
453 } 453 }
454 454
455 gfx::Rect ShelfView::GetIdealBoundsOfItemIcon(ShelfID id) { 455 gfx::Rect ShelfView::GetIdealBoundsOfItemIcon(ShelfID id) {
456 int index = model_->ItemIndexByID(id); 456 int index = model_->ItemIndexByID(id);
457 if (index == -1 || (index > last_visible_index_ && 457 if (index == -1)
458 index < model_->FirstPanelIndex()))
459 return gfx::Rect(); 458 return gfx::Rect();
459 // Map all items from overflow area to the overflow button. Note that the
460 // section between last_index_hidden_ and model_->FirstPanelIndex() is the
461 // list of invisible panel items. However, these items are currently nowhere
462 // represented and get dropped instead - see (crbug.com/378907). As such there
463 // is no way to address them or place them. We therefore move them over the
464 // overflow button.
465 if (index > last_visible_index_ && index < model_->FirstPanelIndex())
466 index = last_visible_index_ + 1;
460 const gfx::Rect& ideal_bounds(view_model_->ideal_bounds(index)); 467 const gfx::Rect& ideal_bounds(view_model_->ideal_bounds(index));
461 DCHECK_NE(TYPE_APP_LIST, model_->items()[index].type); 468 DCHECK_NE(TYPE_APP_LIST, model_->items()[index].type);
462 ShelfButton* button = static_cast<ShelfButton*>(view_model_->view_at(index)); 469 ShelfButton* button = static_cast<ShelfButton*>(view_model_->view_at(index));
463 gfx::Rect icon_bounds = button->GetIconBounds(); 470 gfx::Rect icon_bounds = button->GetIconBounds();
464 return gfx::Rect(GetMirroredXWithWidthInView( 471 return gfx::Rect(GetMirroredXWithWidthInView(
465 ideal_bounds.x() + icon_bounds.x(), icon_bounds.width()), 472 ideal_bounds.x() + icon_bounds.x(), icon_bounds.width()),
466 ideal_bounds.y() + icon_bounds.y(), 473 ideal_bounds.y() + icon_bounds.y(),
467 icon_bounds.width(), 474 icon_bounds.width(),
468 icon_bounds.height()); 475 icon_bounds.height());
469 } 476 }
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 last_hidden_index_ = DetermineFirstVisiblePanelIndex(end_position) - 1; 775 last_hidden_index_ = DetermineFirstVisiblePanelIndex(end_position) - 1;
769 bool show_overflow = last_visible_index_ < last_button_index || 776 bool show_overflow = last_visible_index_ < last_button_index ||
770 last_hidden_index_ >= first_panel_index; 777 last_hidden_index_ >= first_panel_index;
771 778
772 // Create Space for the overflow button 779 // Create Space for the overflow button
773 if (show_overflow && 780 if (show_overflow &&
774 last_visible_index_ > 0 && last_visible_index_ < last_button_index) 781 last_visible_index_ > 0 && last_visible_index_ < last_button_index)
775 --last_visible_index_; 782 --last_visible_index_;
776 for (int i = 0; i < view_model_->view_size(); ++i) { 783 for (int i = 0; i < view_model_->view_size(); ++i) {
777 bool visible = i <= last_visible_index_ || i > last_hidden_index_; 784 bool visible = i <= last_visible_index_ || i > last_hidden_index_;
778 // To receive drag event continously from |drag_view_| during the dragging 785 // To receive drag event continuously from |drag_view_| during the dragging
779 // off from the shelf, don't make |drag_view_| invisible. It will be 786 // off from the shelf, don't make |drag_view_| invisible. It will be
780 // eventually invisible and removed from the |view_model_| by 787 // eventually invisible and removed from the |view_model_| by
781 // FinalizeRipOffDrag(). 788 // FinalizeRipOffDrag().
782 if (dragged_off_shelf_ && view_model_->view_at(i) == drag_view_) 789 if (dragged_off_shelf_ && view_model_->view_at(i) == drag_view_)
783 continue; 790 continue;
784 view_model_->view_at(i)->SetVisible(visible); 791 view_model_->view_at(i)->SetVisible(visible);
785 } 792 }
786 793
787 overflow_button_->SetVisible(show_overflow); 794 overflow_button_->SetVisible(show_overflow);
788 if (show_overflow) { 795 if (show_overflow) {
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1916 distance = bounds.x() - coordinate.x(); 1923 distance = bounds.x() - coordinate.x();
1917 break; 1924 break;
1918 case SHELF_ALIGNMENT_TOP: 1925 case SHELF_ALIGNMENT_TOP:
1919 distance = coordinate.y() - bounds.bottom(); 1926 distance = coordinate.y() - bounds.bottom();
1920 break; 1927 break;
1921 } 1928 }
1922 return distance > 0 ? distance : 0; 1929 return distance > 0 ? distance : 0;
1923 } 1930 }
1924 1931
1925 } // namespace ash 1932 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_view.h ('k') | ash/shelf/shelf_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698