| 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_keybinding_registry.h" | 5 #include "chrome/browser/extensions/extension_keybinding_registry.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/extensions/active_tab_permission_granter.h" | 9 #include "chrome/browser/extensions/active_tab_permission_granter.h" |
| 10 #include "chrome/browser/extensions/event_router.h" | 10 #include "chrome/browser/extensions/event_router.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 return; | 64 return; |
| 65 | 65 |
| 66 // Grant before sending the event so that the permission is granted before | 66 // Grant before sending the event so that the permission is granted before |
| 67 // the extension acts on the command. | 67 // the extension acts on the command. |
| 68 ActiveTabPermissionGranter* granter = | 68 ActiveTabPermissionGranter* granter = |
| 69 delegate_->GetActiveTabPermissionGranter(); | 69 delegate_->GetActiveTabPermissionGranter(); |
| 70 if (granter) | 70 if (granter) |
| 71 granter->GrantIfRequested(extension); | 71 granter->GrantIfRequested(extension); |
| 72 | 72 |
| 73 scoped_ptr<base::ListValue> args(new base::ListValue()); | 73 scoped_ptr<base::ListValue> args(new base::ListValue()); |
| 74 args->Append(Value::CreateStringValue(command)); | 74 args->Append(new base::StringValue(command)); |
| 75 | 75 |
| 76 scoped_ptr<Event> event(new Event("commands.onCommand", args.Pass())); | 76 scoped_ptr<Event> event(new Event("commands.onCommand", args.Pass())); |
| 77 event->restrict_to_profile = profile_; | 77 event->restrict_to_profile = profile_; |
| 78 event->user_gesture = EventRouter::USER_GESTURE_ENABLED; | 78 event->user_gesture = EventRouter::USER_GESTURE_ENABLED; |
| 79 ExtensionSystem::Get(profile_)->event_router()-> | 79 ExtensionSystem::Get(profile_)->event_router()-> |
| 80 DispatchEventToExtension(extension_id, event.Pass()); | 80 DispatchEventToExtension(extension_id, event.Pass()); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void ExtensionKeybindingRegistry::Observe( | 83 void ExtensionKeybindingRegistry::Observe( |
| 84 int type, | 84 int type, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 return true; | 135 return true; |
| 136 case PLATFORM_APPS_ONLY: | 136 case PLATFORM_APPS_ONLY: |
| 137 return extension->is_platform_app(); | 137 return extension->is_platform_app(); |
| 138 default: | 138 default: |
| 139 NOTREACHED(); | 139 NOTREACHED(); |
| 140 } | 140 } |
| 141 return false; | 141 return false; |
| 142 } | 142 } |
| 143 | 143 |
| 144 } // namespace extensions | 144 } // namespace extensions |
| OLD | NEW |