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

Side by Side Diff: chrome/browser/ui/views/location_bar/page_action_image_view.cc

Issue 10916180: Context menus on view elements should be positioned above the finger when (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 8 years, 3 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/location_bar/page_action_image_view.h" 5 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/extensions/api/commands/command_service.h" 8 #include "chrome/browser/extensions/api/commands/command_service.h"
9 #include "chrome/browser/extensions/api/commands/command_service_factory.h" 9 #include "chrome/browser/extensions/api/commands/command_service_factory.h"
10 #include "chrome/browser/extensions/extension_context_menu_model.h" 10 #include "chrome/browser/extensions/extension_context_menu_model.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 if (!extension->ShowConfigureContextMenus()) 206 if (!extension->ShowConfigureContextMenus())
207 return; 207 return;
208 208
209 scoped_refptr<ExtensionContextMenuModel> context_menu_model( 209 scoped_refptr<ExtensionContextMenuModel> context_menu_model(
210 new ExtensionContextMenuModel(extension, browser_, this)); 210 new ExtensionContextMenuModel(extension, browser_, this));
211 views::MenuModelAdapter menu_model_adapter(context_menu_model.get()); 211 views::MenuModelAdapter menu_model_adapter(context_menu_model.get());
212 menu_runner_.reset(new views::MenuRunner(menu_model_adapter.CreateMenu())); 212 menu_runner_.reset(new views::MenuRunner(menu_model_adapter.CreateMenu()));
213 gfx::Point screen_loc; 213 gfx::Point screen_loc;
214 views::View::ConvertPointToScreen(this, &screen_loc); 214 views::View::ConvertPointToScreen(this, &screen_loc);
215 if (menu_runner_->RunMenuAt(GetWidget(), NULL, gfx::Rect(screen_loc, size()), 215 if (menu_runner_->RunMenuAt(GetWidget(), NULL, gfx::Rect(screen_loc, size()),
216 views::MenuItemView::TOPLEFT, views::MenuRunner::HAS_MNEMONICS) == 216 views::MenuItemView::TOPLEFT, views::MenuRunner::HAS_MNEMONICS |
217 views::MenuRunner::CONTEXT_MENU) ==
217 views::MenuRunner::MENU_DELETED) 218 views::MenuRunner::MENU_DELETED)
218 return; 219 return;
219 } 220 }
220 221
221 bool PageActionImageView::AcceleratorPressed( 222 bool PageActionImageView::AcceleratorPressed(
222 const ui::Accelerator& accelerator) { 223 const ui::Accelerator& accelerator) {
223 DCHECK(visible()); // Should not have happened due to CanHandleAccelerator. 224 DCHECK(visible()); // Should not have happened due to CanHandleAccelerator.
224 225
225 ExecuteAction(ExtensionPopup::SHOW); 226 ExecuteAction(ExtensionPopup::SHOW);
226 return true; 227 return true;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 301
301 popup_ = ExtensionPopup::ShowPopup(popup_url, browser_, this, arrow_location, 302 popup_ = ExtensionPopup::ShowPopup(popup_url, browser_, this, arrow_location,
302 show_action); 303 show_action);
303 popup_->GetWidget()->AddObserver(this); 304 popup_->GetWidget()->AddObserver(this);
304 } 305 }
305 306
306 void PageActionImageView::HidePopup() { 307 void PageActionImageView::HidePopup() {
307 if (popup_) 308 if (popup_)
308 popup_->GetWidget()->Close(); 309 popup_->GetWidget()->Close();
309 } 310 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_frame_aura.cc ('k') | chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698