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

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

Issue 10828265: Replace views::LocatedEvent with ui::LocatedEvent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
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 908 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 if (!context_menu_.get()) { 919 if (!context_menu_.get()) {
920 context_menu_.reset( 920 context_menu_.reset(
921 new DownloadShelfContextMenuView(model_.get(), 921 new DownloadShelfContextMenuView(model_.get(),
922 parent_->GetNavigator())); 922 parent_->GetNavigator()));
923 } 923 }
924 context_menu_->Run(GetWidget()->GetTopLevelWidget(), 924 context_menu_->Run(GetWidget()->GetTopLevelWidget(),
925 gfx::Rect(point, size)); 925 gfx::Rect(point, size));
926 // We could be deleted now. 926 // We could be deleted now.
927 } 927 }
928 928
929 void DownloadItemView::HandlePressEvent(const views::LocatedEvent& event, 929 void DownloadItemView::HandlePressEvent(const ui::LocatedEvent& event,
930 bool active_event) { 930 bool active_event) {
931 // The event should not activate us in dangerous mode. 931 // The event should not activate us in dangerous mode.
932 if (mode_ == DANGEROUS_MODE) 932 if (mode_ == DANGEROUS_MODE)
933 return; 933 return;
934 934
935 // Stop any completion animation. 935 // Stop any completion animation.
936 if (complete_animation_.get() && complete_animation_->is_animating()) 936 if (complete_animation_.get() && complete_animation_->is_animating())
937 complete_animation_->End(); 937 complete_animation_->End();
938 938
939 if (active_event) { 939 if (active_event) {
940 if (InDropDownButtonXCoordinateRange(event.x())) { 940 if (InDropDownButtonXCoordinateRange(event.x())) {
941 drop_down_pressed_ = true; 941 drop_down_pressed_ = true;
942 SetState(NORMAL, PUSHED); 942 SetState(NORMAL, PUSHED);
943 // We are setting is_mouse_gesture to false when calling ShowContextMenu 943 // We are setting is_mouse_gesture to false when calling ShowContextMenu
944 // so that the positioning of the context menu will be similar to a 944 // so that the positioning of the context menu will be similar to a
945 // keyboard invocation. I.e. we want the menu to always be positioned 945 // keyboard invocation. I.e. we want the menu to always be positioned
946 // next to the drop down button instead of the next to the pointer. 946 // next to the drop down button instead of the next to the pointer.
947 ShowContextMenuImpl(event.location(), false); 947 ShowContextMenuImpl(event.location(), false);
948 // Once called, it is possible that *this was deleted (e.g.: due to 948 // Once called, it is possible that *this was deleted (e.g.: due to
949 // invoking the 'Discard' action.) 949 // invoking the 'Discard' action.)
950 } else if (!IsShowingWarningDialog()) { 950 } else if (!IsShowingWarningDialog()) {
951 SetState(PUSHED, NORMAL); 951 SetState(PUSHED, NORMAL);
952 } 952 }
953 } 953 }
954 } 954 }
955 955
956 void DownloadItemView::HandleClickEvent(const views::LocatedEvent& event, 956 void DownloadItemView::HandleClickEvent(const ui::LocatedEvent& event,
957 bool active_event) { 957 bool active_event) {
958 // Mouse should not activate us in dangerous mode. 958 // Mouse should not activate us in dangerous mode.
959 if (mode_ == DANGEROUS_MODE) 959 if (mode_ == DANGEROUS_MODE)
960 return; 960 return;
961 961
962 if (active_event && 962 if (active_event &&
963 !InDropDownButtonXCoordinateRange(event.x()) && 963 !InDropDownButtonXCoordinateRange(event.x()) &&
964 !IsShowingWarningDialog()) { 964 !IsShowingWarningDialog()) {
965 OpenDownload(); 965 OpenDownload();
966 } 966 }
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 // Drop down button is glued to the left of the download shelf. 1217 // Drop down button is glued to the left of the download shelf.
1218 drop_down_x_left_ = 0; 1218 drop_down_x_left_ = 0;
1219 drop_down_x_right_ = normal_drop_down_image_set_.top->width(); 1219 drop_down_x_right_ = normal_drop_down_image_set_.top->width();
1220 } else { 1220 } else {
1221 // Drop down button is glued to the right of the download shelf. 1221 // Drop down button is glued to the right of the download shelf.
1222 drop_down_x_left_ = 1222 drop_down_x_left_ =
1223 size.width() - normal_drop_down_image_set_.top->width(); 1223 size.width() - normal_drop_down_image_set_.top->width();
1224 drop_down_x_right_ = size.width(); 1224 drop_down_x_right_ = size.width();
1225 } 1225 }
1226 } 1226 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/download/download_item_view.h ('k') | chrome/browser/ui/views/dropdown_bar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698