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

Side by Side Diff: chrome/browser/ui/views/download/download_item_view.cc

Issue 11269022: Add Vector2d classes that represent offsets, instead of using Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: RenderText fixup Created 8 years, 1 month 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
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 "chrome/browser/ui/views/download/download_item_view.h" 5 #include "chrome/browser/ui/views/download/download_item_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 if (download_->IsComplete()) { 419 if (download_->IsComplete()) {
420 IconManager* im = g_browser_process->icon_manager(); 420 IconManager* im = g_browser_process->icon_manager();
421 gfx::Image* icon = im->LookupIcon(download_->GetUserVerifiedFilePath(), 421 gfx::Image* icon = im->LookupIcon(download_->GetUserVerifiedFilePath(),
422 IconLoader::SMALL); 422 IconLoader::SMALL);
423 if (icon) { 423 if (icon) {
424 views::Widget* widget = GetWidget(); 424 views::Widget* widget = GetWidget();
425 download_util::DragDownload(download_, icon, 425 download_util::DragDownload(download_, icon,
426 widget ? widget->GetNativeView() : NULL); 426 widget ? widget->GetNativeView() : NULL);
427 } 427 }
428 } 428 }
429 } else if (ExceededDragThreshold( 429 } else if (ExceededDragThreshold(event.location() - drag_start_point_)) {
430 event.location().x() - drag_start_point_.x(),
431 event.location().y() - drag_start_point_.y())) {
432 dragging_ = true; 430 dragging_ = true;
433 } 431 }
434 return true; 432 return true;
435 } 433 }
436 434
437 void DownloadItemView::OnMouseReleased(const ui::MouseEvent& event) { 435 void DownloadItemView::OnMouseReleased(const ui::MouseEvent& event) {
438 HandleClickEvent(event, event.IsOnlyLeftMouseButton()); 436 HandleClickEvent(event, event.IsOnlyLeftMouseButton());
439 } 437 }
440 438
441 void DownloadItemView::OnMouseCaptureLost() { 439 void DownloadItemView::OnMouseCaptureLost() {
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 667
670 // Paint the background images. 668 // Paint the background images.
671 int x = kLeftPadding; 669 int x = kLeftPadding;
672 canvas->Save(); 670 canvas->Save();
673 if (base::i18n::IsRTL()) { 671 if (base::i18n::IsRTL()) {
674 // Since we do not have the mirrored images for 672 // Since we do not have the mirrored images for
675 // (hot_)body_image_set->top_left, (hot_)body_image_set->left, 673 // (hot_)body_image_set->top_left, (hot_)body_image_set->left,
676 // (hot_)body_image_set->bottom_left, and drop_down_image_set, 674 // (hot_)body_image_set->bottom_left, and drop_down_image_set,
677 // for RTL UI, we flip the canvas to draw those images mirrored. 675 // for RTL UI, we flip the canvas to draw those images mirrored.
678 // Consequently, we do not need to mirror the x-axis of those images. 676 // Consequently, we do not need to mirror the x-axis of those images.
679 canvas->Translate(gfx::Point(width(), 0)); 677 canvas->Translate(gfx::Vector2d(width(), 0));
680 canvas->Scale(-1, 1); 678 canvas->Scale(-1, 1);
681 } 679 }
682 PaintImages(canvas, 680 PaintImages(canvas,
683 body_image_set->top_left, body_image_set->left, 681 body_image_set->top_left, body_image_set->left,
684 body_image_set->bottom_left, 682 body_image_set->bottom_left,
685 x, box_y_, box_height_, body_image_set->top_left->width()); 683 x, box_y_, box_height_, body_image_set->top_left->width());
686 x += body_image_set->top_left->width(); 684 x += body_image_set->top_left->width();
687 PaintImages(canvas, 685 PaintImages(canvas,
688 body_image_set->top, body_image_set->center, 686 body_image_set->top, body_image_set->center,
689 body_image_set->bottom, 687 body_image_set->bottom,
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 void DownloadItemView::AnimateStateTransition(State from, State to, 1224 void DownloadItemView::AnimateStateTransition(State from, State to,
1227 ui::SlideAnimation* animation) { 1225 ui::SlideAnimation* animation) {
1228 if (from == NORMAL && to == HOT) { 1226 if (from == NORMAL && to == HOT) {
1229 animation->Show(); 1227 animation->Show();
1230 } else if (from == HOT && to == NORMAL) { 1228 } else if (from == HOT && to == NORMAL) {
1231 animation->Hide(); 1229 animation->Hide();
1232 } else if (from != to) { 1230 } else if (from != to) {
1233 animation->Reset((to == HOT) ? 1.0 : 0.0); 1231 animation->Reset((to == HOT) ? 1.0 : 0.0);
1234 } 1232 }
1235 } 1233 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698