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

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

Issue 11026076: Added MenuConfig setter to MenuItemView, updated rest of the code to use set MenuConfig if it avail… (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"
15 #include "ui/views/controls/menu/menu_runner.h" 16 #include "ui/views/controls/menu/menu_runner.h"
16 #include "ui/views/view.h" 17 #include "ui/views/view.h"
17 18
18 #if defined(OS_WIN) && !defined(USE_AURA) 19 #if defined(OS_WIN) && !defined(USE_AURA)
19 // Included for MENU_POPUPITEM and a few other Windows specific constants. 20 // Included for MENU_POPUPITEM and a few other Windows specific constants.
20 #include <vssym32.h> 21 #include <vssym32.h>
21 #include "ui/base/native_theme/native_theme_win.h" 22 #include "ui/base/native_theme/native_theme_win.h"
22 #endif 23 #endif
23 24
24 // static 25 // static
(...skipping 20 matching lines...) Expand all
45 views::MenuItemView::TOPRIGHT, 46 views::MenuItemView::TOPRIGHT,
46 views::MenuRunner::HAS_MNEMONICS)); 47 views::MenuRunner::HAS_MNEMONICS));
47 } 48 }
48 49
49 ActionBoxMenu::ActionBoxMenu(Browser* browser, 50 ActionBoxMenu::ActionBoxMenu(Browser* browser,
50 scoped_ptr<ActionBoxMenuModel> model) 51 scoped_ptr<ActionBoxMenuModel> model)
51 : browser_(browser), 52 : browser_(browser),
52 model_(model.Pass()) { 53 model_(model.Pass()) {
53 views::MenuItemView* menu = new views::MenuItemView(this); 54 views::MenuItemView* menu = new views::MenuItemView(this);
54 menu->set_has_icons(true); 55 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
55 menu_runner_.reset(new views::MenuRunner(menu)); 62 menu_runner_.reset(new views::MenuRunner(menu));
56 } 63 }
57 64
58 void ActionBoxMenu::ExecuteCommand(int id) { 65 void ActionBoxMenu::ExecuteCommand(int id) {
59 model_->ExecuteCommand(id); 66 model_->ExecuteCommand(id);
60 } 67 }
61 68
62 views::Border* ActionBoxMenu::CreateMenuBorder() { 69 views::Border* ActionBoxMenu::CreateMenuBorder() {
63 // TODO(yefim): Use correct theme color on non-Windows. 70 // TODO(yefim): Use correct theme color on non-Windows.
64 SkColor border_color = SK_ColorBLACK; 71 SkColor border_color = SK_ColorBLACK;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 const extensions::Extension* extension = 143 const extensions::Extension* extension =
137 model_->GetExtensionAt(model_index); 144 model_->GetExtensionAt(model_index);
138 BrowserActionView* view = new BrowserActionView(extension, 145 BrowserActionView* view = new BrowserActionView(extension,
139 browser_, this); 146 browser_, this);
140 // |menu_item| will own the |view| from now on. 147 // |menu_item| will own the |view| from now on.
141 menu_item->SetIconView(view); 148 menu_item->SetIconView(view);
142 } 149 }
143 } 150 }
144 } 151 }
145 } 152 }
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