| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_tile_item_view.h" | 5 #include "ui/app_list/views/search_result_tile_item_view.h" |
| 6 | 6 |
| 7 #include "ui/app_list/app_list_view_delegate.h" | 7 #include "ui/app_list/app_list_view_delegate.h" |
| 8 #include "ui/app_list/search_result.h" | 8 #include "ui/app_list/search_result.h" |
| 9 #include "ui/app_list/views/search_result_container_view.h" | 9 #include "ui/app_list/views/search_result_container_view.h" |
| 10 #include "ui/views/controls/menu/menu_runner.h" | 10 #include "ui/views/controls/menu/menu_runner.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 if (event.key_code() == ui::VKEY_RETURN) { | 66 if (event.key_code() == ui::VKEY_RETURN) { |
| 67 view_delegate_->OpenSearchResult(item_, false, event.flags()); | 67 view_delegate_->OpenSearchResult(item_, false, event.flags()); |
| 68 return true; | 68 return true; |
| 69 } | 69 } |
| 70 | 70 |
| 71 return false; | 71 return false; |
| 72 } | 72 } |
| 73 | 73 |
| 74 void SearchResultTileItemView::OnIconChanged() { | 74 void SearchResultTileItemView::OnIconChanged() { |
| 75 SetIcon(item_->icon()); | 75 SetIcon(item_->icon()); |
| 76 Layout(); |
| 76 } | 77 } |
| 77 | 78 |
| 78 void SearchResultTileItemView::OnBadgeIconChanged() { | 79 void SearchResultTileItemView::OnBadgeIconChanged() { |
| 79 SetBadgeIcon(item_->badge_icon()); | 80 SetBadgeIcon(item_->badge_icon()); |
| 81 Layout(); |
| 80 } | 82 } |
| 81 | 83 |
| 82 void SearchResultTileItemView::OnResultDestroying() { | 84 void SearchResultTileItemView::OnResultDestroying() { |
| 83 // The menu comes from |item_|. If we're showing a menu we need to cancel it. | 85 // The menu comes from |item_|. If we're showing a menu we need to cancel it. |
| 84 context_menu_runner_.reset(); | 86 context_menu_runner_.reset(); |
| 85 | 87 |
| 86 if (item_) | 88 if (item_) |
| 87 item_->RemoveObserver(this); | 89 item_->RemoveObserver(this); |
| 88 | 90 |
| 89 SetSearchResult(nullptr); | 91 SetSearchResult(nullptr); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 105 result_container_->ClearSelectedIndex(); | 107 result_container_->ClearSelectedIndex(); |
| 106 | 108 |
| 107 context_menu_runner_.reset( | 109 context_menu_runner_.reset( |
| 108 new views::MenuRunner(menu_model, views::MenuRunner::HAS_MNEMONICS)); | 110 new views::MenuRunner(menu_model, views::MenuRunner::HAS_MNEMONICS)); |
| 109 context_menu_runner_->RunMenuAt(GetWidget(), nullptr, | 111 context_menu_runner_->RunMenuAt(GetWidget(), nullptr, |
| 110 gfx::Rect(point, gfx::Size()), | 112 gfx::Rect(point, gfx::Size()), |
| 111 views::MENU_ANCHOR_TOPLEFT, source_type); | 113 views::MENU_ANCHOR_TOPLEFT, source_type); |
| 112 } | 114 } |
| 113 | 115 |
| 114 } // namespace app_list | 116 } // namespace app_list |
| OLD | NEW |