| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/extension_bookmarks_module.h" | 5 #include "chrome/browser/extensions/extension_bookmarks_module.h" |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/sha1.h" | 8 #include "base/sha1.h" |
| 9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 | 323 |
| 324 bool SearchBookmarksFunction::RunImpl() { | 324 bool SearchBookmarksFunction::RunImpl() { |
| 325 string16 query; | 325 string16 query; |
| 326 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &query)); | 326 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &query)); |
| 327 | 327 |
| 328 BookmarkModel* model = profile()->GetBookmarkModel(); | 328 BookmarkModel* model = profile()->GetBookmarkModel(); |
| 329 ListValue* json = new ListValue(); | 329 ListValue* json = new ListValue(); |
| 330 std::wstring lang = | 330 std::wstring lang = |
| 331 UTF8ToWide(profile()->GetPrefs()->GetString(prefs::kAcceptLanguages)); | 331 UTF8ToWide(profile()->GetPrefs()->GetString(prefs::kAcceptLanguages)); |
| 332 std::vector<const BookmarkNode*> nodes; | 332 std::vector<const BookmarkNode*> nodes; |
| 333 bookmark_utils::GetBookmarksContainingText(model, UTF16ToWideHack(query), | 333 bookmark_utils::GetBookmarksContainingText(model, query, |
| 334 std::numeric_limits<int>::max(), | 334 std::numeric_limits<int>::max(), |
| 335 lang, &nodes); | 335 lang, &nodes); |
| 336 std::vector<const BookmarkNode*>::iterator i = nodes.begin(); | 336 std::vector<const BookmarkNode*>::iterator i = nodes.begin(); |
| 337 for (; i != nodes.end(); ++i) { | 337 for (; i != nodes.end(); ++i) { |
| 338 const BookmarkNode* node = *i; | 338 const BookmarkNode* node = *i; |
| 339 extension_bookmark_helpers::AddNode(node, json, false); | 339 extension_bookmark_helpers::AddNode(node, json, false); |
| 340 } | 340 } |
| 341 | 341 |
| 342 result_.reset(json); | 342 result_.reset(json); |
| 343 return true; | 343 return true; |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE); | 819 SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE); |
| 820 return true; | 820 return true; |
| 821 } | 821 } |
| 822 | 822 |
| 823 void ExportBookmarksFunction::FileSelected(const FilePath& path, | 823 void ExportBookmarksFunction::FileSelected(const FilePath& path, |
| 824 int index, | 824 int index, |
| 825 void* params) { | 825 void* params) { |
| 826 bookmark_html_writer::WriteBookmarks(profile(), path, NULL); | 826 bookmark_html_writer::WriteBookmarks(profile(), path, NULL); |
| 827 Release(); // Balanced in BookmarksIOFunction::SelectFile() | 827 Release(); // Balanced in BookmarksIOFunction::SelectFile() |
| 828 } | 828 } |
| OLD | NEW |