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

Side by Side Diff: chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa.mm

Issue 11820041: Remove profile-keyed factory boilerplates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 7 years, 11 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/ui/cocoa/extensions/extension_keybinding_registry_cocoa .h" 5 #include "chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa .h"
6 6
7 #include "chrome/browser/extensions/api/commands/command_service.h" 7 #include "chrome/browser/extensions/api/commands/command_service.h"
8 #include "chrome/browser/extensions/api/commands/command_service_factory.h"
9 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/common/extensions/extension.h" 10 #include "chrome/common/extensions/extension.h"
12 #include "chrome/common/chrome_notification_types.h" 11 #include "chrome/common/chrome_notification_types.h"
13 #include "chrome/common/extensions/extension_manifest_constants.h" 12 #include "chrome/common/extensions/extension_manifest_constants.h"
14 #include "content/public/browser/native_web_keyboard_event.h" 13 #include "content/public/browser/native_web_keyboard_event.h"
15 #include "content/public/browser/notification_service.h" 14 #include "content/public/browser/notification_service.h"
16 15
17 namespace values = extension_manifest_values; 16 namespace values = extension_manifest_values;
18 17
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 content::Source<Profile>(profile_), 72 content::Source<Profile>(profile_),
74 content::Details< 73 content::Details<
75 std::pair<const std::string, gfx::NativeWindow> >(&details)); 74 std::pair<const std::string, gfx::NativeWindow> >(&details));
76 return true; 75 return true;
77 } 76 }
78 77
79 void ExtensionKeybindingRegistryCocoa::AddExtensionKeybinding( 78 void ExtensionKeybindingRegistryCocoa::AddExtensionKeybinding(
80 const extensions::Extension* extension, 79 const extensions::Extension* extension,
81 const std::string& command_name) { 80 const std::string& command_name) {
82 extensions::CommandService* command_service = 81 extensions::CommandService* command_service =
83 extensions::CommandServiceFactory::GetForProfile(profile_); 82 extensions::CommandService::Get(profile_);
84 extensions::CommandMap commands; 83 extensions::CommandMap commands;
85 command_service->GetNamedCommands( 84 command_service->GetNamedCommands(
86 extension->id(), 85 extension->id(),
87 extensions::CommandService::ACTIVE_ONLY, 86 extensions::CommandService::ACTIVE_ONLY,
88 &commands); 87 &commands);
89 88
90 for (extensions::CommandMap::const_iterator iter = commands.begin(); 89 for (extensions::CommandMap::const_iterator iter = commands.begin();
91 iter != commands.end(); ++iter) { 90 iter != commands.end(); ++iter) {
92 if (!command_name.empty() && (iter->second.command_name() != command_name)) 91 if (!command_name.empty() && (iter->second.command_name() != command_name))
93 continue; 92 continue;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 const extensions::Extension* extension, 139 const extensions::Extension* extension,
141 const std::string& command_name) { 140 const std::string& command_name) {
142 EventTargets::iterator iter = event_targets_.begin(); 141 EventTargets::iterator iter = event_targets_.begin();
143 while (iter != event_targets_.end()) { 142 while (iter != event_targets_.end()) {
144 EventTargets::iterator old = iter++; 143 EventTargets::iterator old = iter++;
145 if (old->second.first == extension->id() && 144 if (old->second.first == extension->id() &&
146 (command_name.empty() || (old->second.second == command_name))) 145 (command_name.empty() || (old->second.second == command_name)))
147 event_targets_.erase(old); 146 event_targets_.erase(old);
148 } 147 }
149 } 148 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698