Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: ui/app_list/views/app_list_item_view.cc

Issue 331993009: MacViews: Run native Cocoa context menus to support Services. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add VIEWS_EXPORT for unit test access Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/app_list_item_view.h" 5 #include "ui/app_list/views/app_list_item_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 "grit/ui_strings.h" 10 #include "grit/ui_strings.h"
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 } 357 }
358 } 358 }
359 359
360 void AppListItemView::ShowContextMenuForView(views::View* source, 360 void AppListItemView::ShowContextMenuForView(views::View* source,
361 const gfx::Point& point, 361 const gfx::Point& point,
362 ui::MenuSourceType source_type) { 362 ui::MenuSourceType source_type) {
363 ui::MenuModel* menu_model = item_->GetContextMenuModel(); 363 ui::MenuModel* menu_model = item_->GetContextMenuModel();
364 if (!menu_model) 364 if (!menu_model)
365 return; 365 return;
366 366
367 context_menu_runner_.reset(new views::MenuRunner(menu_model)); 367 context_menu_runner_.reset(
368 new views::MenuRunner(menu_model, views::MenuRunner::HAS_MNEMONICS));
368 if (context_menu_runner_->RunMenuAt(GetWidget(), 369 if (context_menu_runner_->RunMenuAt(GetWidget(),
369 NULL, 370 NULL,
370 gfx::Rect(point, gfx::Size()), 371 gfx::Rect(point, gfx::Size()),
371 views::MENU_ANCHOR_TOPLEFT, 372 views::MENU_ANCHOR_TOPLEFT,
372 source_type, 373 source_type) ==
373 views::MenuRunner::HAS_MNEMONICS) ==
374 views::MenuRunner::MENU_DELETED) { 374 views::MenuRunner::MENU_DELETED) {
375 return; 375 return;
376 } 376 }
377 } 377 }
378 378
379 void AppListItemView::StateChanged() { 379 void AppListItemView::StateChanged() {
380 const bool is_folder_ui_enabled = apps_grid_view_->model()->folders_enabled(); 380 const bool is_folder_ui_enabled = apps_grid_view_->model()->folders_enabled();
381 if (is_folder_ui_enabled) 381 if (is_folder_ui_enabled)
382 apps_grid_view_->ClearAnySelectedView(); 382 apps_grid_view_->ClearAnySelectedView();
383 383
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 const int left_right_padding = 524 const int left_right_padding =
525 title_->font_list().GetExpectedTextWidth(kLeftRightPaddingChars); 525 title_->font_list().GetExpectedTextWidth(kLeftRightPaddingChars);
526 rect.Inset(left_right_padding, kTopPadding, left_right_padding, 0); 526 rect.Inset(left_right_padding, kTopPadding, left_right_padding, 0);
527 527
528 gfx::Rect icon_bounds(rect.x(), rect.y(), rect.width(), icon_size_.height()); 528 gfx::Rect icon_bounds(rect.x(), rect.y(), rect.width(), icon_size_.height());
529 icon_bounds.Inset(gfx::ShadowValue::GetMargin(icon_shadows_)); 529 icon_bounds.Inset(gfx::ShadowValue::GetMargin(icon_shadows_));
530 return icon_bounds; 530 return icon_bounds;
531 } 531 }
532 532
533 } // namespace app_list 533 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698