| 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 "ui/app_list/views/search_result_view.h" | 5 #include "ui/app_list/views/search_result_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 "ui/app_list/app_list_constants.h" | 10 #include "ui/app_list/app_list_constants.h" |
| 11 #include "ui/app_list/app_list_switches.h" | 11 #include "ui/app_list/app_list_switches.h" |
| 12 #include "ui/app_list/search_result.h" | 12 #include "ui/app_list/search_result.h" |
| 13 #include "ui/app_list/views/progress_bar_view.h" | |
| 14 #include "ui/app_list/views/search_result_actions_view.h" | 13 #include "ui/app_list/views/search_result_actions_view.h" |
| 15 #include "ui/app_list/views/search_result_list_view.h" | 14 #include "ui/app_list/views/search_result_list_view.h" |
| 16 #include "ui/gfx/canvas.h" | 15 #include "ui/gfx/canvas.h" |
| 17 #include "ui/gfx/font.h" | 16 #include "ui/gfx/font.h" |
| 18 #include "ui/gfx/image/image_skia_operations.h" | 17 #include "ui/gfx/image/image_skia_operations.h" |
| 19 #include "ui/gfx/render_text.h" | 18 #include "ui/gfx/render_text.h" |
| 20 #include "ui/views/controls/button/image_button.h" | 19 #include "ui/views/controls/button/image_button.h" |
| 21 #include "ui/views/controls/image_view.h" | 20 #include "ui/views/controls/image_view.h" |
| 22 #include "ui/views/controls/menu/menu_runner.h" | 21 #include "ui/views/controls/menu/menu_runner.h" |
| 22 #include "ui/views/controls/progress_bar.h" |
| 23 | 23 |
| 24 namespace app_list { | 24 namespace app_list { |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 const int kPreferredWidth = 300; | 28 const int kPreferredWidth = 300; |
| 29 const int kPreferredHeight = 56; | 29 const int kPreferredHeight = 56; |
| 30 const int kIconLeftPadding = 16; | 30 const int kIconLeftPadding = 16; |
| 31 const int kIconRightPadding = 24; | 31 const int kIconRightPadding = 24; |
| 32 const int kTextTrailPadding = 16; | 32 const int kTextTrailPadding = 16; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 const char SearchResultView::kViewClassName[] = "ui/app_list/SearchResultView"; | 73 const char SearchResultView::kViewClassName[] = "ui/app_list/SearchResultView"; |
| 74 | 74 |
| 75 SearchResultView::SearchResultView(SearchResultListView* list_view) | 75 SearchResultView::SearchResultView(SearchResultListView* list_view) |
| 76 : views::CustomButton(this), | 76 : views::CustomButton(this), |
| 77 result_(NULL), | 77 result_(NULL), |
| 78 is_last_result_(false), | 78 is_last_result_(false), |
| 79 list_view_(list_view), | 79 list_view_(list_view), |
| 80 icon_(new views::ImageView), | 80 icon_(new views::ImageView), |
| 81 badge_icon_(new views::ImageView), | 81 badge_icon_(new views::ImageView), |
| 82 actions_view_(new SearchResultActionsView(this)), | 82 actions_view_(new SearchResultActionsView(this)), |
| 83 progress_bar_(new ProgressBarView) { | 83 progress_bar_(new views::ProgressBar) { |
| 84 icon_->set_interactive(false); | 84 icon_->set_interactive(false); |
| 85 badge_icon_->set_interactive(false); | 85 badge_icon_->set_interactive(false); |
| 86 | 86 |
| 87 AddChildView(icon_); | 87 AddChildView(icon_); |
| 88 AddChildView(badge_icon_); | 88 AddChildView(badge_icon_); |
| 89 AddChildView(actions_view_); | 89 AddChildView(actions_view_); |
| 90 AddChildView(progress_bar_); | 90 AddChildView(progress_bar_); |
| 91 set_context_menu_controller(this); | 91 set_context_menu_controller(this); |
| 92 } | 92 } |
| 93 | 93 |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 return; | 412 return; |
| 413 | 413 |
| 414 context_menu_runner_.reset(new views::MenuRunner( | 414 context_menu_runner_.reset(new views::MenuRunner( |
| 415 menu_model, views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::ASYNC)); | 415 menu_model, views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::ASYNC)); |
| 416 context_menu_runner_->RunMenuAt(GetWidget(), NULL, | 416 context_menu_runner_->RunMenuAt(GetWidget(), NULL, |
| 417 gfx::Rect(point, gfx::Size()), | 417 gfx::Rect(point, gfx::Size()), |
| 418 views::MENU_ANCHOR_TOPLEFT, source_type); | 418 views::MENU_ANCHOR_TOPLEFT, source_type); |
| 419 } | 419 } |
| 420 | 420 |
| 421 } // namespace app_list | 421 } // namespace app_list |
| OLD | NEW |