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 <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 DCHECK(IsForCurrentPlatform(key)); | 78 DCHECK(IsForCurrentPlatform(key)); |
79 std::string result = key; | 79 std::string result = key; |
80 base::ReplaceFirstSubstringAfterOffset( | 80 base::ReplaceFirstSubstringAfterOffset( |
81 &result, 0, Command::CommandPlatform() + ":", base::StringPiece()); | 81 &result, 0, Command::CommandPlatform() + ":", base::StringPiece()); |
82 return result; | 82 return result; |
83 } | 83 } |
84 | 84 |
85 void SetInitialBindingsHaveBeenAssigned( | 85 void SetInitialBindingsHaveBeenAssigned( |
86 ExtensionPrefs* prefs, const std::string& extension_id) { | 86 ExtensionPrefs* prefs, const std::string& extension_id) { |
87 prefs->UpdateExtensionPref(extension_id, kInitialBindingsHaveBeenAssigned, | 87 prefs->UpdateExtensionPref(extension_id, kInitialBindingsHaveBeenAssigned, |
88 new base::FundamentalValue(true)); | 88 new base::Value(true)); |
89 } | 89 } |
90 | 90 |
91 bool InitialBindingsHaveBeenAssigned( | 91 bool InitialBindingsHaveBeenAssigned( |
92 const ExtensionPrefs* prefs, const std::string& extension_id) { | 92 const ExtensionPrefs* prefs, const std::string& extension_id) { |
93 bool assigned = false; | 93 bool assigned = false; |
94 if (!prefs || !prefs->ReadPrefAsBoolean(extension_id, | 94 if (!prefs || !prefs->ReadPrefAsBoolean(extension_id, |
95 kInitialBindingsHaveBeenAssigned, | 95 kInitialBindingsHaveBeenAssigned, |
96 &assigned)) | 96 &assigned)) |
97 return false; | 97 return false; |
98 | 98 |
(...skipping 809 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 |