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

Side by Side Diff: ash/shelf/shelf_view.cc

Issue 2169533002: mash: Migrate shelf app list button to wm common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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
« no previous file with comments | « ash/shelf/shelf_tooltip_manager_unittest.cc ('k') | ash/shelf/shelf_view_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ash/shelf/shelf_view.h" 5 #include "ash/shelf/shelf_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 9
10 #include "ash/aura/wm_window_aura.h" 10 #include "ash/aura/wm_window_aura.h"
11 #include "ash/common/ash_constants.h" 11 #include "ash/common/ash_constants.h"
12 #include "ash/common/ash_switches.h" 12 #include "ash/common/ash_switches.h"
13 #include "ash/common/shelf/app_list_button.h"
13 #include "ash/common/shelf/overflow_bubble.h" 14 #include "ash/common/shelf/overflow_bubble.h"
14 #include "ash/common/shelf/overflow_bubble_view.h" 15 #include "ash/common/shelf/overflow_bubble_view.h"
15 #include "ash/common/shelf/overflow_button.h" 16 #include "ash/common/shelf/overflow_button.h"
16 #include "ash/common/shelf/shelf_constants.h" 17 #include "ash/common/shelf/shelf_constants.h"
17 #include "ash/common/shelf/shelf_item_delegate_manager.h" 18 #include "ash/common/shelf/shelf_item_delegate_manager.h"
18 #include "ash/common/shelf/shelf_menu_model.h" 19 #include "ash/common/shelf/shelf_menu_model.h"
19 #include "ash/common/shelf/shelf_model.h" 20 #include "ash/common/shelf/shelf_model.h"
20 #include "ash/common/shell_delegate.h" 21 #include "ash/common/shell_delegate.h"
21 #include "ash/common/wm/root_window_finder.h" 22 #include "ash/common/wm/root_window_finder.h"
22 #include "ash/common/wm_shell.h" 23 #include "ash/common/wm_shell.h"
23 #include "ash/drag_drop/drag_image_view.h" 24 #include "ash/drag_drop/drag_image_view.h"
24 #include "ash/scoped_target_root_window.h" 25 #include "ash/scoped_target_root_window.h"
25 #include "ash/shelf/app_list_button.h"
26 #include "ash/shelf/shelf.h" 26 #include "ash/shelf/shelf.h"
27 #include "ash/shelf/shelf_button.h" 27 #include "ash/shelf/shelf_button.h"
28 #include "ash/shelf/shelf_delegate.h" 28 #include "ash/shelf/shelf_delegate.h"
29 #include "ash/shelf/shelf_icon_observer.h" 29 #include "ash/shelf/shelf_icon_observer.h"
30 #include "ash/shelf/shelf_widget.h" 30 #include "ash/shelf/shelf_widget.h"
31 #include "ash/shell.h" 31 #include "ash/shell.h"
32 #include "base/auto_reset.h" 32 #include "base/auto_reset.h"
33 #include "base/metrics/histogram.h" 33 #include "base/metrics/histogram.h"
34 #include "grit/ash_strings.h" 34 #include "grit/ash_strings.h"
35 #include "ui/accessibility/ax_view_state.h" 35 #include "ui/accessibility/ax_view_state.h"
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 for (int i = 0; i < child_count(); ++i) { 525 for (int i = 0; i < child_count(); ++i) {
526 const views::View* child = child_at(i); 526 const views::View* child = child_at(i);
527 if (child != overflow_button_ && ShouldShowTooltipForView(child)) 527 if (child != overflow_button_ && ShouldShowTooltipForView(child))
528 tooltip_bounds.Union(child->GetMirroredBounds()); 528 tooltip_bounds.Union(child->GetMirroredBounds());
529 } 529 }
530 return !tooltip_bounds.Contains(cursor_location); 530 return !tooltip_bounds.Contains(cursor_location);
531 } 531 }
532 532
533 bool ShelfView::ShouldShowTooltipForView(const views::View* view) const { 533 bool ShelfView::ShouldShowTooltipForView(const views::View* view) const {
534 if (view == GetAppListButton() && 534 if (view == GetAppListButton() &&
535 Shell::GetInstance()->GetAppListTargetVisibility()) { 535 WmShell::Get()->GetAppListTargetVisibility()) {
536 return false; 536 return false;
537 } 537 }
538 const ShelfItem* item = ShelfItemForView(view); 538 const ShelfItem* item = ShelfItemForView(view);
539 if (!item) 539 if (!item)
540 return false; 540 return false;
541 return item_manager_->GetShelfItemDelegate(item->id)->ShouldShowTooltip(); 541 return item_manager_->GetShelfItemDelegate(item->id)->ShouldShowTooltip();
542 } 542 }
543 543
544 base::string16 ShelfView::GetTitleForView(const views::View* view) const { 544 base::string16 ShelfView::GetTitleForView(const views::View* view) const {
545 const ShelfItem* item = ShelfItemForView(view); 545 const ShelfItem* item = ShelfItemForView(view);
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 case TYPE_APP_PANEL: 1008 case TYPE_APP_PANEL:
1009 case TYPE_IME_MENU: { 1009 case TYPE_IME_MENU: {
1010 ShelfButton* button = new ShelfButton(this, this); 1010 ShelfButton* button = new ShelfButton(this, this);
1011 button->SetImage(item.image); 1011 button->SetImage(item.image);
1012 ReflectItemStatus(item, button); 1012 ReflectItemStatus(item, button);
1013 view = button; 1013 view = button;
1014 break; 1014 break;
1015 } 1015 }
1016 1016
1017 case TYPE_APP_LIST: { 1017 case TYPE_APP_LIST: {
1018 view = new AppListButton(this, this); 1018 view = new AppListButton(this, this, wm_shelf_);
1019 break; 1019 break;
1020 } 1020 }
1021 1021
1022 case TYPE_UNDEFINED: 1022 case TYPE_UNDEFINED:
1023 return nullptr; 1023 return nullptr;
1024 } 1024 }
1025 1025
1026 view->set_context_menu_controller(this); 1026 view->set_context_menu_controller(this);
1027 ConfigureChildView(view); 1027 ConfigureChildView(view);
1028 return view; 1028 return view;
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
1908 1908
1909 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { 1909 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const {
1910 const gfx::Rect bounds = GetBoundsInScreen(); 1910 const gfx::Rect bounds = GetBoundsInScreen();
1911 int distance = shelf_->SelectValueForShelfAlignment( 1911 int distance = shelf_->SelectValueForShelfAlignment(
1912 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), 1912 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(),
1913 bounds.x() - coordinate.x()); 1913 bounds.x() - coordinate.x());
1914 return distance > 0 ? distance : 0; 1914 return distance > 0 ? distance : 0;
1915 } 1915 }
1916 1916
1917 } // namespace ash 1917 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_tooltip_manager_unittest.cc ('k') | ash/shelf/shelf_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698