| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/bookmarks/enhanced_bookmark_key_service.h" | 5 #include "chrome/browser/ui/bookmarks/enhanced_bookmark_key_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/sha1.h" | |
| 10 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 11 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| 12 #include "chrome/browser/extensions/api/commands/command_service.h" | 11 #include "chrome/browser/extensions/api/commands/command_service.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/ui/accelerator_utils.h" | 13 #include "chrome/browser/ui/accelerator_utils.h" |
| 15 #include "chrome/common/extensions/command.h" | 14 #include "chrome/common/extensions/command.h" |
| 16 #include "extensions/browser/extension_registry.h" | 15 #include "extensions/browser/extension_registry.h" |
| 17 #include "extensions/browser/notification_types.h" | 16 #include "extensions/browser/notification_types.h" |
| 18 #include "extensions/common/manifest_constants.h" | 17 #include "extensions/common/manifest_constants.h" |
| 19 | 18 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 } | 66 } |
| 68 | 67 |
| 69 const extensions::Extension* | 68 const extensions::Extension* |
| 70 EnhancedBookmarkKeyService::GetEnhancedBookmarkExtension() const { | 69 EnhancedBookmarkKeyService::GetEnhancedBookmarkExtension() const { |
| 71 const extensions::ExtensionSet& extensions = | 70 const extensions::ExtensionSet& extensions = |
| 72 extensions::ExtensionRegistry::Get(browser_context_) | 71 extensions::ExtensionRegistry::Get(browser_context_) |
| 73 ->enabled_extensions(); | 72 ->enabled_extensions(); |
| 74 extensions::ExtensionSet::const_iterator loc = | 73 extensions::ExtensionSet::const_iterator loc = |
| 75 std::find_if(extensions.begin(), extensions.end(), | 74 std::find_if(extensions.begin(), extensions.end(), |
| 76 [](scoped_refptr<const extensions::Extension> extension) { | 75 [](scoped_refptr<const extensions::Extension> extension) { |
| 77 static const char enhanced_extension_hash[] = | 76 static const char enhanced_ext_hash[] = |
| 78 // http://crbug.com/312900 | 77 // http://crbug.com/312900 |
| 79 "D5736E4B5CF695CB93A2FB57E4FDC6E5AFAB6FE2"; | 78 "D5736E4B5CF695CB93A2FB57E4FDC6E5AFAB6FE2"; |
| 80 std::string hash = base::SHA1HashString(extension->id()); | 79 return extension->HashedIdInHex() == enhanced_ext_hash; |
| 81 return base::HexEncode(hash.c_str(), hash.length()) == | |
| 82 enhanced_extension_hash; | |
| 83 }); | 80 }); |
| 84 return loc != extensions.end() ? loc->get() : nullptr; | 81 return loc != extensions.end() ? loc->get() : nullptr; |
| 85 } | 82 } |
| OLD | NEW |