chromium/chrome/browser/bookmarks/bookmark_html_writer.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "chrome/browser/bookmarks/bookmark_html_writer.h"

#include <stddef.h>
#include <stdint.h>

#include <list>
#include <map>
#include <memory>
#include <string>

#include "base/base64.h"
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/escape.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/supports_user_data.h"
#include "base/task/thread_pool.h"
#include "base/time/time.h"
#include "base/values.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/favicon/favicon_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "components/bookmarks/browser/bookmark_codec.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/favicon/core/favicon_service.h"
#include "components/favicon_base/favicon_types.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/browser_thread.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/favicon_size.h"

BookmarkCodec;
BookmarkNode;
BrowserThread;

namespace {

const char kBookmarkFaviconFetcherKey[] =;

// File header.
const char kHeader[] =;

// Newline separator.
const char kNewline[] =;

// The following are used for bookmarks.

// Start of a bookmark.
const char kBookmarkStart[] =;
// After kBookmarkStart.
const char kAddDate[] =;
// After kAddDate.
const char kIcon[] =;
// After kIcon.
const char kBookmarkAttributeEnd[] =;
// End of a bookmark.
const char kBookmarkEnd[] =;

// The following are used when writing folders.

// Start of a folder.
const char kFolderStart[] =;
// After kFolderStart.
const char kLastModified[] =;
// After kLastModified when writing the bookmark bar.
const char kBookmarkBar[] =;
// After kLastModified when writing a user created folder.
const char kFolderAttributeEnd[] =;
// End of the folder.
const char kFolderEnd[] =;
// Start of the children of a folder.
const char kFolderChildren[] =;
// End of the children for a folder.
const char kFolderChildrenEnd[] =;

// Number of characters to indent by.
const size_t kIndentSize =;

// Fetches favicons for list of bookmarks and then starts Writer which outputs
// bookmarks and favicons to html file.
class BookmarkFaviconFetcher : public base::SupportsUserData::Data {};

// Class responsible for the actual writing. Takes ownership of favicons_map.
class Writer : public base::RefCountedThreadSafe<Writer> {};

}  // namespace

BookmarkFaviconFetcher::BookmarkFaviconFetcher(
    Profile* profile,
    const base::FilePath& path,
    BookmarksExportObserver* observer)
    :{}

void BookmarkFaviconFetcher::ExportBookmarks() {}

void BookmarkFaviconFetcher::ExtractUrls(const BookmarkNode* node) {}

void BookmarkFaviconFetcher::ExecuteWriter() {}

bool BookmarkFaviconFetcher::FetchNextFavicon() {}

void BookmarkFaviconFetcher::OnFaviconDataAvailable(
    const favicon_base::FaviconRawBitmapResult& bitmap_result) {}

namespace bookmark_html_writer {

void WriteBookmarks(Profile* profile,
                    const base::FilePath& path,
                    BookmarksExportObserver* observer) {}

}  // namespace bookmark_html_writer