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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "chrome/browser/extensions/api/bookmarks/bookmarks_api.h" | 7 #include "chrome/browser/extensions/api/bookmarks/bookmarks_api.h" |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 bool IsEnhancedBookmarksExtensionActive(Profile* profile) { | 95 bool IsEnhancedBookmarksExtensionActive(Profile* profile) { |
96 static const char *enhanced_extension_hashes[] = { | 96 static const char *enhanced_extension_hashes[] = { |
97 "D5736E4B5CF695CB93A2FB57E4FDC6E5AFAB6FE2", // http://crbug.com/312900 | 97 "D5736E4B5CF695CB93A2FB57E4FDC6E5AFAB6FE2", // http://crbug.com/312900 |
98 "D57DE394F36DC1C3220E7604C575D29C51A6C495", // http://crbug.com/319444 | 98 "D57DE394F36DC1C3220E7604C575D29C51A6C495", // http://crbug.com/319444 |
99 "3F65507A3B39259B38C8173C6FFA3D12DF64CCE9" // http://crbug.com/371562 | 99 "3F65507A3B39259B38C8173C6FFA3D12DF64CCE9" // http://crbug.com/371562 |
100 }; | 100 }; |
101 const ExtensionSet& extensions = | 101 const ExtensionSet& extensions = |
102 ExtensionRegistry::Get(profile)->enabled_extensions(); | 102 ExtensionRegistry::Get(profile)->enabled_extensions(); |
103 for (ExtensionSet::const_iterator it = extensions.begin(); | 103 for (ExtensionSet::const_iterator it = extensions.begin(); |
104 it != extensions.end(); ++it) { | 104 it != extensions.end(); ++it) { |
105 const Extension* extension = *it; | 105 const Extension* extension = it->get(); |
106 if (extension->permissions_data()->HasAPIPermission( | 106 if (extension->permissions_data()->HasAPIPermission( |
107 APIPermission::kBookmarkManagerPrivate)) { | 107 APIPermission::kBookmarkManagerPrivate)) { |
108 std::string hash = base::SHA1HashString(extension->id()); | 108 std::string hash = base::SHA1HashString(extension->id()); |
109 hash = base::HexEncode(hash.c_str(), hash.length()); | 109 hash = base::HexEncode(hash.c_str(), hash.length()); |
110 for (size_t i = 0; i < arraysize(enhanced_extension_hashes); i++) | 110 for (size_t i = 0; i < arraysize(enhanced_extension_hashes); i++) |
111 if (hash == enhanced_extension_hashes[i]) | 111 if (hash == enhanced_extension_hashes[i]) |
112 return true; | 112 return true; |
113 } | 113 } |
114 } | 114 } |
115 return false; | 115 return false; |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 } | 906 } |
907 | 907 |
908 void BookmarksExportFunction::FileSelected(const base::FilePath& path, | 908 void BookmarksExportFunction::FileSelected(const base::FilePath& path, |
909 int index, | 909 int index, |
910 void* params) { | 910 void* params) { |
911 bookmark_html_writer::WriteBookmarks(GetProfile(), path, NULL); | 911 bookmark_html_writer::WriteBookmarks(GetProfile(), path, NULL); |
912 Release(); // Balanced in BookmarksIOFunction::SelectFile() | 912 Release(); // Balanced in BookmarksIOFunction::SelectFile() |
913 } | 913 } |
914 | 914 |
915 } // namespace extensions | 915 } // namespace extensions |
OLD | NEW |