| 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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 BookmarksAPI::GetFactoryInstance() { | 409 BookmarksAPI::GetFactoryInstance() { |
| 410 return g_factory.Pointer(); | 410 return g_factory.Pointer(); |
| 411 } | 411 } |
| 412 | 412 |
| 413 void BookmarksAPI::OnListenerAdded(const EventListenerInfo& details) { | 413 void BookmarksAPI::OnListenerAdded(const EventListenerInfo& details) { |
| 414 bookmark_event_router_.reset( | 414 bookmark_event_router_.reset( |
| 415 new BookmarkEventRouter(Profile::FromBrowserContext(browser_context_))); | 415 new BookmarkEventRouter(Profile::FromBrowserContext(browser_context_))); |
| 416 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 416 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
| 417 } | 417 } |
| 418 | 418 |
| 419 BookmarksGetFunction::BookmarksGetFunction() = default; |
| 420 |
| 419 bool BookmarksGetFunction::RunOnReady() { | 421 bool BookmarksGetFunction::RunOnReady() { |
| 420 scoped_ptr<bookmarks::Get::Params> params( | 422 scoped_ptr<bookmarks::Get::Params> params( |
| 421 bookmarks::Get::Params::Create(*args_)); | 423 bookmarks::Get::Params::Create(*args_)); |
| 422 EXTENSION_FUNCTION_VALIDATE(params.get()); | 424 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 423 | 425 |
| 424 std::vector<linked_ptr<BookmarkTreeNode> > nodes; | 426 std::vector<linked_ptr<BookmarkTreeNode> > nodes; |
| 425 ManagedBookmarkService* managed = GetManagedBookmarkService(); | 427 ManagedBookmarkService* managed = GetManagedBookmarkService(); |
| 426 if (params->id_or_id_list.as_strings) { | 428 if (params->id_or_id_list.as_strings) { |
| 427 std::vector<std::string>& ids = *params->id_or_id_list.as_strings; | 429 std::vector<std::string>& ids = *params->id_or_id_list.as_strings; |
| 428 size_t count = ids.size(); | 430 size_t count = ids.size(); |
| 429 EXTENSION_FUNCTION_VALIDATE(count > 0); | 431 EXTENSION_FUNCTION_VALIDATE(count > 0); |
| 430 for (size_t i = 0; i < count; ++i) { | 432 for (size_t i = 0; i < count; ++i) { |
| 431 const BookmarkNode* node = GetBookmarkNodeFromId(ids[i]); | 433 const BookmarkNode* node = GetBookmarkNodeFromId(ids[i]); |
| 432 if (!node) | 434 if (!node) |
| 433 return false; | 435 return false; |
| 434 bookmark_api_helpers::AddNode(managed, node, &nodes, false); | 436 bookmark_api_helpers::AddNode(managed, node, &nodes, false); |
| 435 } | 437 } |
| 436 } else { | 438 } else { |
| 437 const BookmarkNode* node = | 439 const BookmarkNode* node = |
| 438 GetBookmarkNodeFromId(*params->id_or_id_list.as_string); | 440 GetBookmarkNodeFromId(*params->id_or_id_list.as_string); |
| 439 if (!node) | 441 if (!node) |
| 440 return false; | 442 return false; |
| 441 bookmark_api_helpers::AddNode(managed, node, &nodes, false); | 443 bookmark_api_helpers::AddNode(managed, node, &nodes, false); |
| 442 } | 444 } |
| 443 | 445 |
| 444 results_ = bookmarks::Get::Results::Create(nodes); | 446 results_ = bookmarks::Get::Results::Create(nodes); |
| 445 return true; | 447 return true; |
| 446 } | 448 } |
| 447 | 449 |
| 450 BookmarksGetChildrenFunction::BookmarksGetChildrenFunction() = default; |
| 451 |
| 448 bool BookmarksGetChildrenFunction::RunOnReady() { | 452 bool BookmarksGetChildrenFunction::RunOnReady() { |
| 449 scoped_ptr<bookmarks::GetChildren::Params> params( | 453 scoped_ptr<bookmarks::GetChildren::Params> params( |
| 450 bookmarks::GetChildren::Params::Create(*args_)); | 454 bookmarks::GetChildren::Params::Create(*args_)); |
| 451 EXTENSION_FUNCTION_VALIDATE(params.get()); | 455 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 452 | 456 |
| 453 const BookmarkNode* node = GetBookmarkNodeFromId(params->id); | 457 const BookmarkNode* node = GetBookmarkNodeFromId(params->id); |
| 454 if (!node) | 458 if (!node) |
| 455 return false; | 459 return false; |
| 456 | 460 |
| 457 std::vector<linked_ptr<BookmarkTreeNode> > nodes; | 461 std::vector<linked_ptr<BookmarkTreeNode> > nodes; |
| 458 int child_count = node->child_count(); | 462 int child_count = node->child_count(); |
| 459 for (int i = 0; i < child_count; ++i) { | 463 for (int i = 0; i < child_count; ++i) { |
| 460 const BookmarkNode* child = node->GetChild(i); | 464 const BookmarkNode* child = node->GetChild(i); |
| 461 bookmark_api_helpers::AddNode(GetManagedBookmarkService(), child, &nodes, | 465 bookmark_api_helpers::AddNode(GetManagedBookmarkService(), child, &nodes, |
| 462 false); | 466 false); |
| 463 } | 467 } |
| 464 | 468 |
| 465 results_ = bookmarks::GetChildren::Results::Create(nodes); | 469 results_ = bookmarks::GetChildren::Results::Create(nodes); |
| 466 return true; | 470 return true; |
| 467 } | 471 } |
| 468 | 472 |
| 473 BookmarksGetRecentFunction::BookmarksGetRecentFunction() = default; |
| 474 |
| 469 bool BookmarksGetRecentFunction::RunOnReady() { | 475 bool BookmarksGetRecentFunction::RunOnReady() { |
| 470 scoped_ptr<bookmarks::GetRecent::Params> params( | 476 scoped_ptr<bookmarks::GetRecent::Params> params( |
| 471 bookmarks::GetRecent::Params::Create(*args_)); | 477 bookmarks::GetRecent::Params::Create(*args_)); |
| 472 EXTENSION_FUNCTION_VALIDATE(params.get()); | 478 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 473 if (params->number_of_items < 1) | 479 if (params->number_of_items < 1) |
| 474 return false; | 480 return false; |
| 475 | 481 |
| 476 std::vector<const BookmarkNode*> nodes; | 482 std::vector<const BookmarkNode*> nodes; |
| 477 ::bookmarks::GetMostRecentlyAddedEntries( | 483 ::bookmarks::GetMostRecentlyAddedEntries( |
| 478 BookmarkModelFactory::GetForProfile(GetProfile()), | 484 BookmarkModelFactory::GetForProfile(GetProfile()), |
| 479 params->number_of_items, | 485 params->number_of_items, |
| 480 &nodes); | 486 &nodes); |
| 481 | 487 |
| 482 std::vector<linked_ptr<BookmarkTreeNode> > tree_nodes; | 488 std::vector<linked_ptr<BookmarkTreeNode> > tree_nodes; |
| 483 std::vector<const BookmarkNode*>::iterator i = nodes.begin(); | 489 std::vector<const BookmarkNode*>::iterator i = nodes.begin(); |
| 484 for (; i != nodes.end(); ++i) { | 490 for (; i != nodes.end(); ++i) { |
| 485 const BookmarkNode* node = *i; | 491 const BookmarkNode* node = *i; |
| 486 bookmark_api_helpers::AddNode(GetManagedBookmarkService(), node, | 492 bookmark_api_helpers::AddNode(GetManagedBookmarkService(), node, |
| 487 &tree_nodes, false); | 493 &tree_nodes, false); |
| 488 } | 494 } |
| 489 | 495 |
| 490 results_ = bookmarks::GetRecent::Results::Create(tree_nodes); | 496 results_ = bookmarks::GetRecent::Results::Create(tree_nodes); |
| 491 return true; | 497 return true; |
| 492 } | 498 } |
| 493 | 499 |
| 500 BookmarksGetTreeFunction::BookmarksGetTreeFunction() = default; |
| 501 |
| 494 bool BookmarksGetTreeFunction::RunOnReady() { | 502 bool BookmarksGetTreeFunction::RunOnReady() { |
| 495 std::vector<linked_ptr<BookmarkTreeNode> > nodes; | 503 std::vector<linked_ptr<BookmarkTreeNode> > nodes; |
| 496 const BookmarkNode* node = | 504 const BookmarkNode* node = |
| 497 BookmarkModelFactory::GetForProfile(GetProfile())->root_node(); | 505 BookmarkModelFactory::GetForProfile(GetProfile())->root_node(); |
| 498 bookmark_api_helpers::AddNode(GetManagedBookmarkService(), node, &nodes, | 506 bookmark_api_helpers::AddNode(GetManagedBookmarkService(), node, &nodes, |
| 499 true); | 507 true); |
| 500 results_ = bookmarks::GetTree::Results::Create(nodes); | 508 results_ = bookmarks::GetTree::Results::Create(nodes); |
| 501 return true; | 509 return true; |
| 502 } | 510 } |
| 503 | 511 |
| 512 BookmarksGetSubTreeFunction::BookmarksGetSubTreeFunction() = default; |
| 513 |
| 504 bool BookmarksGetSubTreeFunction::RunOnReady() { | 514 bool BookmarksGetSubTreeFunction::RunOnReady() { |
| 505 scoped_ptr<bookmarks::GetSubTree::Params> params( | 515 scoped_ptr<bookmarks::GetSubTree::Params> params( |
| 506 bookmarks::GetSubTree::Params::Create(*args_)); | 516 bookmarks::GetSubTree::Params::Create(*args_)); |
| 507 EXTENSION_FUNCTION_VALIDATE(params.get()); | 517 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 508 | 518 |
| 509 const BookmarkNode* node = GetBookmarkNodeFromId(params->id); | 519 const BookmarkNode* node = GetBookmarkNodeFromId(params->id); |
| 510 if (!node) | 520 if (!node) |
| 511 return false; | 521 return false; |
| 512 | 522 |
| 513 std::vector<linked_ptr<BookmarkTreeNode> > nodes; | 523 std::vector<linked_ptr<BookmarkTreeNode> > nodes; |
| 514 bookmark_api_helpers::AddNode(GetManagedBookmarkService(), node, &nodes, | 524 bookmark_api_helpers::AddNode(GetManagedBookmarkService(), node, &nodes, |
| 515 true); | 525 true); |
| 516 results_ = bookmarks::GetSubTree::Results::Create(nodes); | 526 results_ = bookmarks::GetSubTree::Results::Create(nodes); |
| 517 return true; | 527 return true; |
| 518 } | 528 } |
| 519 | 529 |
| 530 BookmarksSearchFunction::BookmarksSearchFunction() = default; |
| 531 |
| 520 bool BookmarksSearchFunction::RunOnReady() { | 532 bool BookmarksSearchFunction::RunOnReady() { |
| 521 scoped_ptr<bookmarks::Search::Params> params( | 533 scoped_ptr<bookmarks::Search::Params> params( |
| 522 bookmarks::Search::Params::Create(*args_)); | 534 bookmarks::Search::Params::Create(*args_)); |
| 523 EXTENSION_FUNCTION_VALIDATE(params.get()); | 535 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 524 | 536 |
| 525 PrefService* prefs = user_prefs::UserPrefs::Get(GetProfile()); | 537 PrefService* prefs = user_prefs::UserPrefs::Get(GetProfile()); |
| 526 std::string lang = prefs->GetString(prefs::kAcceptLanguages); | 538 std::string lang = prefs->GetString(prefs::kAcceptLanguages); |
| 527 std::vector<const BookmarkNode*> nodes; | 539 std::vector<const BookmarkNode*> nodes; |
| 528 if (params->query.as_string) { | 540 if (params->query.as_string) { |
| 529 ::bookmarks::QueryFields query; | 541 ::bookmarks::QueryFields query; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 560 ManagedBookmarkService* managed = GetManagedBookmarkService(); | 572 ManagedBookmarkService* managed = GetManagedBookmarkService(); |
| 561 for (std::vector<const BookmarkNode*>::iterator node_iter = nodes.begin(); | 573 for (std::vector<const BookmarkNode*>::iterator node_iter = nodes.begin(); |
| 562 node_iter != nodes.end(); ++node_iter) { | 574 node_iter != nodes.end(); ++node_iter) { |
| 563 bookmark_api_helpers::AddNode(managed, *node_iter, &tree_nodes, false); | 575 bookmark_api_helpers::AddNode(managed, *node_iter, &tree_nodes, false); |
| 564 } | 576 } |
| 565 | 577 |
| 566 results_ = bookmarks::Search::Results::Create(tree_nodes); | 578 results_ = bookmarks::Search::Results::Create(tree_nodes); |
| 567 return true; | 579 return true; |
| 568 } | 580 } |
| 569 | 581 |
| 582 BookmarksRemoveFunction::BookmarksRemoveFunction() = default; |
| 583 |
| 570 // static | 584 // static |
| 571 bool BookmarksRemoveFunction::ExtractIds(const base::ListValue* args, | 585 bool BookmarksRemoveFunction::ExtractIds(const base::ListValue* args, |
| 572 std::list<int64>* ids, | 586 std::list<int64>* ids, |
| 573 bool* invalid_id) { | 587 bool* invalid_id) { |
| 574 std::string id_string; | 588 std::string id_string; |
| 575 if (!args->GetString(0, &id_string)) | 589 if (!args->GetString(0, &id_string)) |
| 576 return false; | 590 return false; |
| 577 int64 id; | 591 int64 id; |
| 578 if (base::StringToInt64(id_string, &id)) | 592 if (base::StringToInt64(id_string, &id)) |
| 579 ids->push_back(id); | 593 ids->push_back(id); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 599 recursive = true; | 613 recursive = true; |
| 600 | 614 |
| 601 BookmarkModel* model = GetBookmarkModel(); | 615 BookmarkModel* model = GetBookmarkModel(); |
| 602 ManagedBookmarkService* managed = GetManagedBookmarkService(); | 616 ManagedBookmarkService* managed = GetManagedBookmarkService(); |
| 603 if (!bookmark_api_helpers::RemoveNode(model, managed, id, recursive, &error_)) | 617 if (!bookmark_api_helpers::RemoveNode(model, managed, id, recursive, &error_)) |
| 604 return false; | 618 return false; |
| 605 | 619 |
| 606 return true; | 620 return true; |
| 607 } | 621 } |
| 608 | 622 |
| 623 BookmarksRemoveTreeFunction::BookmarksRemoveTreeFunction() = default; |
| 624 |
| 625 BookmarksCreateFunction::BookmarksCreateFunction() = default; |
| 626 |
| 609 bool BookmarksCreateFunction::RunOnReady() { | 627 bool BookmarksCreateFunction::RunOnReady() { |
| 610 if (!EditBookmarksEnabled()) | 628 if (!EditBookmarksEnabled()) |
| 611 return false; | 629 return false; |
| 612 | 630 |
| 613 scoped_ptr<bookmarks::Create::Params> params( | 631 scoped_ptr<bookmarks::Create::Params> params( |
| 614 bookmarks::Create::Params::Create(*args_)); | 632 bookmarks::Create::Params::Create(*args_)); |
| 615 EXTENSION_FUNCTION_VALIDATE(params.get()); | 633 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 616 | 634 |
| 617 BookmarkModel* model = BookmarkModelFactory::GetForProfile(GetProfile()); | 635 BookmarkModel* model = BookmarkModelFactory::GetForProfile(GetProfile()); |
| 618 const BookmarkNode* node = CreateBookmarkNode(model, params->bookmark, NULL); | 636 const BookmarkNode* node = CreateBookmarkNode(model, params->bookmark, NULL); |
| 619 if (!node) | 637 if (!node) |
| 620 return false; | 638 return false; |
| 621 | 639 |
| 622 scoped_ptr<BookmarkTreeNode> ret(bookmark_api_helpers::GetBookmarkTreeNode( | 640 scoped_ptr<BookmarkTreeNode> ret(bookmark_api_helpers::GetBookmarkTreeNode( |
| 623 GetManagedBookmarkService(), node, false, false)); | 641 GetManagedBookmarkService(), node, false, false)); |
| 624 results_ = bookmarks::Create::Results::Create(*ret); | 642 results_ = bookmarks::Create::Results::Create(*ret); |
| 625 | 643 |
| 626 return true; | 644 return true; |
| 627 } | 645 } |
| 628 | 646 |
| 647 BookmarksMoveFunction::BookmarksMoveFunction() = default; |
| 648 |
| 629 // static | 649 // static |
| 630 bool BookmarksMoveFunction::ExtractIds(const base::ListValue* args, | 650 bool BookmarksMoveFunction::ExtractIds(const base::ListValue* args, |
| 631 std::list<int64>* ids, | 651 std::list<int64>* ids, |
| 632 bool* invalid_id) { | 652 bool* invalid_id) { |
| 633 // For now, Move accepts ID parameters in the same way as an Update. | 653 // For now, Move accepts ID parameters in the same way as an Update. |
| 634 return BookmarksUpdateFunction::ExtractIds(args, ids, invalid_id); | 654 return BookmarksUpdateFunction::ExtractIds(args, ids, invalid_id); |
| 635 } | 655 } |
| 636 | 656 |
| 637 bool BookmarksMoveFunction::RunOnReady() { | 657 bool BookmarksMoveFunction::RunOnReady() { |
| 638 if (!EditBookmarksEnabled()) | 658 if (!EditBookmarksEnabled()) |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 model->Move(node, parent, index); | 700 model->Move(node, parent, index); |
| 681 | 701 |
| 682 scoped_ptr<BookmarkTreeNode> tree_node( | 702 scoped_ptr<BookmarkTreeNode> tree_node( |
| 683 bookmark_api_helpers::GetBookmarkTreeNode(GetManagedBookmarkService(), | 703 bookmark_api_helpers::GetBookmarkTreeNode(GetManagedBookmarkService(), |
| 684 node, false, false)); | 704 node, false, false)); |
| 685 results_ = bookmarks::Move::Results::Create(*tree_node); | 705 results_ = bookmarks::Move::Results::Create(*tree_node); |
| 686 | 706 |
| 687 return true; | 707 return true; |
| 688 } | 708 } |
| 689 | 709 |
| 710 BookmarksUpdateFunction::BookmarksUpdateFunction() = default; |
| 711 |
| 690 // static | 712 // static |
| 691 bool BookmarksUpdateFunction::ExtractIds(const base::ListValue* args, | 713 bool BookmarksUpdateFunction::ExtractIds(const base::ListValue* args, |
| 692 std::list<int64>* ids, | 714 std::list<int64>* ids, |
| 693 bool* invalid_id) { | 715 bool* invalid_id) { |
| 694 // For now, Update accepts ID parameters in the same way as an Remove. | 716 // For now, Update accepts ID parameters in the same way as an Remove. |
| 695 return BookmarksRemoveFunction::ExtractIds(args, ids, invalid_id); | 717 return BookmarksRemoveFunction::ExtractIds(args, ids, invalid_id); |
| 696 } | 718 } |
| 697 | 719 |
| 698 bool BookmarksUpdateFunction::RunOnReady() { | 720 bool BookmarksUpdateFunction::RunOnReady() { |
| 699 if (!EditBookmarksEnabled()) | 721 if (!EditBookmarksEnabled()) |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 void BookmarksIOFunction::FileSelectionCanceled(void* params) { | 837 void BookmarksIOFunction::FileSelectionCanceled(void* params) { |
| 816 Release(); // Balanced in BookmarksIOFunction::SelectFile() | 838 Release(); // Balanced in BookmarksIOFunction::SelectFile() |
| 817 } | 839 } |
| 818 | 840 |
| 819 void BookmarksIOFunction::MultiFilesSelected( | 841 void BookmarksIOFunction::MultiFilesSelected( |
| 820 const std::vector<base::FilePath>& files, void* params) { | 842 const std::vector<base::FilePath>& files, void* params) { |
| 821 Release(); // Balanced in BookmarsIOFunction::SelectFile() | 843 Release(); // Balanced in BookmarsIOFunction::SelectFile() |
| 822 NOTREACHED() << "Should not be able to select multiple files"; | 844 NOTREACHED() << "Should not be able to select multiple files"; |
| 823 } | 845 } |
| 824 | 846 |
| 847 BookmarksImportFunction::BookmarksImportFunction() = default; |
| 848 |
| 825 bool BookmarksImportFunction::RunOnReady() { | 849 bool BookmarksImportFunction::RunOnReady() { |
| 826 if (!EditBookmarksEnabled()) | 850 if (!EditBookmarksEnabled()) |
| 827 return false; | 851 return false; |
| 828 SelectFile(ui::SelectFileDialog::SELECT_OPEN_FILE); | 852 SelectFile(ui::SelectFileDialog::SELECT_OPEN_FILE); |
| 829 return true; | 853 return true; |
| 830 } | 854 } |
| 831 | 855 |
| 832 void BookmarksImportFunction::FileSelected(const base::FilePath& path, | 856 void BookmarksImportFunction::FileSelected(const base::FilePath& path, |
| 833 int index, | 857 int index, |
| 834 void* params) { | 858 void* params) { |
| 835 // Deletes itself. | 859 // Deletes itself. |
| 836 ExternalProcessImporterHost* importer_host = new ExternalProcessImporterHost; | 860 ExternalProcessImporterHost* importer_host = new ExternalProcessImporterHost; |
| 837 importer::SourceProfile source_profile; | 861 importer::SourceProfile source_profile; |
| 838 source_profile.importer_type = importer::TYPE_BOOKMARKS_FILE; | 862 source_profile.importer_type = importer::TYPE_BOOKMARKS_FILE; |
| 839 source_profile.source_path = path; | 863 source_profile.source_path = path; |
| 840 importer_host->StartImportSettings(source_profile, | 864 importer_host->StartImportSettings(source_profile, |
| 841 GetProfile(), | 865 GetProfile(), |
| 842 importer::FAVORITES, | 866 importer::FAVORITES, |
| 843 new ProfileWriter(GetProfile())); | 867 new ProfileWriter(GetProfile())); |
| 844 | 868 |
| 845 importer::LogImporterUseToMetrics("BookmarksAPI", | 869 importer::LogImporterUseToMetrics("BookmarksAPI", |
| 846 importer::TYPE_BOOKMARKS_FILE); | 870 importer::TYPE_BOOKMARKS_FILE); |
| 847 Release(); // Balanced in BookmarksIOFunction::SelectFile() | 871 Release(); // Balanced in BookmarksIOFunction::SelectFile() |
| 848 } | 872 } |
| 849 | 873 |
| 874 BookmarksExportFunction::BookmarksExportFunction() = default; |
| 875 |
| 850 bool BookmarksExportFunction::RunOnReady() { | 876 bool BookmarksExportFunction::RunOnReady() { |
| 851 SelectFile(ui::SelectFileDialog::SELECT_SAVEAS_FILE); | 877 SelectFile(ui::SelectFileDialog::SELECT_SAVEAS_FILE); |
| 852 return true; | 878 return true; |
| 853 } | 879 } |
| 854 | 880 |
| 855 void BookmarksExportFunction::FileSelected(const base::FilePath& path, | 881 void BookmarksExportFunction::FileSelected(const base::FilePath& path, |
| 856 int index, | 882 int index, |
| 857 void* params) { | 883 void* params) { |
| 858 bookmark_html_writer::WriteBookmarks(GetProfile(), path, NULL); | 884 bookmark_html_writer::WriteBookmarks(GetProfile(), path, NULL); |
| 859 Release(); // Balanced in BookmarksIOFunction::SelectFile() | 885 Release(); // Balanced in BookmarksIOFunction::SelectFile() |
| 860 } | 886 } |
| 861 | 887 |
| 862 } // namespace extensions | 888 } // namespace extensions |
| OLD | NEW |