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

Side by Side Diff: chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc

Issue 10832360: Change to address default selection of menu item (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: type check 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 | Annotate | Revision Log
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/extensions/browser_action_overflow_menu_contro ller.h" 5 #include "chrome/browser/ui/views/extensions/browser_action_overflow_menu_contro ller.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/extensions/extension_context_menu_model.h" 9 #include "chrome/browser/extensions/extension_context_menu_model.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 new ExtensionContextMenuModel(extension, browser_); 112 new ExtensionContextMenuModel(extension, browser_);
113 views::MenuModelAdapter context_menu_model_adapter( 113 views::MenuModelAdapter context_menu_model_adapter(
114 context_menu_contents.get()); 114 context_menu_contents.get());
115 views::MenuRunner context_menu_runner( 115 views::MenuRunner context_menu_runner(
116 context_menu_model_adapter.CreateMenu()); 116 context_menu_model_adapter.CreateMenu());
117 117
118 // We can ignore the result as we delete ourself. 118 // We can ignore the result as we delete ourself.
119 // This blocks until the user choses something or dismisses the menu. 119 // This blocks until the user choses something or dismisses the menu.
120 ignore_result(context_menu_runner.RunMenuAt(menu_button_->GetWidget(), 120 ignore_result(context_menu_runner.RunMenuAt(menu_button_->GetWidget(),
121 NULL, gfx::Rect(p, gfx::Size()), views::MenuItemView::TOPLEFT, 121 NULL, gfx::Rect(p, gfx::Size()), views::MenuItemView::TOPLEFT,
122 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::IS_NESTED)); 122 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::IS_NESTED |
123 views::MenuRunner::CONTEXT_MENU));
123 124
124 // The user is done with the context menu, so we can close the underlying 125 // The user is done with the context menu, so we can close the underlying
125 // menu. 126 // menu.
126 menu_->Cancel(); 127 menu_->Cancel();
127 128
128 return true; 129 return true;
129 } 130 }
130 131
131 void BrowserActionOverflowMenuController::DropMenuClosed( 132 void BrowserActionOverflowMenuController::DropMenuClosed(
132 views::MenuItemView* menu) { 133 views::MenuItemView* menu) {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 220
220 BrowserActionView* BrowserActionOverflowMenuController::ViewForId( 221 BrowserActionView* BrowserActionOverflowMenuController::ViewForId(
221 int id, size_t* index) { 222 int id, size_t* index) {
222 // The index of the view being dragged (GetCommand gives a 1-based index into 223 // The index of the view being dragged (GetCommand gives a 1-based index into
223 // the overflow menu). 224 // the overflow menu).
224 size_t view_index = owner_->VisibleBrowserActions() + id - 1; 225 size_t view_index = owner_->VisibleBrowserActions() + id - 1;
225 if (index) 226 if (index)
226 *index = view_index; 227 *index = view_index;
227 return owner_->GetBrowserActionViewAt(view_index); 228 return owner_->GetBrowserActionViewAt(view_index);
228 } 229 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698