| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 bool BookmarksFunction::GetBookmarkIdAsInt64(const std::string& id_string, | 110 bool BookmarksFunction::GetBookmarkIdAsInt64(const std::string& id_string, |
| 111 int64* id) { | 111 int64* id) { |
| 112 if (base::StringToInt64(id_string, id)) | 112 if (base::StringToInt64(id_string, id)) |
| 113 return true; | 113 return true; |
| 114 | 114 |
| 115 error_ = keys::kInvalidIdError; | 115 error_ = keys::kInvalidIdError; |
| 116 return false; | 116 return false; |
| 117 } | 117 } |
| 118 | 118 |
| 119 bool BookmarksFunction::EditBookmarksEnabled() { | 119 bool BookmarksFunction::EditBookmarksEnabled() { |
| 120 PrefService* prefs = components::UserPrefs::Get(profile_); | 120 PrefService* prefs = user_prefs::UserPrefs::Get(profile_); |
| 121 if (prefs->GetBoolean(prefs::kEditBookmarksEnabled)) | 121 if (prefs->GetBoolean(prefs::kEditBookmarksEnabled)) |
| 122 return true; | 122 return true; |
| 123 error_ = keys::kEditBookmarksDisabled; | 123 error_ = keys::kEditBookmarksDisabled; |
| 124 return false; | 124 return false; |
| 125 } | 125 } |
| 126 | 126 |
| 127 void BookmarksFunction::BookmarkModelChanged() { | 127 void BookmarksFunction::BookmarkModelChanged() { |
| 128 } | 128 } |
| 129 | 129 |
| 130 void BookmarksFunction::Loaded(BookmarkModel* model, bool ids_reassigned) { | 130 void BookmarksFunction::Loaded(BookmarkModel* model, bool ids_reassigned) { |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 bookmark_api_helpers::AddNode(node, &nodes, true); | 429 bookmark_api_helpers::AddNode(node, &nodes, true); |
| 430 results_ = bookmarks::GetSubTree::Results::Create(nodes); | 430 results_ = bookmarks::GetSubTree::Results::Create(nodes); |
| 431 return true; | 431 return true; |
| 432 } | 432 } |
| 433 | 433 |
| 434 bool BookmarksSearchFunction::RunImpl() { | 434 bool BookmarksSearchFunction::RunImpl() { |
| 435 scoped_ptr<bookmarks::Search::Params> params( | 435 scoped_ptr<bookmarks::Search::Params> params( |
| 436 bookmarks::Search::Params::Create(*args_)); | 436 bookmarks::Search::Params::Create(*args_)); |
| 437 EXTENSION_FUNCTION_VALIDATE(params.get()); | 437 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 438 | 438 |
| 439 PrefService* prefs = components::UserPrefs::Get(profile_); | 439 PrefService* prefs = user_prefs::UserPrefs::Get(profile_); |
| 440 std::string lang = prefs->GetString(prefs::kAcceptLanguages); | 440 std::string lang = prefs->GetString(prefs::kAcceptLanguages); |
| 441 std::vector<const BookmarkNode*> nodes; | 441 std::vector<const BookmarkNode*> nodes; |
| 442 bookmark_utils::GetBookmarksContainingText( | 442 bookmark_utils::GetBookmarksContainingText( |
| 443 BookmarkModelFactory::GetForProfile(profile()), | 443 BookmarkModelFactory::GetForProfile(profile()), |
| 444 UTF8ToUTF16(params->query), | 444 UTF8ToUTF16(params->query), |
| 445 std::numeric_limits<int>::max(), | 445 std::numeric_limits<int>::max(), |
| 446 lang, | 446 lang, |
| 447 &nodes); | 447 &nodes); |
| 448 | 448 |
| 449 std::vector<linked_ptr<BookmarkTreeNode> > tree_nodes; | 449 std::vector<linked_ptr<BookmarkTreeNode> > tree_nodes; |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 #if !defined(OS_ANDROID) | 1003 #if !defined(OS_ANDROID) |
| 1004 // Android does not have support for the standard exporter. | 1004 // Android does not have support for the standard exporter. |
| 1005 // TODO(jgreenwald): remove ifdef once extensions are no longer built on | 1005 // TODO(jgreenwald): remove ifdef once extensions are no longer built on |
| 1006 // Android. | 1006 // Android. |
| 1007 bookmark_html_writer::WriteBookmarks(profile(), path, NULL); | 1007 bookmark_html_writer::WriteBookmarks(profile(), path, NULL); |
| 1008 #endif | 1008 #endif |
| 1009 Release(); // Balanced in BookmarksIOFunction::SelectFile() | 1009 Release(); // Balanced in BookmarksIOFunction::SelectFile() |
| 1010 } | 1010 } |
| 1011 | 1011 |
| 1012 } // namespace extensions | 1012 } // namespace extensions |
| OLD | NEW |