| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |