| 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/extensions/extension_context_menu_model.h" | 5 #include "chrome/browser/extensions/extension_context_menu_model.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/extensions/context_menu_matcher.h" | 10 #include "chrome/browser/extensions/context_menu_matcher.h" |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 case PAGE_ACCESS_RUN_ON_CLICK: | 220 case PAGE_ACCESS_RUN_ON_CLICK: |
| 221 case PAGE_ACCESS_RUN_ON_SITE: | 221 case PAGE_ACCESS_RUN_ON_SITE: |
| 222 case PAGE_ACCESS_RUN_ON_ALL_SITES: | 222 case PAGE_ACCESS_RUN_ON_ALL_SITES: |
| 223 return true; | 223 return true; |
| 224 default: | 224 default: |
| 225 NOTREACHED() << "Unknown command" << command_id; | 225 NOTREACHED() << "Unknown command" << command_id; |
| 226 } | 226 } |
| 227 return true; | 227 return true; |
| 228 } | 228 } |
| 229 | 229 |
| 230 bool ExtensionContextMenuModel::GetAcceleratorForCommandId( | |
| 231 int command_id, | |
| 232 ui::Accelerator* accelerator) const { | |
| 233 return false; | |
| 234 } | |
| 235 | |
| 236 void ExtensionContextMenuModel::ExecuteCommand(int command_id, | 230 void ExtensionContextMenuModel::ExecuteCommand(int command_id, |
| 237 int event_flags) { | 231 int event_flags) { |
| 238 const Extension* extension = GetExtension(); | 232 const Extension* extension = GetExtension(); |
| 239 if (!extension) | 233 if (!extension) |
| 240 return; | 234 return; |
| 241 | 235 |
| 242 if (command_id >= IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST && | 236 if (command_id >= IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST && |
| 243 command_id <= IDC_EXTENSIONS_CONTEXT_CUSTOM_LAST) { | 237 command_id <= IDC_EXTENSIONS_CONTEXT_CUSTOM_LAST) { |
| 244 DCHECK(extension_items_); | 238 DCHECK(extension_items_); |
| 245 extension_items_->ExecuteCommand(command_id, GetActiveWebContents(), | 239 extension_items_->ExecuteCommand(command_id, GetActiveWebContents(), |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 if (runner && runner->WantsToRun(extension)) | 455 if (runner && runner->WantsToRun(extension)) |
| 462 runner->RunBlockedActions(extension); | 456 runner->RunBlockedActions(extension); |
| 463 } | 457 } |
| 464 } | 458 } |
| 465 | 459 |
| 466 content::WebContents* ExtensionContextMenuModel::GetActiveWebContents() const { | 460 content::WebContents* ExtensionContextMenuModel::GetActiveWebContents() const { |
| 467 return browser_->tab_strip_model()->GetActiveWebContents(); | 461 return browser_->tab_strip_model()->GetActiveWebContents(); |
| 468 } | 462 } |
| 469 | 463 |
| 470 } // namespace extensions | 464 } // namespace extensions |
| OLD | NEW |