summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions
diff options
context:
space:
mode:
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