| 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/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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 return key; | 68 return key; |
| 69 } | 69 } |
| 70 | 70 |
| 71 bool IsForCurrentPlatform(const std::string& key) { | 71 bool IsForCurrentPlatform(const std::string& key) { |
| 72 return base::StartsWithASCII(key, Command::CommandPlatform() + ":", true); | 72 return base::StartsWithASCII(key, Command::CommandPlatform() + ":", true); |
| 73 } | 73 } |
| 74 | 74 |
| 75 std::string StripCurrentPlatform(const std::string& key) { | 75 std::string StripCurrentPlatform(const std::string& key) { |
| 76 DCHECK(IsForCurrentPlatform(key)); | 76 DCHECK(IsForCurrentPlatform(key)); |
| 77 std::string result = key; | 77 std::string result = key; |
| 78 ReplaceFirstSubstringAfterOffset(&result, 0, Command::CommandPlatform() + ":", | 78 base::ReplaceFirstSubstringAfterOffset( |
| 79 ""); | 79 &result, 0, Command::CommandPlatform() + ":", base::StringPiece()); |
| 80 return result; | 80 return result; |
| 81 } | 81 } |
| 82 | 82 |
| 83 void SetInitialBindingsHaveBeenAssigned( | 83 void SetInitialBindingsHaveBeenAssigned( |
| 84 ExtensionPrefs* prefs, const std::string& extension_id) { | 84 ExtensionPrefs* prefs, const std::string& extension_id) { |
| 85 prefs->UpdateExtensionPref(extension_id, kInitialBindingsHaveBeenAssigned, | 85 prefs->UpdateExtensionPref(extension_id, kInitialBindingsHaveBeenAssigned, |
| 86 new base::FundamentalValue(true)); | 86 new base::FundamentalValue(true)); |
| 87 } | 87 } |
| 88 | 88 |
| 89 bool InitialBindingsHaveBeenAssigned( | 89 bool InitialBindingsHaveBeenAssigned( |
| (...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 return true; | 908 return true; |
| 909 } | 909 } |
| 910 | 910 |
| 911 template <> | 911 template <> |
| 912 void | 912 void |
| 913 BrowserContextKeyedAPIFactory<CommandService>::DeclareFactoryDependencies() { | 913 BrowserContextKeyedAPIFactory<CommandService>::DeclareFactoryDependencies() { |
| 914 DependsOn(ExtensionCommandsGlobalRegistry::GetFactoryInstance()); | 914 DependsOn(ExtensionCommandsGlobalRegistry::GetFactoryInstance()); |
| 915 } | 915 } |
| 916 | 916 |
| 917 } // namespace extensions | 917 } // namespace extensions |
| OLD | NEW |