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

Side by Side Diff: chrome/browser/ui/views/toolbar/app_menu.cc

Issue 2374803002: Remove a bunch of pre-MD toolbar code and assets. (Closed)
Patch Set: fix mac? Created 4 years, 2 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/ui/views/toolbar/app_menu.h" 5 #include "chrome/browser/ui/views/toolbar/app_menu.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 30 matching lines...) Expand all
41 #include "content/public/browser/notification_source.h" 41 #include "content/public/browser/notification_source.h"
42 #include "content/public/browser/notification_types.h" 42 #include "content/public/browser/notification_types.h"
43 #include "content/public/browser/user_metrics.h" 43 #include "content/public/browser/user_metrics.h"
44 #include "content/public/browser/web_contents.h" 44 #include "content/public/browser/web_contents.h"
45 #include "extensions/common/feature_switch.h" 45 #include "extensions/common/feature_switch.h"
46 #include "third_party/skia/include/core/SkCanvas.h" 46 #include "third_party/skia/include/core/SkCanvas.h"
47 #include "third_party/skia/include/core/SkPaint.h" 47 #include "third_party/skia/include/core/SkPaint.h"
48 #include "ui/accessibility/ax_view_state.h" 48 #include "ui/accessibility/ax_view_state.h"
49 #include "ui/base/l10n/l10n_util.h" 49 #include "ui/base/l10n/l10n_util.h"
50 #include "ui/base/layout.h" 50 #include "ui/base/layout.h"
51 #include "ui/base/material_design/material_design_controller.h"
52 #include "ui/base/resource/resource_bundle.h" 51 #include "ui/base/resource/resource_bundle.h"
53 #include "ui/gfx/canvas.h" 52 #include "ui/gfx/canvas.h"
54 #include "ui/gfx/font_list.h" 53 #include "ui/gfx/font_list.h"
55 #include "ui/gfx/image/image.h" 54 #include "ui/gfx/image/image.h"
56 #include "ui/gfx/image/image_skia_source.h" 55 #include "ui/gfx/image/image_skia_source.h"
57 #include "ui/gfx/scoped_canvas.h" 56 #include "ui/gfx/scoped_canvas.h"
58 #include "ui/gfx/skia_util.h" 57 #include "ui/gfx/skia_util.h"
59 #include "ui/gfx/text_utils.h" 58 #include "ui/gfx/text_utils.h"
60 #include "ui/views/background.h" 59 #include "ui/views/background.h"
61 #include "ui/views/controls/button/image_button.h" 60 #include "ui/views/controls/button/image_button.h"
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 item->SetMargins(top_margin, bottom_margin); 1108 item->SetMargins(top_margin, bottom_margin);
1110 } 1109 }
1111 1110
1112 if (model->GetTypeAt(i) == MenuModel::TYPE_SUBMENU) 1111 if (model->GetTypeAt(i) == MenuModel::TYPE_SUBMENU)
1113 PopulateMenu(item, model->GetSubmenuModelAt(i)); 1112 PopulateMenu(item, model->GetSubmenuModelAt(i));
1114 1113
1115 switch (model->GetCommandIdAt(i)) { 1114 switch (model->GetCommandIdAt(i)) {
1116 case IDC_EXTENSIONS_OVERFLOW_MENU: { 1115 case IDC_EXTENSIONS_OVERFLOW_MENU: {
1117 std::unique_ptr<ExtensionToolbarMenuView> extension_toolbar( 1116 std::unique_ptr<ExtensionToolbarMenuView> extension_toolbar(
1118 new ExtensionToolbarMenuView(browser_, this, item)); 1117 new ExtensionToolbarMenuView(browser_, this, item));
1119 if (ui::MaterialDesignController::IsModeMaterial()) { 1118 for (int i = 0; i < extension_toolbar->contents()->child_count(); ++i) {
1120 for (int i = 0; i < extension_toolbar->contents()->child_count(); 1119 View* action_view = extension_toolbar->contents()->child_at(i);
1121 ++i) { 1120 action_view->set_background(new InMenuButtonBackground(
1122 View* action_view = extension_toolbar->contents()->child_at(i); 1121 InMenuButtonBackground::ROUNDED_BUTTON));
1123 action_view->set_background(new InMenuButtonBackground(
1124 InMenuButtonBackground::ROUNDED_BUTTON));
1125 }
1126 } 1122 }
1127 extension_toolbar_ = extension_toolbar.get(); 1123 extension_toolbar_ = extension_toolbar.get();
1128 item->AddChildView(extension_toolbar.release()); 1124 item->AddChildView(extension_toolbar.release());
1129 break; 1125 break;
1130 } 1126 }
1131 1127
1132 case IDC_EDIT_MENU: { 1128 case IDC_EDIT_MENU: {
1133 ui::ButtonMenuItemModel* submodel = model->GetButtonMenuItemAt(i); 1129 ui::ButtonMenuItemModel* submodel = model->GetButtonMenuItemAt(i);
1134 DCHECK_EQ(IDC_CUT, submodel->GetCommandIdAt(0)); 1130 DCHECK_EQ(IDC_CUT, submodel->GetCommandIdAt(0));
1135 DCHECK_EQ(IDC_COPY, submodel->GetCommandIdAt(1)); 1131 DCHECK_EQ(IDC_COPY, submodel->GetCommandIdAt(1));
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 0, 1246 0,
1251 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, 1247 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS,
1252 BOOKMARK_LAUNCH_LOCATION_APP_MENU); 1248 BOOKMARK_LAUNCH_LOCATION_APP_MENU);
1253 } 1249 }
1254 1250
1255 int AppMenu::ModelIndexFromCommandId(int command_id) const { 1251 int AppMenu::ModelIndexFromCommandId(int command_id) const {
1256 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id); 1252 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id);
1257 DCHECK(ix != command_id_to_entry_.end()); 1253 DCHECK(ix != command_id_to_entry_.end());
1258 return ix->second.second; 1254 return ix->second.second;
1259 } 1255 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698