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

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

Issue 10874040: Activated send-to-mobile and bookmark in action box for Windows. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Answered review comments. Created 8 years, 4 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 | « chrome/browser/ui/toolbar/action_box_menu_model.h ('k') | no next file » | 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"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // Ignore the result since we don't need to handle a deleted menu specially. 47 // Ignore the result since we don't need to handle a deleted menu specially.
48 ignore_result( 48 ignore_result(
49 menu_runner_->RunMenuAt(menu_button->GetWidget(), 49 menu_runner_->RunMenuAt(menu_button->GetWidget(),
50 menu_button, 50 menu_button,
51 gfx::Rect(screen_location, menu_button->size()), 51 gfx::Rect(screen_location, menu_button->size()),
52 views::MenuItemView::TOPRIGHT, 52 views::MenuItemView::TOPRIGHT,
53 views::MenuRunner::HAS_MNEMONICS)); 53 views::MenuRunner::HAS_MNEMONICS));
54 } 54 }
55 55
56 void ActionBoxMenu::ExecuteCommand(int id) { 56 void ActionBoxMenu::ExecuteCommand(int id) {
57 model_->ExecuteCommand(id);
57 } 58 }
58 59
59 views::Border* ActionBoxMenu::CreateMenuBorder() { 60 views::Border* ActionBoxMenu::CreateMenuBorder() {
60 // TODO(yefim): Use correct theme color on non-Windows. 61 // TODO(yefim): Use correct theme color on non-Windows.
61 SkColor border_color = SK_ColorBLACK; 62 SkColor border_color = SK_ColorBLACK;
62 #if defined(OS_WIN) && !defined(USE_AURA) 63 #if defined(OS_WIN) && !defined(USE_AURA)
63 // TODO(yefim): Move to Windows only files if possible. 64 // TODO(yefim): Move to Windows only files if possible.
64 border_color = ui::NativeThemeWin::instance()->GetThemeColorWithDefault( 65 border_color = ui::NativeThemeWin::instance()->GetThemeColorWithDefault(
65 ui::NativeThemeWin::MENU, MENU_POPUPITEM, MPI_NORMAL, TMT_TEXTCOLOR, 66 ui::NativeThemeWin::MENU, MENU_POPUPITEM, MPI_NORMAL, TMT_TEXTCOLOR,
66 COLOR_MENUTEXT); 67 COLOR_MENUTEXT);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 121
121 void ActionBoxMenu::Observe(int type, 122 void ActionBoxMenu::Observe(int type,
122 const content::NotificationSource& source, 123 const content::NotificationSource& source,
123 const content::NotificationDetails& details) { 124 const content::NotificationDetails& details) {
124 } 125 }
125 126
126 void ActionBoxMenu::PopulateMenu() { 127 void ActionBoxMenu::PopulateMenu() {
127 for (int model_index = 0; model_index < model_->GetItemCount(); 128 for (int model_index = 0; model_index < model_->GetItemCount();
128 ++model_index) { 129 ++model_index) {
129 views::MenuItemView* menu_item = root_->AppendMenuItemFromModel( 130 views::MenuItemView* menu_item = root_->AppendMenuItemFromModel(
130 model_, model_index, model_index + 1); 131 model_, model_index, model_->GetCommandIdAt(model_index));
131 if (model_->GetTypeAt(model_index) == ui::MenuModel::TYPE_COMMAND) { 132 if (model_->GetTypeAt(model_index) == ui::MenuModel::TYPE_COMMAND) {
132 menu_item->SetMargins(0, 0); 133 menu_item->SetMargins(0, 0);
133 if (model_->IsItemExtension(model_index)) { 134 if (model_->IsItemExtension(model_index)) {
134 const extensions::Extension* extension = 135 const extensions::Extension* extension =
135 model_->GetExtensionAt(model_index); 136 model_->GetExtensionAt(model_index);
136 BrowserActionView* view = new BrowserActionView(extension, 137 BrowserActionView* view = new BrowserActionView(extension,
137 browser_, this); 138 browser_, this);
138 // |menu_item| will own the |view| from now on. 139 // |menu_item| will own the |view| from now on.
139 menu_item->SetIconView(view); 140 menu_item->SetIconView(view);
140 } 141 }
141 } 142 }
142 } 143 }
143 } 144 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/action_box_menu_model.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698