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 "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 std::string GetPlatformKeybindingKeyForAccelerator( | 37 std::string GetPlatformKeybindingKeyForAccelerator( |
38 const ui::Accelerator& accelerator) { | 38 const ui::Accelerator& accelerator) { |
39 return extensions::Command::CommandPlatform() + ":" + | 39 return extensions::Command::CommandPlatform() + ":" + |
40 extensions::Command::AcceleratorToString(accelerator); | 40 extensions::Command::AcceleratorToString(accelerator); |
41 } | 41 } |
42 | 42 |
43 void SetInitialBindingsHaveBeenAssigned( | 43 void SetInitialBindingsHaveBeenAssigned( |
44 ExtensionPrefs* prefs, const std::string& extension_id) { | 44 ExtensionPrefs* prefs, const std::string& extension_id) { |
45 prefs->UpdateExtensionPref(extension_id, kInitialBindingsHaveBeenAssigned, | 45 prefs->UpdateExtensionPref(extension_id, kInitialBindingsHaveBeenAssigned, |
46 base::Value::CreateBooleanValue(true)); | 46 new base::FundamentalValue(true)); |
47 } | 47 } |
48 | 48 |
49 bool InitialBindingsHaveBeenAssigned( | 49 bool InitialBindingsHaveBeenAssigned( |
50 const ExtensionPrefs* prefs, const std::string& extension_id) { | 50 const ExtensionPrefs* prefs, const std::string& extension_id) { |
51 bool assigned = false; | 51 bool assigned = false; |
52 if (!prefs || !prefs->ReadPrefAsBoolean(extension_id, | 52 if (!prefs || !prefs->ReadPrefAsBoolean(extension_id, |
53 kInitialBindingsHaveBeenAssigned, | 53 kInitialBindingsHaveBeenAssigned, |
54 &assigned)) | 54 &assigned)) |
55 return false; | 55 return false; |
56 | 56 |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 return false; | 397 return false; |
398 | 398 |
399 *command = *requested_command; | 399 *command = *requested_command; |
400 if (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN) | 400 if (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN) |
401 command->set_accelerator(shortcut_assigned); | 401 command->set_accelerator(shortcut_assigned); |
402 | 402 |
403 return true; | 403 return true; |
404 } | 404 } |
405 | 405 |
406 } // namespace extensions | 406 } // namespace extensions |
OLD | NEW |