OLD | NEW |
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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 } | 563 } |
564 // Post a task to release the button. When we call the Run method on the menu | 564 // Post a task to release the button. When we call the Run method on the menu |
565 // below, it runs an inner message loop that might cause us to be deleted. | 565 // below, it runs an inner message loop that might cause us to be deleted. |
566 // Posting a task with a WeakPtr lets us safely handle the button release. | 566 // Posting a task with a WeakPtr lets us safely handle the button release. |
567 MessageLoop::current()->PostNonNestableTask( | 567 MessageLoop::current()->PostNonNestableTask( |
568 FROM_HERE, | 568 FROM_HERE, |
569 base::Bind(&DownloadItemView::ReleaseDropDown, | 569 base::Bind(&DownloadItemView::ReleaseDropDown, |
570 weak_ptr_factory_.GetWeakPtr())); | 570 weak_ptr_factory_.GetWeakPtr())); |
571 views::View::ConvertPointToScreen(this, &point); | 571 views::View::ConvertPointToScreen(this, &point); |
572 | 572 |
573 if (!context_menu_.get()) | 573 if (!context_menu_.get()) { |
574 context_menu_.reset(new DownloadShelfContextMenuView(model_.get())); | 574 context_menu_.reset( |
| 575 new DownloadShelfContextMenuView(model_.get(), |
| 576 parent_->GetNavigator())); |
| 577 } |
575 context_menu_->Run(GetWidget()->GetTopLevelWidget(), | 578 context_menu_->Run(GetWidget()->GetTopLevelWidget(), |
576 gfx::Rect(point, size)); | 579 gfx::Rect(point, size)); |
577 // We could be deleted now. | 580 // We could be deleted now. |
578 } | 581 } |
579 | 582 |
580 void DownloadItemView::GetAccessibleState(ui::AccessibleViewState* state) { | 583 void DownloadItemView::GetAccessibleState(ui::AccessibleViewState* state) { |
581 state->name = accessible_name_; | 584 state->name = accessible_name_; |
582 state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON; | 585 state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON; |
583 if (model_->IsDangerous()) { | 586 if (model_->IsDangerous()) { |
584 state->state = ui::AccessibilityTypes::STATE_UNAVAILABLE; | 587 state->state = ui::AccessibilityTypes::STATE_UNAVAILABLE; |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 // Drop down button is glued to the left of the download shelf. | 1180 // Drop down button is glued to the left of the download shelf. |
1178 drop_down_x_left_ = 0; | 1181 drop_down_x_left_ = 0; |
1179 drop_down_x_right_ = normal_drop_down_image_set_.top->width(); | 1182 drop_down_x_right_ = normal_drop_down_image_set_.top->width(); |
1180 } else { | 1183 } else { |
1181 // Drop down button is glued to the right of the download shelf. | 1184 // Drop down button is glued to the right of the download shelf. |
1182 drop_down_x_left_ = | 1185 drop_down_x_left_ = |
1183 size.width() - normal_drop_down_image_set_.top->width(); | 1186 size.width() - normal_drop_down_image_set_.top->width(); |
1184 drop_down_x_right_ = size.width(); | 1187 drop_down_x_right_ = size.width(); |
1185 } | 1188 } |
1186 } | 1189 } |
OLD | NEW |