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 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 21 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
22 #include "chrome/browser/download/download_item_model.h" | 22 #include "chrome/browser/download/download_item_model.h" |
23 #include "chrome/browser/download/download_util.h" | 23 #include "chrome/browser/download/download_util.h" |
24 #include "chrome/browser/themes/theme_service.h" | 24 #include "chrome/browser/themes/theme_service.h" |
25 #include "chrome/browser/ui/views/download/download_shelf_context_menu_view.h" | 25 #include "chrome/browser/ui/views/download/download_shelf_context_menu_view.h" |
26 #include "chrome/browser/ui/views/download/download_shelf_view.h" | 26 #include "chrome/browser/ui/views/download/download_shelf_view.h" |
27 #include "grit/generated_resources.h" | 27 #include "grit/generated_resources.h" |
28 #include "grit/theme_resources.h" | 28 #include "grit/theme_resources.h" |
29 #include "ui/base/accessibility/accessible_view_state.h" | 29 #include "ui/base/accessibility/accessible_view_state.h" |
30 #include "ui/base/animation/slide_animation.h" | 30 #include "ui/base/animation/slide_animation.h" |
| 31 #include "ui/base/event.h" |
31 #include "ui/base/l10n/l10n_util.h" | 32 #include "ui/base/l10n/l10n_util.h" |
32 #include "ui/base/resource/resource_bundle.h" | 33 #include "ui/base/resource/resource_bundle.h" |
33 #include "ui/base/text/text_elider.h" | 34 #include "ui/base/text/text_elider.h" |
34 #include "ui/gfx/canvas.h" | 35 #include "ui/gfx/canvas.h" |
35 #include "ui/gfx/color_utils.h" | 36 #include "ui/gfx/color_utils.h" |
36 #include "ui/gfx/image/image.h" | 37 #include "ui/gfx/image/image.h" |
37 #include "ui/views/controls/button/text_button.h" | 38 #include "ui/views/controls/button/text_button.h" |
38 #include "ui/views/controls/label.h" | 39 #include "ui/views/controls/label.h" |
39 #include "ui/views/widget/root_view.h" | 40 #include "ui/views/widget/root_view.h" |
40 #include "ui/views/widget/widget.h" | 41 #include "ui/views/widget/widget.h" |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 // Mouse should not activate us in dangerous mode. | 475 // Mouse should not activate us in dangerous mode. |
475 if (mode_ == DANGEROUS_MODE) | 476 if (mode_ == DANGEROUS_MODE) |
476 return; | 477 return; |
477 | 478 |
478 SetState(NORMAL, drop_down_pressed_ ? PUSHED : NORMAL); | 479 SetState(NORMAL, drop_down_pressed_ ? PUSHED : NORMAL); |
479 if (!IsShowingWarningDialog()) | 480 if (!IsShowingWarningDialog()) |
480 body_hover_animation_->Hide(); | 481 body_hover_animation_->Hide(); |
481 drop_hover_animation_->Hide(); | 482 drop_hover_animation_->Hide(); |
482 } | 483 } |
483 | 484 |
484 bool DownloadItemView::OnKeyPressed(const views::KeyEvent& event) { | 485 bool DownloadItemView::OnKeyPressed(const ui::KeyEvent& event) { |
485 // Key press should not activate us in dangerous mode. | 486 // Key press should not activate us in dangerous mode. |
486 if (IsShowingWarningDialog()) | 487 if (IsShowingWarningDialog()) |
487 return true; | 488 return true; |
488 | 489 |
489 if (event.key_code() == ui::VKEY_SPACE || | 490 if (event.key_code() == ui::VKEY_SPACE || |
490 event.key_code() == ui::VKEY_RETURN) { | 491 event.key_code() == ui::VKEY_RETURN) { |
491 OpenDownload(); | 492 OpenDownload(); |
492 return true; | 493 return true; |
493 } | 494 } |
494 return false; | 495 return false; |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1215 // Drop down button is glued to the left of the download shelf. | 1216 // Drop down button is glued to the left of the download shelf. |
1216 drop_down_x_left_ = 0; | 1217 drop_down_x_left_ = 0; |
1217 drop_down_x_right_ = normal_drop_down_image_set_.top->width(); | 1218 drop_down_x_right_ = normal_drop_down_image_set_.top->width(); |
1218 } else { | 1219 } else { |
1219 // Drop down button is glued to the right of the download shelf. | 1220 // Drop down button is glued to the right of the download shelf. |
1220 drop_down_x_left_ = | 1221 drop_down_x_left_ = |
1221 size.width() - normal_drop_down_image_set_.top->width(); | 1222 size.width() - normal_drop_down_image_set_.top->width(); |
1222 drop_down_x_right_ = size.width(); | 1223 drop_down_x_right_ = size.width(); |
1223 } | 1224 } |
1224 } | 1225 } |
OLD | NEW |