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

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

Issue 145033006: views: Make View::set_border() take a scoped_ptr<>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT Created 6 years, 11 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/ime/infolist_window.cc ('k') | ash/system/chromeos/audio/tray_audio.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 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 898
899 void ShelfView::AnimateToIdealBounds() { 899 void ShelfView::AnimateToIdealBounds() {
900 IdealBounds ideal_bounds; 900 IdealBounds ideal_bounds;
901 CalculateIdealBounds(&ideal_bounds); 901 CalculateIdealBounds(&ideal_bounds);
902 for (int i = 0; i < view_model_->view_size(); ++i) { 902 for (int i = 0; i < view_model_->view_size(); ++i) {
903 View* view = view_model_->view_at(i); 903 View* view = view_model_->view_at(i);
904 bounds_animator_->AnimateViewTo(view, view_model_->ideal_bounds(i)); 904 bounds_animator_->AnimateViewTo(view, view_model_->ideal_bounds(i));
905 // Now that the item animation starts, we have to make sure that the 905 // Now that the item animation starts, we have to make sure that the
906 // padding of the first gets properly transferred to the new first item. 906 // padding of the first gets properly transferred to the new first item.
907 if (i && view->border()) 907 if (i && view->border())
908 view->set_border(NULL); 908 view->SetBorder(views::Border::NullBorder());
909 else if (!i && !view->border()) 909 else if (!i && !view->border())
910 UpdateFirstButtonPadding(); 910 UpdateFirstButtonPadding();
911 } 911 }
912 overflow_button_->SetBoundsRect(ideal_bounds.overflow_bounds); 912 overflow_button_->SetBoundsRect(ideal_bounds.overflow_bounds);
913 } 913 }
914 914
915 views::View* ShelfView::CreateViewForItem(const LauncherItem& item) { 915 views::View* ShelfView::CreateViewForItem(const LauncherItem& item) {
916 views::View* view = NULL; 916 views::View* view = NULL;
917 switch (item.type) { 917 switch (item.type) {
918 case TYPE_BROWSER_SHORTCUT: 918 case TYPE_BROWSER_SHORTCUT:
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 } 1307 }
1308 1308
1309 void ShelfView::UpdateFirstButtonPadding() { 1309 void ShelfView::UpdateFirstButtonPadding() {
1310 if (ash::switches::UseAlternateShelfLayout()) 1310 if (ash::switches::UseAlternateShelfLayout())
1311 return; 1311 return;
1312 1312
1313 // Creates an empty border for first shelf button to make included leading 1313 // Creates an empty border for first shelf button to make included leading
1314 // inset act as the button's padding. This is only needed on button creation 1314 // inset act as the button's padding. This is only needed on button creation
1315 // and when shelf alignment changes. 1315 // and when shelf alignment changes.
1316 if (view_model_->view_size() > 0) { 1316 if (view_model_->view_size() > 0) {
1317 view_model_->view_at(0)->set_border(views::Border::CreateEmptyBorder( 1317 view_model_->view_at(0)->SetBorder(views::Border::CreateEmptyBorder(
1318 layout_manager_->PrimaryAxisValue(0, leading_inset_), 1318 layout_manager_->PrimaryAxisValue(0, leading_inset_),
1319 layout_manager_->PrimaryAxisValue(leading_inset_, 0), 1319 layout_manager_->PrimaryAxisValue(leading_inset_, 0),
1320 0, 1320 0,
1321 0)); 1321 0));
1322 } 1322 }
1323 } 1323 }
1324 1324
1325 void ShelfView::OnFadeOutAnimationEnded() { 1325 void ShelfView::OnFadeOutAnimationEnded() {
1326 AnimateToIdealBounds(); 1326 AnimateToIdealBounds();
1327 StartFadeInLastVisibleItem(); 1327 StartFadeInLastVisibleItem();
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
2023 break; 2023 break;
2024 case SHELF_ALIGNMENT_TOP: 2024 case SHELF_ALIGNMENT_TOP:
2025 distance = coordinate.y() - bounds.bottom(); 2025 distance = coordinate.y() - bounds.bottom();
2026 break; 2026 break;
2027 } 2027 }
2028 return distance > 0 ? distance : 0; 2028 return distance > 0 ? distance : 0;
2029 } 2029 }
2030 2030
2031 } // namespace internal 2031 } // namespace internal
2032 } // namespace ash 2032 } // namespace ash
OLDNEW
« no previous file with comments | « ash/ime/infolist_window.cc ('k') | ash/system/chromeos/audio/tray_audio.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698