summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions
diff options
context:
space:
mode:
authorarv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-30 21:45:18 +0000
committerarv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-30 21:45:18 +0000
commitd406e2e329cc7240e29597b35a7c20433c560a51 (patch)
tree415e605740e892819eb90a5dddc8008980c733b3 /chrome/browser/extensions
parent9d5ae76fed0c746fbc1d8424d0fb99c79a07205c (diff)
downloadchromium_src-d406e2e329cc7240e29597b35a7c20433c560a51.zip
chromium_src-d406e2e329cc7240e29597b35a7c20433c560a51.tar.gz
chromium_src-d406e2e329cc7240e29597b35a7c20433c560a51.tar.bz2
Expose sortChildren to the bookmark manager extension API and use that from the bookmark manager.
BUG=32194 TEST=browser_tests.exe --gtest_filter=ExtensionApiTest.BookmarkManager Review URL: http://codereview.chromium.org/551220 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37648 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r--chrome/browser/extensions/extension_bookmark_manager_api.cc16
-rw-r--r--chrome/browser/extensions/extension_bookmark_manager_api.h11
-rw-r--r--chrome/browser/extensions/extension_function_dispatcher.cc1
3 files changed, 24 insertions, 4 deletions
diff --git a/chrome/browser/extensions/extension_bookmark_manager_api.cc b/chrome/browser/extensions/extension_bookmark_manager_api.cc
index 11fd56d..dab25b1 100644
--- a/chrome/browser/extensions/extension_bookmark_manager_api.cc
+++ b/chrome/browser/extensions/extension_bookmark_manager_api.cc
@@ -78,6 +78,7 @@ bool CanPasteBookmarkManagerFunction::RunImpl() {
SendResponse(true);
return true;
}
+
void BookmarkManagerIOFunction::SelectFile(SelectFileDialog::Type type) {
// Balanced in one of the three callbacks of SelectFileDialog:
// either FileSelectionCanceled, MultiFilesSelected, or FileSelected
@@ -98,12 +99,12 @@ void BookmarkManagerIOFunction::SelectFile(SelectFileDialog::Type type) {
}
void BookmarkManagerIOFunction::FileSelectionCanceled(void* params) {
- Release(); //Balanced in BookmarkManagerIOFunction::SelectFile()
+ Release(); // Balanced in BookmarkManagerIOFunction::SelectFile()
}
void BookmarkManagerIOFunction::MultiFilesSelected(
const std::vector<FilePath>& files, void* params) {
- Release(); //Balanced in BookmarkManagerIOFunction::SelectFile()
+ Release(); // Balanced in BookmarkManagerIOFunction::SelectFile()
NOTREACHED() << "Should not be able to select multiple files";
}
@@ -124,7 +125,7 @@ void ImportBookmarksFunction::FileSelected(const FilePath& path,
FAVORITES,
new ProfileWriter(profile()),
true);
- Release(); //Balanced in BookmarkManagerIOFunction::SelectFile()
+ Release(); // Balanced in BookmarkManagerIOFunction::SelectFile()
}
bool ExportBookmarksFunction::RunImpl() {
@@ -136,7 +137,14 @@ void ExportBookmarksFunction::FileSelected(const FilePath& path,
int index,
void* params) {
bookmark_html_writer::WriteBookmarks(profile()->GetBookmarkModel(), path);
- Release(); //Balanced in BookmarkManagerIOFunction::SelectFile()
+ Release(); // Balanced in BookmarkManagerIOFunction::SelectFile()
+}
+
+bool SortChildrenBookmarkManagerFunction::RunImpl() {
+ const BookmarkNode* parent_node = GetNodeFromArguments();
+ BookmarkModel* model = profile()->GetBookmarkModel();
+ model->SortChildren(parent_node);
+ return true;
}
bool BookmarkManagerGetStringsFunction::RunImpl() {
diff --git a/chrome/browser/extensions/extension_bookmark_manager_api.h b/chrome/browser/extensions/extension_bookmark_manager_api.h
index 72f1bf0..188164e 100644
--- a/chrome/browser/extensions/extension_bookmark_manager_api.h
+++ b/chrome/browser/extensions/extension_bookmark_manager_api.h
@@ -88,6 +88,17 @@ class ExportBookmarksFunction : public BookmarkManagerIOFunction {
DECLARE_EXTENSION_FUNCTION_NAME("experimental.bookmarkManager.export");
};
+class SortChildrenBookmarkManagerFunction
+ : public ClipboardBookmarkManagerFunction {
+ public:
+ // Override ClipboardBookmarkManagerFunction.
+ virtual bool RunImpl();
+
+ private:
+ DECLARE_EXTENSION_FUNCTION_NAME(
+ "experimental.bookmarkManager.sortChildren");
+};
+
class BookmarkManagerGetStringsFunction : public AsyncExtensionFunction {
public:
// Override AsyncExtensionFunction.
diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc
index 936d871..7ba97ff 100644
--- a/chrome/browser/extensions/extension_function_dispatcher.cc
+++ b/chrome/browser/extensions/extension_function_dispatcher.cc
@@ -142,6 +142,7 @@ void FactoryRegistry::ResetFunctions() {
RegisterFunction<CanPasteBookmarkManagerFunction>();
RegisterFunction<ImportBookmarksFunction>();
RegisterFunction<ExportBookmarksFunction>();
+ RegisterFunction<SortChildrenBookmarkManagerFunction>();
RegisterFunction<BookmarkManagerGetStringsFunction>();
// History