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

Side by Side Diff: chrome/browser/ui/views/action_box_menu.cc

Issue 11088037: Revert 160886 - Added MenuConfig setter to MenuItemView, updated rest of the code to use set MenuCo… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/action_box_menu.h ('k') | ui/views/controls/menu/menu_config.h » ('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 "chrome/browser/ui/views/action_box_menu.h" 5 #include "chrome/browser/ui/views/action_box_menu.h"
6 6
7 #include "chrome/browser/ui/toolbar/action_box_menu_model.h" 7 #include "chrome/browser/ui/toolbar/action_box_menu_model.h"
8 #include "chrome/browser/ui/views/browser_action_view.h" 8 #include "chrome/browser/ui/views/browser_action_view.h"
9 #include "grit/generated_resources.h" 9 #include "grit/generated_resources.h"
10 #include "grit/theme_resources.h" 10 #include "grit/theme_resources.h"
11 #include "ui/base/l10n/l10n_util.h" 11 #include "ui/base/l10n/l10n_util.h"
12 #include "ui/base/resource/resource_bundle.h" 12 #include "ui/base/resource/resource_bundle.h"
13 #include "ui/views/bubble/bubble_border.h" 13 #include "ui/views/bubble/bubble_border.h"
14 #include "ui/views/controls/button/menu_button.h" 14 #include "ui/views/controls/button/menu_button.h"
15 #include "ui/views/controls/menu/menu_config.h"
16 #include "ui/views/controls/menu/menu_runner.h" 15 #include "ui/views/controls/menu/menu_runner.h"
17 #include "ui/views/view.h" 16 #include "ui/views/view.h"
18 17
19 #if defined(OS_WIN) && !defined(USE_AURA) 18 #if defined(OS_WIN) && !defined(USE_AURA)
20 // Included for MENU_POPUPITEM and a few other Windows specific constants. 19 // Included for MENU_POPUPITEM and a few other Windows specific constants.
21 #include <vssym32.h> 20 #include <vssym32.h>
22 #include "ui/base/native_theme/native_theme_win.h" 21 #include "ui/base/native_theme/native_theme_win.h"
23 #endif 22 #endif
24 23
25 // static 24 // static
(...skipping 20 matching lines...) Expand all
46 views::MenuItemView::TOPRIGHT, 45 views::MenuItemView::TOPRIGHT,
47 views::MenuRunner::HAS_MNEMONICS)); 46 views::MenuRunner::HAS_MNEMONICS));
48 } 47 }
49 48
50 ActionBoxMenu::ActionBoxMenu(Browser* browser, 49 ActionBoxMenu::ActionBoxMenu(Browser* browser,
51 scoped_ptr<ActionBoxMenuModel> model) 50 scoped_ptr<ActionBoxMenuModel> model)
52 : browser_(browser), 51 : browser_(browser),
53 model_(model.Pass()) { 52 model_(model.Pass()) {
54 views::MenuItemView* menu = new views::MenuItemView(this); 53 views::MenuItemView* menu = new views::MenuItemView(this);
55 menu->set_has_icons(true); 54 menu->set_has_icons(true);
56
57 views::MenuConfig* menu_config = new views::MenuConfig();
58 CustomizeMenu(menu_config);
59 // |menu| will own MenuConfig
60 menu->set_menu_config(menu_config);
61
62 menu_runner_.reset(new views::MenuRunner(menu)); 55 menu_runner_.reset(new views::MenuRunner(menu));
63 } 56 }
64 57
65 void ActionBoxMenu::ExecuteCommand(int id) { 58 void ActionBoxMenu::ExecuteCommand(int id) {
66 model_->ExecuteCommand(id); 59 model_->ExecuteCommand(id);
67 } 60 }
68 61
69 views::Border* ActionBoxMenu::CreateMenuBorder() { 62 views::Border* ActionBoxMenu::CreateMenuBorder() {
70 // TODO(yefim): Use correct theme color on non-Windows. 63 // TODO(yefim): Use correct theme color on non-Windows.
71 SkColor border_color = SK_ColorBLACK; 64 SkColor border_color = SK_ColorBLACK;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 const extensions::Extension* extension = 136 const extensions::Extension* extension =
144 model_->GetExtensionAt(model_index); 137 model_->GetExtensionAt(model_index);
145 BrowserActionView* view = new BrowserActionView(extension, 138 BrowserActionView* view = new BrowserActionView(extension,
146 browser_, this); 139 browser_, this);
147 // |menu_item| will own the |view| from now on. 140 // |menu_item| will own the |view| from now on.
148 menu_item->SetIconView(view); 141 menu_item->SetIconView(view);
149 } 142 }
150 } 143 }
151 } 144 }
152 } 145 }
153
154 void ActionBoxMenu::CustomizeMenu(views::MenuConfig* menu_config) {
155 // TODO(yefim): add menu customization here.
156 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/action_box_menu.h ('k') | ui/views/controls/menu/menu_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698