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/bookmarks/bookmarks_api.h" | 5 #include "chrome/browser/extensions/api/bookmarks/bookmarks_api.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/i18n/file_util_icu.h" | 9 #include "base/i18n/file_util_icu.h" |
10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 } | 141 } |
142 | 142 |
143 BookmarkEventRouter::~BookmarkEventRouter() { | 143 BookmarkEventRouter::~BookmarkEventRouter() { |
144 if (model_) { | 144 if (model_) { |
145 model_->RemoveObserver(this); | 145 model_->RemoveObserver(this); |
146 } | 146 } |
147 } | 147 } |
148 | 148 |
149 void BookmarkEventRouter::DispatchEvent( | 149 void BookmarkEventRouter::DispatchEvent( |
150 const char* event_name, | 150 const char* event_name, |
151 scoped_ptr<ListValue> event_args) { | 151 scoped_ptr<base::ListValue> event_args) { |
152 if (extensions::ExtensionSystem::Get(profile_)->event_router()) { | 152 if (extensions::ExtensionSystem::Get(profile_)->event_router()) { |
153 extensions::ExtensionSystem::Get(profile_)->event_router()->BroadcastEvent( | 153 extensions::ExtensionSystem::Get(profile_)->event_router()->BroadcastEvent( |
154 make_scoped_ptr(new extensions::Event(event_name, event_args.Pass()))); | 154 make_scoped_ptr(new extensions::Event(event_name, event_args.Pass()))); |
155 } | 155 } |
156 } | 156 } |
157 | 157 |
158 void BookmarkEventRouter::Loaded(BookmarkModel* model, bool ids_reassigned) { | 158 void BookmarkEventRouter::Loaded(BookmarkModel* model, bool ids_reassigned) { |
159 // TODO(erikkay): Perhaps we should send this event down to the extension | 159 // TODO(erikkay): Perhaps we should send this event down to the extension |
160 // so they know when it's safe to use the API? | 160 // so they know when it's safe to use the API? |
161 } | 161 } |
162 | 162 |
163 void BookmarkEventRouter::BookmarkModelBeingDeleted(BookmarkModel* model) { | 163 void BookmarkEventRouter::BookmarkModelBeingDeleted(BookmarkModel* model) { |
164 model_ = NULL; | 164 model_ = NULL; |
165 } | 165 } |
166 | 166 |
167 void BookmarkEventRouter::BookmarkNodeMoved(BookmarkModel* model, | 167 void BookmarkEventRouter::BookmarkNodeMoved(BookmarkModel* model, |
168 const BookmarkNode* old_parent, | 168 const BookmarkNode* old_parent, |
169 int old_index, | 169 int old_index, |
170 const BookmarkNode* new_parent, | 170 const BookmarkNode* new_parent, |
171 int new_index) { | 171 int new_index) { |
172 scoped_ptr<ListValue> args(new ListValue()); | 172 scoped_ptr<base::ListValue> args(new base::ListValue()); |
173 const BookmarkNode* node = new_parent->GetChild(new_index); | 173 const BookmarkNode* node = new_parent->GetChild(new_index); |
174 args->Append(new StringValue(base::Int64ToString(node->id()))); | 174 args->Append(new base::StringValue(base::Int64ToString(node->id()))); |
175 DictionaryValue* object_args = new DictionaryValue(); | 175 base::DictionaryValue* object_args = new base::DictionaryValue(); |
176 object_args->SetString(keys::kParentIdKey, | 176 object_args->SetString(keys::kParentIdKey, |
177 base::Int64ToString(new_parent->id())); | 177 base::Int64ToString(new_parent->id())); |
178 object_args->SetInteger(keys::kIndexKey, new_index); | 178 object_args->SetInteger(keys::kIndexKey, new_index); |
179 object_args->SetString(keys::kOldParentIdKey, | 179 object_args->SetString(keys::kOldParentIdKey, |
180 base::Int64ToString(old_parent->id())); | 180 base::Int64ToString(old_parent->id())); |
181 object_args->SetInteger(keys::kOldIndexKey, old_index); | 181 object_args->SetInteger(keys::kOldIndexKey, old_index); |
182 args->Append(object_args); | 182 args->Append(object_args); |
183 | 183 |
184 DispatchEvent(keys::kOnBookmarkMoved, args.Pass()); | 184 DispatchEvent(keys::kOnBookmarkMoved, args.Pass()); |
185 } | 185 } |
186 | 186 |
187 void BookmarkEventRouter::BookmarkNodeAdded(BookmarkModel* model, | 187 void BookmarkEventRouter::BookmarkNodeAdded(BookmarkModel* model, |
188 const BookmarkNode* parent, | 188 const BookmarkNode* parent, |
189 int index) { | 189 int index) { |
190 scoped_ptr<ListValue> args(new ListValue()); | 190 scoped_ptr<base::ListValue> args(new base::ListValue()); |
191 const BookmarkNode* node = parent->GetChild(index); | 191 const BookmarkNode* node = parent->GetChild(index); |
192 args->Append(new StringValue(base::Int64ToString(node->id()))); | 192 args->Append(new base::StringValue(base::Int64ToString(node->id()))); |
193 scoped_ptr<BookmarkTreeNode> tree_node( | 193 scoped_ptr<BookmarkTreeNode> tree_node( |
194 bookmark_api_helpers::GetBookmarkTreeNode(node, false, false)); | 194 bookmark_api_helpers::GetBookmarkTreeNode(node, false, false)); |
195 args->Append(tree_node->ToValue().release()); | 195 args->Append(tree_node->ToValue().release()); |
196 | 196 |
197 DispatchEvent(keys::kOnBookmarkCreated, args.Pass()); | 197 DispatchEvent(keys::kOnBookmarkCreated, args.Pass()); |
198 } | 198 } |
199 | 199 |
200 void BookmarkEventRouter::BookmarkNodeRemoved(BookmarkModel* model, | 200 void BookmarkEventRouter::BookmarkNodeRemoved(BookmarkModel* model, |
201 const BookmarkNode* parent, | 201 const BookmarkNode* parent, |
202 int index, | 202 int index, |
203 const BookmarkNode* node) { | 203 const BookmarkNode* node) { |
204 scoped_ptr<ListValue> args(new ListValue()); | 204 scoped_ptr<base::ListValue> args(new base::ListValue()); |
205 args->Append(new StringValue(base::Int64ToString(node->id()))); | 205 args->Append(new base::StringValue(base::Int64ToString(node->id()))); |
206 DictionaryValue* object_args = new DictionaryValue(); | 206 base::DictionaryValue* object_args = new base::DictionaryValue(); |
207 object_args->SetString(keys::kParentIdKey, | 207 object_args->SetString(keys::kParentIdKey, |
208 base::Int64ToString(parent->id())); | 208 base::Int64ToString(parent->id())); |
209 object_args->SetInteger(keys::kIndexKey, index); | 209 object_args->SetInteger(keys::kIndexKey, index); |
210 args->Append(object_args); | 210 args->Append(object_args); |
211 | 211 |
212 DispatchEvent(keys::kOnBookmarkRemoved, args.Pass()); | 212 DispatchEvent(keys::kOnBookmarkRemoved, args.Pass()); |
213 } | 213 } |
214 | 214 |
215 void BookmarkEventRouter::BookmarkAllNodesRemoved(BookmarkModel* model) { | 215 void BookmarkEventRouter::BookmarkAllNodesRemoved(BookmarkModel* model) { |
216 NOTREACHED(); | 216 NOTREACHED(); |
217 // TODO(shashishekhar) Currently this notification is only used on Android, | 217 // TODO(shashishekhar) Currently this notification is only used on Android, |
218 // which does not support extensions. If Desktop needs to support this, add | 218 // which does not support extensions. If Desktop needs to support this, add |
219 // a new event to the extensions api. | 219 // a new event to the extensions api. |
220 } | 220 } |
221 | 221 |
222 void BookmarkEventRouter::BookmarkNodeChanged(BookmarkModel* model, | 222 void BookmarkEventRouter::BookmarkNodeChanged(BookmarkModel* model, |
223 const BookmarkNode* node) { | 223 const BookmarkNode* node) { |
224 scoped_ptr<ListValue> args(new ListValue()); | 224 scoped_ptr<base::ListValue> args(new base::ListValue()); |
225 args->Append(new StringValue(base::Int64ToString(node->id()))); | 225 args->Append(new base::StringValue(base::Int64ToString(node->id()))); |
226 | 226 |
227 // TODO(erikkay) The only three things that BookmarkModel sends this | 227 // TODO(erikkay) The only three things that BookmarkModel sends this |
228 // notification for are title, url and favicon. Since we're currently | 228 // notification for are title, url and favicon. Since we're currently |
229 // ignoring favicon and since the notification doesn't say which one anyway, | 229 // ignoring favicon and since the notification doesn't say which one anyway, |
230 // for now we only include title and url. The ideal thing would be to change | 230 // for now we only include title and url. The ideal thing would be to change |
231 // BookmarkModel to indicate what changed. | 231 // BookmarkModel to indicate what changed. |
232 DictionaryValue* object_args = new DictionaryValue(); | 232 base::DictionaryValue* object_args = new base::DictionaryValue(); |
233 object_args->SetString(keys::kTitleKey, node->GetTitle()); | 233 object_args->SetString(keys::kTitleKey, node->GetTitle()); |
234 if (node->is_url()) | 234 if (node->is_url()) |
235 object_args->SetString(keys::kUrlKey, node->url().spec()); | 235 object_args->SetString(keys::kUrlKey, node->url().spec()); |
236 args->Append(object_args); | 236 args->Append(object_args); |
237 | 237 |
238 DispatchEvent(keys::kOnBookmarkChanged, args.Pass()); | 238 DispatchEvent(keys::kOnBookmarkChanged, args.Pass()); |
239 } | 239 } |
240 | 240 |
241 void BookmarkEventRouter::BookmarkNodeFaviconChanged(BookmarkModel* model, | 241 void BookmarkEventRouter::BookmarkNodeFaviconChanged(BookmarkModel* model, |
242 const BookmarkNode* node) { | 242 const BookmarkNode* node) { |
243 // TODO(erikkay) anything we should do here? | 243 // TODO(erikkay) anything we should do here? |
244 } | 244 } |
245 | 245 |
246 void BookmarkEventRouter::BookmarkNodeChildrenReordered( | 246 void BookmarkEventRouter::BookmarkNodeChildrenReordered( |
247 BookmarkModel* model, | 247 BookmarkModel* model, |
248 const BookmarkNode* node) { | 248 const BookmarkNode* node) { |
249 scoped_ptr<ListValue> args(new ListValue()); | 249 scoped_ptr<base::ListValue> args(new base::ListValue()); |
250 args->Append(new StringValue(base::Int64ToString(node->id()))); | 250 args->Append(new base::StringValue(base::Int64ToString(node->id()))); |
251 int childCount = node->child_count(); | 251 int childCount = node->child_count(); |
252 ListValue* children = new ListValue(); | 252 base::ListValue* children = new base::ListValue(); |
253 for (int i = 0; i < childCount; ++i) { | 253 for (int i = 0; i < childCount; ++i) { |
254 const BookmarkNode* child = node->GetChild(i); | 254 const BookmarkNode* child = node->GetChild(i); |
255 Value* child_id = new StringValue(base::Int64ToString(child->id())); | 255 base::Value* child_id = |
| 256 new base::StringValue(base::Int64ToString(child->id())); |
256 children->Append(child_id); | 257 children->Append(child_id); |
257 } | 258 } |
258 DictionaryValue* reorder_info = new DictionaryValue(); | 259 base::DictionaryValue* reorder_info = new base::DictionaryValue(); |
259 reorder_info->Set(keys::kChildIdsKey, children); | 260 reorder_info->Set(keys::kChildIdsKey, children); |
260 args->Append(reorder_info); | 261 args->Append(reorder_info); |
261 | 262 |
262 DispatchEvent(keys::kOnBookmarkChildrenReordered, args.Pass()); | 263 DispatchEvent(keys::kOnBookmarkChildrenReordered, args.Pass()); |
263 } | 264 } |
264 | 265 |
265 void BookmarkEventRouter::ExtensiveBookmarkChangesBeginning( | 266 void BookmarkEventRouter::ExtensiveBookmarkChangesBeginning( |
266 BookmarkModel* model) { | 267 BookmarkModel* model) { |
267 scoped_ptr<ListValue> args(new ListValue()); | 268 scoped_ptr<base::ListValue> args(new base::ListValue()); |
268 DispatchEvent(keys::kOnBookmarkImportBegan, args.Pass()); | 269 DispatchEvent(keys::kOnBookmarkImportBegan, args.Pass()); |
269 } | 270 } |
270 | 271 |
271 void BookmarkEventRouter::ExtensiveBookmarkChangesEnded(BookmarkModel* model) { | 272 void BookmarkEventRouter::ExtensiveBookmarkChangesEnded(BookmarkModel* model) { |
272 scoped_ptr<ListValue> args(new ListValue()); | 273 scoped_ptr<base::ListValue> args(new base::ListValue()); |
273 DispatchEvent(keys::kOnBookmarkImportEnded, args.Pass()); | 274 DispatchEvent(keys::kOnBookmarkImportEnded, args.Pass()); |
274 } | 275 } |
275 | 276 |
276 BookmarksAPI::BookmarksAPI(Profile* profile) : profile_(profile) { | 277 BookmarksAPI::BookmarksAPI(Profile* profile) : profile_(profile) { |
277 ExtensionSystem::Get(profile_)->event_router()->RegisterObserver( | 278 ExtensionSystem::Get(profile_)->event_router()->RegisterObserver( |
278 this, keys::kOnBookmarkCreated); | 279 this, keys::kOnBookmarkCreated); |
279 ExtensionSystem::Get(profile_)->event_router()->RegisterObserver( | 280 ExtensionSystem::Get(profile_)->event_router()->RegisterObserver( |
280 this, keys::kOnBookmarkRemoved); | 281 this, keys::kOnBookmarkRemoved); |
281 ExtensionSystem::Get(profile_)->event_router()->RegisterObserver( | 282 ExtensionSystem::Get(profile_)->event_router()->RegisterObserver( |
282 this, keys::kOnBookmarkChanged); | 283 this, keys::kOnBookmarkChanged); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 for (std::vector<const BookmarkNode*>::iterator node_iter = nodes.begin(); | 451 for (std::vector<const BookmarkNode*>::iterator node_iter = nodes.begin(); |
451 node_iter != nodes.end(); ++node_iter) { | 452 node_iter != nodes.end(); ++node_iter) { |
452 bookmark_api_helpers::AddNode(*node_iter, &tree_nodes, false); | 453 bookmark_api_helpers::AddNode(*node_iter, &tree_nodes, false); |
453 } | 454 } |
454 | 455 |
455 results_ = bookmarks::Search::Results::Create(tree_nodes); | 456 results_ = bookmarks::Search::Results::Create(tree_nodes); |
456 return true; | 457 return true; |
457 } | 458 } |
458 | 459 |
459 // static | 460 // static |
460 bool BookmarksRemoveFunction::ExtractIds(const ListValue* args, | 461 bool BookmarksRemoveFunction::ExtractIds(const base::ListValue* args, |
461 std::list<int64>* ids, | 462 std::list<int64>* ids, |
462 bool* invalid_id) { | 463 bool* invalid_id) { |
463 std::string id_string; | 464 std::string id_string; |
464 if (!args->GetString(0, &id_string)) | 465 if (!args->GetString(0, &id_string)) |
465 return false; | 466 return false; |
466 int64 id; | 467 int64 id; |
467 if (base::StringToInt64(id_string, &id)) | 468 if (base::StringToInt64(id_string, &id)) |
468 ids->push_back(id); | 469 ids->push_back(id); |
469 else | 470 else |
470 *invalid_id = true; | 471 *invalid_id = true; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 } | 562 } |
562 | 563 |
563 scoped_ptr<BookmarkTreeNode> ret( | 564 scoped_ptr<BookmarkTreeNode> ret( |
564 bookmark_api_helpers::GetBookmarkTreeNode(node, false, false)); | 565 bookmark_api_helpers::GetBookmarkTreeNode(node, false, false)); |
565 results_ = bookmarks::Create::Results::Create(*ret); | 566 results_ = bookmarks::Create::Results::Create(*ret); |
566 | 567 |
567 return true; | 568 return true; |
568 } | 569 } |
569 | 570 |
570 // static | 571 // static |
571 bool BookmarksMoveFunction::ExtractIds(const ListValue* args, | 572 bool BookmarksMoveFunction::ExtractIds(const base::ListValue* args, |
572 std::list<int64>* ids, | 573 std::list<int64>* ids, |
573 bool* invalid_id) { | 574 bool* invalid_id) { |
574 // For now, Move accepts ID parameters in the same way as an Update. | 575 // For now, Move accepts ID parameters in the same way as an Update. |
575 return BookmarksUpdateFunction::ExtractIds(args, ids, invalid_id); | 576 return BookmarksUpdateFunction::ExtractIds(args, ids, invalid_id); |
576 } | 577 } |
577 | 578 |
578 bool BookmarksMoveFunction::RunImpl() { | 579 bool BookmarksMoveFunction::RunImpl() { |
579 if (!EditBookmarksEnabled()) | 580 if (!EditBookmarksEnabled()) |
580 return false; | 581 return false; |
581 | 582 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 model->Move(node, parent, index); | 636 model->Move(node, parent, index); |
636 | 637 |
637 scoped_ptr<BookmarkTreeNode> tree_node( | 638 scoped_ptr<BookmarkTreeNode> tree_node( |
638 bookmark_api_helpers::GetBookmarkTreeNode(node, false, false)); | 639 bookmark_api_helpers::GetBookmarkTreeNode(node, false, false)); |
639 results_ = bookmarks::Move::Results::Create(*tree_node); | 640 results_ = bookmarks::Move::Results::Create(*tree_node); |
640 | 641 |
641 return true; | 642 return true; |
642 } | 643 } |
643 | 644 |
644 // static | 645 // static |
645 bool BookmarksUpdateFunction::ExtractIds(const ListValue* args, | 646 bool BookmarksUpdateFunction::ExtractIds(const base::ListValue* args, |
646 std::list<int64>* ids, | 647 std::list<int64>* ids, |
647 bool* invalid_id) { | 648 bool* invalid_id) { |
648 // For now, Update accepts ID parameters in the same way as an Remove. | 649 // For now, Update accepts ID parameters in the same way as an Remove. |
649 return BookmarksRemoveFunction::ExtractIds(args, ids, invalid_id); | 650 return BookmarksRemoveFunction::ExtractIds(args, ids, invalid_id); |
650 } | 651 } |
651 | 652 |
652 bool BookmarksUpdateFunction::RunImpl() { | 653 bool BookmarksUpdateFunction::RunImpl() { |
653 if (!EditBookmarksEnabled()) | 654 if (!EditBookmarksEnabled()) |
654 return false; | 655 return false; |
655 | 656 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 std::map<BucketIdType, Bucket*> buckets_; | 722 std::map<BucketIdType, Bucket*> buckets_; |
722 }; | 723 }; |
723 | 724 |
724 // Mapper for 'bookmarks.create'. Maps "same input to bookmarks.create" to a | 725 // Mapper for 'bookmarks.create'. Maps "same input to bookmarks.create" to a |
725 // unique bucket. | 726 // unique bucket. |
726 class CreateBookmarkBucketMapper : public BookmarkBucketMapper<std::string> { | 727 class CreateBookmarkBucketMapper : public BookmarkBucketMapper<std::string> { |
727 public: | 728 public: |
728 explicit CreateBookmarkBucketMapper(Profile* profile) : profile_(profile) {} | 729 explicit CreateBookmarkBucketMapper(Profile* profile) : profile_(profile) {} |
729 // TODO(tim): This should share code with BookmarksCreateFunction::RunImpl, | 730 // TODO(tim): This should share code with BookmarksCreateFunction::RunImpl, |
730 // but I can't figure out a good way to do that with all the macros. | 731 // but I can't figure out a good way to do that with all the macros. |
731 virtual void GetBucketsForArgs(const ListValue* args, | 732 virtual void GetBucketsForArgs(const base::ListValue* args, |
732 BucketList* buckets) OVERRIDE { | 733 BucketList* buckets) OVERRIDE { |
733 const DictionaryValue* json; | 734 const base::DictionaryValue* json; |
734 if (!args->GetDictionary(0, &json)) | 735 if (!args->GetDictionary(0, &json)) |
735 return; | 736 return; |
736 | 737 |
737 std::string parent_id; | 738 std::string parent_id; |
738 if (json->HasKey(keys::kParentIdKey)) { | 739 if (json->HasKey(keys::kParentIdKey)) { |
739 if (!json->GetString(keys::kParentIdKey, &parent_id)) | 740 if (!json->GetString(keys::kParentIdKey, &parent_id)) |
740 return; | 741 return; |
741 } | 742 } |
742 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile_); | 743 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile_); |
743 | 744 |
(...skipping 16 matching lines...) Expand all Loading... |
760 buckets->push_back(GetBucket(base::SHA1HashString(bucket_id))); | 761 buckets->push_back(GetBucket(base::SHA1HashString(bucket_id))); |
761 } | 762 } |
762 private: | 763 private: |
763 Profile* profile_; | 764 Profile* profile_; |
764 }; | 765 }; |
765 | 766 |
766 // Mapper for 'bookmarks.remove'. | 767 // Mapper for 'bookmarks.remove'. |
767 class RemoveBookmarksBucketMapper : public BookmarkBucketMapper<std::string> { | 768 class RemoveBookmarksBucketMapper : public BookmarkBucketMapper<std::string> { |
768 public: | 769 public: |
769 explicit RemoveBookmarksBucketMapper(Profile* profile) : profile_(profile) {} | 770 explicit RemoveBookmarksBucketMapper(Profile* profile) : profile_(profile) {} |
770 virtual void GetBucketsForArgs(const ListValue* args, | 771 virtual void GetBucketsForArgs(const base::ListValue* args, |
771 BucketList* buckets) OVERRIDE { | 772 BucketList* buckets) OVERRIDE { |
772 typedef std::list<int64> IdList; | 773 typedef std::list<int64> IdList; |
773 IdList ids; | 774 IdList ids; |
774 bool invalid_id = false; | 775 bool invalid_id = false; |
775 if (!BookmarksRemoveFunction::ExtractIds(args, &ids, &invalid_id) || | 776 if (!BookmarksRemoveFunction::ExtractIds(args, &ids, &invalid_id) || |
776 invalid_id) { | 777 invalid_id) { |
777 return; | 778 return; |
778 } | 779 } |
779 | 780 |
780 for (IdList::iterator it = ids.begin(); it != ids.end(); ++it) { | 781 for (IdList::iterator it = ids.begin(); it != ids.end(); ++it) { |
(...skipping 14 matching lines...) Expand all Loading... |
795 }; | 796 }; |
796 | 797 |
797 // Mapper for any bookmark function accepting bookmark IDs as parameters, where | 798 // Mapper for any bookmark function accepting bookmark IDs as parameters, where |
798 // a distinct ID corresponds to a single item in terms of quota limiting. This | 799 // a distinct ID corresponds to a single item in terms of quota limiting. This |
799 // is inappropriate for bookmarks.remove, for example, since repeated removals | 800 // is inappropriate for bookmarks.remove, for example, since repeated removals |
800 // of the same item will actually have a different ID each time. | 801 // of the same item will actually have a different ID each time. |
801 template <class FunctionType> | 802 template <class FunctionType> |
802 class BookmarkIdMapper : public BookmarkBucketMapper<int64> { | 803 class BookmarkIdMapper : public BookmarkBucketMapper<int64> { |
803 public: | 804 public: |
804 typedef std::list<int64> IdList; | 805 typedef std::list<int64> IdList; |
805 virtual void GetBucketsForArgs(const ListValue* args, BucketList* buckets) { | 806 virtual void GetBucketsForArgs(const base::ListValue* args, |
| 807 BucketList* buckets) { |
806 IdList ids; | 808 IdList ids; |
807 bool invalid_id = false; | 809 bool invalid_id = false; |
808 if (!FunctionType::ExtractIds(args, &ids, &invalid_id) || invalid_id) | 810 if (!FunctionType::ExtractIds(args, &ids, &invalid_id) || invalid_id) |
809 return; | 811 return; |
810 for (IdList::iterator it = ids.begin(); it != ids.end(); ++it) | 812 for (IdList::iterator it = ids.begin(); it != ids.end(); ++it) |
811 buckets->push_back(GetBucket(*it)); | 813 buckets->push_back(GetBucket(*it)); |
812 } | 814 } |
813 }; | 815 }; |
814 | 816 |
815 // Builds heuristics for all BookmarkFunctions using specialized BucketMappers. | 817 // Builds heuristics for all BookmarkFunctions using specialized BucketMappers. |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 #if !defined(OS_ANDROID) | 1005 #if !defined(OS_ANDROID) |
1004 // Android does not have support for the standard exporter. | 1006 // Android does not have support for the standard exporter. |
1005 // TODO(jgreenwald): remove ifdef once extensions are no longer built on | 1007 // TODO(jgreenwald): remove ifdef once extensions are no longer built on |
1006 // Android. | 1008 // Android. |
1007 bookmark_html_writer::WriteBookmarks(profile(), path, NULL); | 1009 bookmark_html_writer::WriteBookmarks(profile(), path, NULL); |
1008 #endif | 1010 #endif |
1009 Release(); // Balanced in BookmarksIOFunction::SelectFile() | 1011 Release(); // Balanced in BookmarksIOFunction::SelectFile() |
1010 } | 1012 } |
1011 | 1013 |
1012 } // namespace extensions | 1014 } // namespace extensions |
OLD | NEW |