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

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

Issue 1978443002: Make the IME menu panel more system-like. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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_model.cc ('k') | chrome/browser/ui/ash/launcher/launcher_item_controller.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/ash_constants.h" 10 #include "ash/ash_constants.h"
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 } 979 }
980 980
981 views::View* ShelfView::CreateViewForItem(const ShelfItem& item) { 981 views::View* ShelfView::CreateViewForItem(const ShelfItem& item) {
982 views::View* view = nullptr; 982 views::View* view = nullptr;
983 switch (item.type) { 983 switch (item.type) {
984 case TYPE_BROWSER_SHORTCUT: 984 case TYPE_BROWSER_SHORTCUT:
985 case TYPE_APP_SHORTCUT: 985 case TYPE_APP_SHORTCUT:
986 case TYPE_WINDOWED_APP: 986 case TYPE_WINDOWED_APP:
987 case TYPE_PLATFORM_APP: 987 case TYPE_PLATFORM_APP:
988 case TYPE_DIALOG: 988 case TYPE_DIALOG:
989 case TYPE_APP_PANEL: { 989 case TYPE_APP_PANEL:
990 case TYPE_IME_MENU: {
990 ShelfButton* button = new ShelfButton(this); 991 ShelfButton* button = new ShelfButton(this);
991 button->SetImage(item.image); 992 button->SetImage(item.image);
992 ReflectItemStatus(item, button); 993 ReflectItemStatus(item, button);
993 view = button; 994 view = button;
994 break; 995 break;
995 } 996 }
996 997
997 case TYPE_APP_LIST: { 998 case TYPE_APP_LIST: {
998 view = new AppListButton(this); 999 view = new AppListButton(this);
999 break; 1000 break;
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1305 bool ShelfView::SameDragType(ShelfItemType typea, ShelfItemType typeb) const { 1306 bool ShelfView::SameDragType(ShelfItemType typea, ShelfItemType typeb) const {
1306 switch (typea) { 1307 switch (typea) {
1307 case TYPE_APP_SHORTCUT: 1308 case TYPE_APP_SHORTCUT:
1308 case TYPE_BROWSER_SHORTCUT: 1309 case TYPE_BROWSER_SHORTCUT:
1309 return (typeb == TYPE_APP_SHORTCUT || typeb == TYPE_BROWSER_SHORTCUT); 1310 return (typeb == TYPE_APP_SHORTCUT || typeb == TYPE_BROWSER_SHORTCUT);
1310 case TYPE_APP_LIST: 1311 case TYPE_APP_LIST:
1311 case TYPE_PLATFORM_APP: 1312 case TYPE_PLATFORM_APP:
1312 case TYPE_WINDOWED_APP: 1313 case TYPE_WINDOWED_APP:
1313 case TYPE_APP_PANEL: 1314 case TYPE_APP_PANEL:
1314 case TYPE_DIALOG: 1315 case TYPE_DIALOG:
1316 case TYPE_IME_MENU:
1315 return typeb == typea; 1317 return typeb == typea;
1316 case TYPE_UNDEFINED: 1318 case TYPE_UNDEFINED:
1317 NOTREACHED() << "ShelfItemType must be set."; 1319 NOTREACHED() << "ShelfItemType must be set.";
1318 return false; 1320 return false;
1319 } 1321 }
1320 NOTREACHED(); 1322 NOTREACHED();
1321 return false; 1323 return false;
1322 } 1324 }
1323 1325
1324 std::pair<int, int> ShelfView::GetDragRange(int index) { 1326 std::pair<int, int> ShelfView::GetDragRange(int index) {
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
1626 1628
1627 views::View* view = view_model_->view_at(model_index); 1629 views::View* view = view_model_->view_at(model_index);
1628 switch (item.type) { 1630 switch (item.type) {
1629 case TYPE_BROWSER_SHORTCUT: 1631 case TYPE_BROWSER_SHORTCUT:
1630 // Fallthrough for the new Shelf since it needs to show the activation 1632 // Fallthrough for the new Shelf since it needs to show the activation
1631 // change as well. 1633 // change as well.
1632 case TYPE_APP_SHORTCUT: 1634 case TYPE_APP_SHORTCUT:
1633 case TYPE_WINDOWED_APP: 1635 case TYPE_WINDOWED_APP:
1634 case TYPE_PLATFORM_APP: 1636 case TYPE_PLATFORM_APP:
1635 case TYPE_DIALOG: 1637 case TYPE_DIALOG:
1636 case TYPE_APP_PANEL: { 1638 case TYPE_APP_PANEL:
1639 case TYPE_IME_MENU: {
1637 CHECK_EQ(ShelfButton::kViewClassName, view->GetClassName()); 1640 CHECK_EQ(ShelfButton::kViewClassName, view->GetClassName());
1638 ShelfButton* button = static_cast<ShelfButton*>(view); 1641 ShelfButton* button = static_cast<ShelfButton*>(view);
1639 ReflectItemStatus(item, button); 1642 ReflectItemStatus(item, button);
1640 // The browser shortcut is currently not a "real" item and as such the 1643 // The browser shortcut is currently not a "real" item and as such the
1641 // the image is bogous as well. We therefore keep the image as is for it. 1644 // the image is bogous as well. We therefore keep the image as is for it.
1642 if (item.type != TYPE_BROWSER_SHORTCUT) 1645 if (item.type != TYPE_BROWSER_SHORTCUT)
1643 button->SetImage(item.image); 1646 button->SetImage(item.image);
1644 button->SchedulePaint(); 1647 button->SchedulePaint();
1645 break; 1648 break;
1646 } 1649 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1713 UMA_LAUNCHER_CLICK_ON_APP); 1716 UMA_LAUNCHER_CLICK_ON_APP);
1714 break; 1717 break;
1715 1718
1716 case TYPE_APP_LIST: 1719 case TYPE_APP_LIST:
1717 Shell::GetInstance()->metrics()->RecordUserMetricsAction( 1720 Shell::GetInstance()->metrics()->RecordUserMetricsAction(
1718 UMA_LAUNCHER_CLICK_ON_APPLIST_BUTTON); 1721 UMA_LAUNCHER_CLICK_ON_APPLIST_BUTTON);
1719 break; 1722 break;
1720 1723
1721 case TYPE_APP_PANEL: 1724 case TYPE_APP_PANEL:
1722 case TYPE_DIALOG: 1725 case TYPE_DIALOG:
1726 case TYPE_IME_MENU:
1723 break; 1727 break;
1724 1728
1725 case TYPE_UNDEFINED: 1729 case TYPE_UNDEFINED:
1726 NOTREACHED() << "ShelfItemType must be set."; 1730 NOTREACHED() << "ShelfItemType must be set.";
1727 break; 1731 break;
1728 } 1732 }
1729 1733
1730 ShelfItemDelegate::PerformedAction performed_action = 1734 ShelfItemDelegate::PerformedAction performed_action =
1731 item_manager_->GetShelfItemDelegate(model_->items()[view_index].id) 1735 item_manager_->GetShelfItemDelegate(model_->items()[view_index].id)
1732 ->ItemSelected(event); 1736 ->ItemSelected(event);
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1883 1887
1884 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { 1888 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const {
1885 const gfx::Rect bounds = GetBoundsInScreen(); 1889 const gfx::Rect bounds = GetBoundsInScreen();
1886 int distance = shelf_->SelectValueForShelfAlignment( 1890 int distance = shelf_->SelectValueForShelfAlignment(
1887 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), 1891 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(),
1888 bounds.x() - coordinate.x()); 1892 bounds.x() - coordinate.x());
1889 return distance > 0 ? distance : 0; 1893 return distance > 0 ? distance : 0;
1890 } 1894 }
1891 1895
1892 } // namespace ash 1896 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_model.cc ('k') | chrome/browser/ui/ash/launcher/launcher_item_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698