#include "chrome/browser/ui/views/bookmarks/bookmark_editor_view.h"
#include <set>
#include <string>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/logging.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/bookmarks/bookmark_expanded_state_tracker_factory.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/bookmarks/bookmark_utils.h"
#include "chrome/browser/ui/bookmarks/bookmark_utils_desktop.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/locale_settings.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/bookmarks/browser/bookmark_node.h"
#include "components/bookmarks/browser/bookmark_utils.h"
#include "components/bookmarks/common/bookmark_metrics.h"
#include "components/constrained_window/constrained_window_views.h"
#include "components/history/core/browser/history_service.h"
#include "components/strings/grit/components_strings.h"
#include "components/url_formatter/url_fixer.h"
#include "components/user_prefs/user_prefs.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/mojom/dialog_button.mojom.h"
#include "ui/base/mojom/ui_base_types.mojom-shared.h"
#include "ui/events/event.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/background.h"
#include "ui/views/controls/button/md_text_button.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/menu/menu_runner.h"
#include "ui/views/controls/scroll_view.h"
#include "ui/views/controls/textfield/textfield.h"
#include "ui/views/controls/tree/tree_view.h"
#include "ui/views/focus/focus_manager.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/table_layout.h"
#include "ui/views/widget/widget.h"
#include "url/gurl.h"
#if !BUILDFLAG(IS_MAC)
#include "ui/aura/window.h"
#endif
BookmarkModel;
BookmarkNode;
BookmarkEditorView::BookmarkEditorView(
Profile* profile,
const BookmarkNode* parent,
const EditDetails& details,
BookmarkEditor::Configuration configuration,
BookmarkEditor::OnSaveCallback on_save_callback)
: … { … }
BookmarkEditorView::~BookmarkEditorView() { … }
bool BookmarkEditorView::IsDialogButtonEnabled(
ui::mojom::DialogButton button) const { … }
gfx::Size BookmarkEditorView::CalculatePreferredSize(
const views::SizeBounds& available_size) const { … }
void BookmarkEditorView::OnTreeViewSelectionChanged(
views::TreeView* tree_view) { … }
bool BookmarkEditorView::CanEdit(views::TreeView* tree_view,
ui::TreeModelNode* node) { … }
void BookmarkEditorView::ContentsChanged(views::Textfield* sender,
const std::u16string& new_contents) { … }
bool BookmarkEditorView::HandleKeyEvent(views::Textfield* sender,
const ui::KeyEvent& key_event) { … }
bool BookmarkEditorView::IsCommandIdChecked(int command_id) const { … }
bool BookmarkEditorView::IsCommandIdEnabled(int command_id) const { … }
bool BookmarkEditorView::GetAcceleratorForCommandId(
int command_id,
ui::Accelerator* accelerator) const { … }
void BookmarkEditorView::ExecuteCommand(int command_id, int event_flags) { … }
void BookmarkEditorView::Show(gfx::NativeWindow parent) { … }
void BookmarkEditorView::ShowContextMenuForViewImpl(
views::View* source,
const gfx::Point& point,
ui::MenuSourceType source_type) { … }
void BookmarkEditorView::BookmarkNodeMoved(const BookmarkNode* old_parent,
size_t old_index,
const BookmarkNode* new_parent,
size_t new_index) { … }
void BookmarkEditorView::BookmarkNodeAdded(const BookmarkNode* parent,
size_t index,
bool added_by_user) { … }
void BookmarkEditorView::BookmarkNodeRemoved(const BookmarkNode* parent,
size_t index,
const BookmarkNode* node,
const std::set<GURL>& removed_urls,
const base::Location& location) { … }
void BookmarkEditorView::BookmarkAllUserNodesRemoved(
const std::set<GURL>& removed_urls,
const base::Location& location) { … }
void BookmarkEditorView::BookmarkNodeChildrenReordered(
const BookmarkNode* node) { … }
void BookmarkEditorView::Init() { … }
void BookmarkEditorView::Reset() { … }
GURL BookmarkEditorView::GetInputURL() const { … }
void BookmarkEditorView::UserInputChanged() { … }
void BookmarkEditorView::NewFolderButtonPressed() { … }
void BookmarkEditorView::NewFolder(EditorNode* parent) { … }
BookmarkEditorView::EditorNode* BookmarkEditorView::AddNewFolder(
EditorNode* parent) { … }
void BookmarkEditorView::ExpandAndSelect() { … }
std::unique_ptr<BookmarkEditorView::EditorNode>
BookmarkEditorView::CreateRootNode() { … }
void BookmarkEditorView::CreateNodes(const BookmarkNode* bb_node,
BookmarkEditorView::EditorNode* b_node) { … }
BookmarkEditorView::EditorNode* BookmarkEditorView::FindNodeWithID(
BookmarkEditorView::EditorNode* node,
int64_t id) { … }
void BookmarkEditorView::ApplyEdits(EditorNode* parent) { … }
void BookmarkEditorView::ApplyNameChangesAndCreateNewFolders(
const BookmarkNode* bb_node,
BookmarkEditorView::EditorNode* b_node,
BookmarkEditorView::EditorNode* parent_b_node,
const BookmarkNode** parent_bb_node) { … }
void BookmarkEditorView::UpdateExpandedNodes(
EditorNode* editor_node,
BookmarkExpandedStateTracker::Nodes* expanded_nodes) { … }
ui::SimpleMenuModel* BookmarkEditorView::GetMenuModel() { … }
void BookmarkEditorView::ExecuteCommandDelete(
base::OnceCallback<bool(const bookmarks::BookmarkNode* node)>
non_empty_folder_confirmation_cb) { … }
void BookmarkEditorView::EditorTreeModel::SetTitle(
ui::TreeModelNode* node,
const std::u16string& title) { … }
BEGIN_METADATA(…)