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

Side by Side Diff: chrome/browser/extensions/api/commands/command_service.cc

Issue 350943003: Support global keyboard commands on Chrome OS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test updates Created 6 years, 5 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 | Annotate | Revision Log
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/api/commands/command_service.h" 5 #include "chrome/browser/extensions/api/commands/command_service.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/prefs/scoped_user_pref_update.h" 10 #include "base/prefs/scoped_user_pref_update.h"
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 continue; 354 continue;
355 std::string command_name; 355 std::string command_name;
356 item->GetString(kCommandName, &command_name); 356 item->GetString(kCommandName, &command_name);
357 if (command != command_name) 357 if (command != command_name)
358 continue; 358 continue;
359 // Format stored in Preferences is: "Platform:Shortcut[:ExtensionId]". 359 // Format stored in Preferences is: "Platform:Shortcut[:ExtensionId]".
360 std::string shortcut = it.key(); 360 std::string shortcut = it.key();
361 if (!IsForCurrentPlatform(shortcut)) 361 if (!IsForCurrentPlatform(shortcut))
362 continue; 362 continue;
363 bool global = false; 363 bool global = false;
364 if (FeatureSwitch::global_commands()->IsEnabled()) 364 item->GetBoolean(kGlobal, &global);
365 item->GetBoolean(kGlobal, &global);
366 365
367 std::vector<std::string> tokens; 366 std::vector<std::string> tokens;
368 base::SplitString(shortcut, ':', &tokens); 367 base::SplitString(shortcut, ':', &tokens);
369 CHECK(tokens.size() >= 2); 368 CHECK(tokens.size() >= 2);
370 shortcut = tokens[1]; 369 shortcut = tokens[1];
371 370
372 return Command(command_name, base::string16(), shortcut, global); 371 return Command(command_name, base::string16(), shortcut, global);
373 } 372 }
374 373
375 return Command(); 374 return Command();
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 return true; 858 return true;
860 } 859 }
861 860
862 template <> 861 template <>
863 void 862 void
864 BrowserContextKeyedAPIFactory<CommandService>::DeclareFactoryDependencies() { 863 BrowserContextKeyedAPIFactory<CommandService>::DeclareFactoryDependencies() {
865 DependsOn(ExtensionCommandsGlobalRegistry::GetFactoryInstance()); 864 DependsOn(ExtensionCommandsGlobalRegistry::GetFactoryInstance());
866 } 865 }
867 866
868 } // namespace extensions 867 } // namespace extensions
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_controller.cc ('k') | chrome/browser/extensions/extension_commands_global_registry_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698