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

Side by Side Diff: chrome/browser/extensions/extension_keybinding_registry.cc

Issue 2898383002: [Extensions] Make Event::restrict_to_browser_context const. (Closed)
Patch Set: sync @tott Created 3 years, 7 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
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/extensions/extension_keybinding_registry.h" 5 #include "chrome/browser/extensions/extension_keybinding_registry.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/extensions/active_tab_permission_granter.h" 10 #include "chrome/browser/extensions/active_tab_permission_granter.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // not set the delegate as it deals only with named commands (not page/browser 115 // not set the delegate as it deals only with named commands (not page/browser
116 // actions that are associated with the current page directly). 116 // actions that are associated with the current page directly).
117 ActiveTabPermissionGranter* granter = 117 ActiveTabPermissionGranter* granter =
118 delegate_ ? delegate_->GetActiveTabPermissionGranter() : NULL; 118 delegate_ ? delegate_->GetActiveTabPermissionGranter() : NULL;
119 if (granter) 119 if (granter)
120 granter->GrantIfRequested(extension); 120 granter->GrantIfRequested(extension);
121 121
122 std::unique_ptr<base::ListValue> args(new base::ListValue()); 122 std::unique_ptr<base::ListValue> args(new base::ListValue());
123 args->AppendString(command); 123 args->AppendString(command);
124 124
125 std::unique_ptr<Event> event(new Event(events::COMMANDS_ON_COMMAND, 125 auto event =
126 kOnCommandEventName, std::move(args))); 126 base::MakeUnique<Event>(events::COMMANDS_ON_COMMAND, kOnCommandEventName,
127 event->restrict_to_browser_context = browser_context_; 127 std::move(args), browser_context_);
128 event->user_gesture = EventRouter::USER_GESTURE_ENABLED; 128 event->user_gesture = EventRouter::USER_GESTURE_ENABLED;
129 EventRouter::Get(browser_context_) 129 EventRouter::Get(browser_context_)
130 ->DispatchEventToExtension(extension_id, std::move(event)); 130 ->DispatchEventToExtension(extension_id, std::move(event));
131 } 131 }
132 132
133 bool ExtensionKeybindingRegistry::IsAcceleratorRegistered( 133 bool ExtensionKeybindingRegistry::IsAcceleratorRegistered(
134 const ui::Accelerator& accelerator) const { 134 const ui::Accelerator& accelerator) const {
135 return event_targets_.find(accelerator) != event_targets_.end(); 135 return event_targets_.find(accelerator) != event_targets_.end();
136 } 136 }
137 137
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 if (extension_id.empty() || it->first == extension_id) { 257 if (extension_id.empty() || it->first == extension_id) {
258 CommandExecuted(it->first, it->second); 258 CommandExecuted(it->first, it->second);
259 executed = true; 259 executed = true;
260 } 260 }
261 } 261 }
262 262
263 return executed; 263 return executed;
264 } 264 }
265 265
266 } // namespace extensions 266 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/event_router_forwarder.cc ('k') | chrome/browser/extensions/extension_messages_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698