| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 91 |
| 92 file_util::ReplaceIllegalCharactersInPath(&filename, '_'); | 92 file_util::ReplaceIllegalCharactersInPath(&filename, '_'); |
| 93 | 93 |
| 94 base::FilePath default_path; | 94 base::FilePath default_path; |
| 95 PathService::Get(chrome::DIR_USER_DOCUMENTS, &default_path); | 95 PathService::Get(chrome::DIR_USER_DOCUMENTS, &default_path); |
| 96 return default_path.Append(filename); | 96 return default_path.Append(filename); |
| 97 } | 97 } |
| 98 | 98 |
| 99 } // namespace | 99 } // namespace |
| 100 | 100 |
| 101 bool BookmarksFunction::RunImpl() { | 101 bool BookmarksFunction::RunAsync() { |
| 102 BookmarkModel* model = BookmarkModelFactory::GetForProfile(GetProfile()); | 102 BookmarkModel* model = BookmarkModelFactory::GetForProfile(GetProfile()); |
| 103 if (!model->loaded()) { | 103 if (!model->loaded()) { |
| 104 // Bookmarks are not ready yet. We'll wait. | 104 // Bookmarks are not ready yet. We'll wait. |
| 105 model->AddObserver(this); | 105 model->AddObserver(this); |
| 106 AddRef(); // Balanced in Loaded(). | 106 AddRef(); // Balanced in Loaded(). |
| 107 return true; | 107 return true; |
| 108 } | 108 } |
| 109 | 109 |
| 110 bool success = RunOnReady(); | 110 bool success = RunOnReady(); |
| 111 if (success) { | 111 if (success) { |
| (...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 #if !defined(OS_ANDROID) | 1022 #if !defined(OS_ANDROID) |
| 1023 // Android does not have support for the standard exporter. | 1023 // Android does not have support for the standard exporter. |
| 1024 // TODO(jgreenwald): remove ifdef once extensions are no longer built on | 1024 // TODO(jgreenwald): remove ifdef once extensions are no longer built on |
| 1025 // Android. | 1025 // Android. |
| 1026 bookmark_html_writer::WriteBookmarks(GetProfile(), path, NULL); | 1026 bookmark_html_writer::WriteBookmarks(GetProfile(), path, NULL); |
| 1027 #endif | 1027 #endif |
| 1028 Release(); // Balanced in BookmarksIOFunction::SelectFile() | 1028 Release(); // Balanced in BookmarksIOFunction::SelectFile() |
| 1029 } | 1029 } |
| 1030 | 1030 |
| 1031 } // namespace extensions | 1031 } // namespace extensions |
| OLD | NEW |