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

Side by Side Diff: ui/app_list/views/app_list_item_view.cc

Issue 303543004: MacViews: views_examples_with_content_exe working! Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add files 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 | « ui/app_list/views/app_list_folder_view.cc ('k') | ui/app_list/views/app_list_main_view.h » ('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 "ui/app_list/views/app_list_item_view.h" 5 #include "ui/app_list/views/app_list_item_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "grit/ui_strings.h" 10 #include "grit/ui_strings.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 title_->SetVisible(!item_->is_installing()); 163 title_->SetVisible(!item_->is_installing());
164 progress_bar_->SetVisible(item_->is_installing()); 164 progress_bar_->SetVisible(item_->is_installing());
165 break; 165 break;
166 case UI_STATE_DRAGGING: 166 case UI_STATE_DRAGGING:
167 title_->SetVisible(false); 167 title_->SetVisible(false);
168 progress_bar_->SetVisible(false); 168 progress_bar_->SetVisible(false);
169 break; 169 break;
170 case UI_STATE_DROPPING_IN_FOLDER: 170 case UI_STATE_DROPPING_IN_FOLDER:
171 break; 171 break;
172 } 172 }
173 SchedulePaint();
174 if (!layer())
175 return;
176
173 #if !defined(OS_WIN) 177 #if !defined(OS_WIN)
174 ui::ScopedLayerAnimationSettings settings(layer()->GetAnimator()); 178 ui::ScopedLayerAnimationSettings settings(layer()->GetAnimator());
175 switch (ui_state_) { 179 switch (ui_state_) {
176 case UI_STATE_NORMAL: 180 case UI_STATE_NORMAL:
177 layer()->SetTransform(gfx::Transform()); 181 layer()->SetTransform(gfx::Transform());
178 break; 182 break;
179 case UI_STATE_DRAGGING: { 183 case UI_STATE_DRAGGING: {
180 const gfx::Rect bounds(layer()->bounds().size()); 184 const gfx::Rect bounds(layer()->bounds().size());
181 layer()->SetTransform(gfx::GetScaleTransform( 185 layer()->SetTransform(gfx::GetScaleTransform(
182 bounds.CenterPoint(), 186 bounds.CenterPoint(),
183 kDraggingIconScale)); 187 kDraggingIconScale));
184 break; 188 break;
185 } 189 }
186 case UI_STATE_DROPPING_IN_FOLDER: 190 case UI_STATE_DROPPING_IN_FOLDER:
187 break; 191 break;
188 } 192 }
189 #endif // !OS_WIN 193 #endif // !OS_WIN
190
191 SchedulePaint();
192 } 194 }
193 195
194 void AppListItemView::SetTouchDragging(bool touch_dragging) { 196 void AppListItemView::SetTouchDragging(bool touch_dragging) {
195 if (touch_dragging_ == touch_dragging) 197 if (touch_dragging_ == touch_dragging)
196 return; 198 return;
197 199
198 touch_dragging_ = touch_dragging; 200 touch_dragging_ = touch_dragging;
199 SetUIState(touch_dragging_ ? UI_STATE_DRAGGING : UI_STATE_NORMAL); 201 SetUIState(touch_dragging_ ? UI_STATE_DRAGGING : UI_STATE_NORMAL);
200 } 202 }
201 203
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 progress_bar_bounds.set_y(title_bounds.y()); 328 progress_bar_bounds.set_y(title_bounds.y());
327 progress_bar_->SetBoundsRect(progress_bar_bounds); 329 progress_bar_->SetBoundsRect(progress_bar_bounds);
328 } 330 }
329 331
330 void AppListItemView::SchedulePaintInRect(const gfx::Rect& r) { 332 void AppListItemView::SchedulePaintInRect(const gfx::Rect& r) {
331 SetTitleSubpixelAA(); 333 SetTitleSubpixelAA();
332 views::CustomButton::SchedulePaintInRect(r); 334 views::CustomButton::SchedulePaintInRect(r);
333 } 335 }
334 336
335 void AppListItemView::OnPaint(gfx::Canvas* canvas) { 337 void AppListItemView::OnPaint(gfx::Canvas* canvas) {
338 DLOG(INFO) << "painty;";
336 if (apps_grid_view_->IsDraggedView(this)) 339 if (apps_grid_view_->IsDraggedView(this))
337 return; 340 return;
338 341
339 gfx::Rect rect(GetContentsBounds()); 342 gfx::Rect rect(GetContentsBounds());
340 if (item_->highlighted() && !item_->is_installing()) { 343 if (item_->highlighted() && !item_->is_installing()) {
341 canvas->FillRect(rect, kHighlightedColor); 344 canvas->FillRect(rect, kHighlightedColor);
342 return; 345 return;
343 } else if (apps_grid_view_->IsSelectedView(this)) { 346 } else if (apps_grid_view_->IsSelectedView(this)) {
344 canvas->FillRect(rect, kSelectedColor); 347 canvas->FillRect(rect, kSelectedColor);
345 } 348 }
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 const int left_right_padding = 532 const int left_right_padding =
530 title_->font_list().GetExpectedTextWidth(kLeftRightPaddingChars); 533 title_->font_list().GetExpectedTextWidth(kLeftRightPaddingChars);
531 rect.Inset(left_right_padding, kTopPadding, left_right_padding, 0); 534 rect.Inset(left_right_padding, kTopPadding, left_right_padding, 0);
532 535
533 gfx::Rect icon_bounds(rect.x(), rect.y(), rect.width(), icon_size_.height()); 536 gfx::Rect icon_bounds(rect.x(), rect.y(), rect.width(), icon_size_.height());
534 icon_bounds.Inset(gfx::ShadowValue::GetMargin(icon_shadows_)); 537 icon_bounds.Inset(gfx::ShadowValue::GetMargin(icon_shadows_));
535 return icon_bounds; 538 return icon_bounds;
536 } 539 }
537 540
538 } // namespace app_list 541 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/views/app_list_folder_view.cc ('k') | ui/app_list/views/app_list_main_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698