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

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

Issue 2030013003: Remove ListValue::Append(new {Fundamental,String}Value(...)) pattern in //chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // Grant before sending the event so that the permission is granted before 113 // Grant before sending the event so that the permission is granted before
114 // the extension acts on the command. NOTE: The Global Commands handler does 114 // the extension acts on the command. NOTE: The Global Commands handler does
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->Append(new base::StringValue(command)); 123 args->AppendString(command);
124 124
125 std::unique_ptr<Event> event(new Event(events::COMMANDS_ON_COMMAND, 125 std::unique_ptr<Event> event(new Event(events::COMMANDS_ON_COMMAND,
126 kOnCommandEventName, std::move(args))); 126 kOnCommandEventName, std::move(args)));
127 event->restrict_to_browser_context = browser_context_; 127 event->restrict_to_browser_context = 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(
(...skipping 123 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

Powered by Google App Engine
This is Rietveld 408576698