| 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 "ui/app_list/app_list_constants.h" | 9 #include "ui/app_list/app_list_constants.h" |
| 10 #include "ui/app_list/search_result.h" | 10 #include "ui/app_list/search_result.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 void SearchResultView::OnIsInstallingChanged() { | 268 void SearchResultView::OnIsInstallingChanged() { |
| 269 const bool is_installing = result_ && result_->is_installing(); | 269 const bool is_installing = result_ && result_->is_installing(); |
| 270 actions_view_->SetVisible(!is_installing); | 270 actions_view_->SetVisible(!is_installing); |
| 271 progress_bar_->SetVisible(is_installing); | 271 progress_bar_->SetVisible(is_installing); |
| 272 } | 272 } |
| 273 | 273 |
| 274 void SearchResultView::OnPercentDownloadedChanged() { | 274 void SearchResultView::OnPercentDownloadedChanged() { |
| 275 progress_bar_->SetValue(result_->percent_downloaded() / 100.0); | 275 progress_bar_->SetValue(result_->percent_downloaded() / 100.0); |
| 276 } | 276 } |
| 277 | 277 |
| 278 void SearchResultView::OnItemInstalled() { |
| 279 delegate_->OnSearchResultInstalled(this); |
| 280 } |
| 281 |
| 278 void SearchResultView::OnSearchResultActionActivated(size_t index, | 282 void SearchResultView::OnSearchResultActionActivated(size_t index, |
| 279 int event_flags) { | 283 int event_flags) { |
| 280 DCHECK(result_); | 284 DCHECK(result_); |
| 281 DCHECK_LT(index, result_->actions().size()); | 285 DCHECK_LT(index, result_->actions().size()); |
| 282 | 286 |
| 283 delegate_->SearchResultActionActivated(this, index, event_flags); | 287 delegate_->SearchResultActionActivated(this, index, event_flags); |
| 284 } | 288 } |
| 285 | 289 |
| 286 void SearchResultView::ShowContextMenuForView(views::View* source, | 290 void SearchResultView::ShowContextMenuForView(views::View* source, |
| 287 const gfx::Point& point, | 291 const gfx::Point& point, |
| 288 ui::MenuSourceType source_type) { | 292 ui::MenuSourceType source_type) { |
| 289 ui::MenuModel* menu_model = result_->GetContextMenuModel(); | 293 ui::MenuModel* menu_model = result_->GetContextMenuModel(); |
| 290 if (!menu_model) | 294 if (!menu_model) |
| 291 return; | 295 return; |
| 292 | 296 |
| 293 context_menu_runner_.reset(new views::MenuRunner(menu_model)); | 297 context_menu_runner_.reset(new views::MenuRunner(menu_model)); |
| 294 if (context_menu_runner_->RunMenuAt( | 298 if (context_menu_runner_->RunMenuAt( |
| 295 GetWidget(), NULL, gfx::Rect(point, gfx::Size()), | 299 GetWidget(), NULL, gfx::Rect(point, gfx::Size()), |
| 296 views::MenuItemView::TOPLEFT, source_type, | 300 views::MenuItemView::TOPLEFT, source_type, |
| 297 views::MenuRunner::HAS_MNEMONICS) == | 301 views::MenuRunner::HAS_MNEMONICS) == |
| 298 views::MenuRunner::MENU_DELETED) | 302 views::MenuRunner::MENU_DELETED) |
| 299 return; | 303 return; |
| 300 } | 304 } |
| 301 | 305 |
| 302 } // namespace app_list | 306 } // namespace app_list |
| OLD | NEW |