#include "chrome/browser/ui/webui/side_panel/bookmarks/bookmarks_page_handler.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/user_metrics.h"
#include "base/metrics/user_metrics_action.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/commerce/shopping_service_factory.h"
#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/bookmarks/bookmark_context_menu_controller.h"
#include "chrome/browser/ui/bookmarks/bookmark_editor.h"
#include "chrome/browser/ui/bookmarks/bookmark_stats.h"
#include "chrome/browser/ui/bookmarks/bookmark_utils_desktop.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/webui/bookmarks/bookmark_prefs.h"
#include "chrome/browser/ui/webui/commerce/shopping_list_context_menu_controller.h"
#include "chrome/browser/ui/webui/side_panel/bookmarks/bookmarks_side_panel_ui.h"
#include "chrome/browser/ui/webui/side_panel/reading_list/reading_list_ui.h"
#include "chrome/grit/generated_resources.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/bookmarks/browser/bookmark_node.h"
#include "components/bookmarks/browser/bookmark_utils.h"
#include "components/prefs/pref_service.h"
#include "components/profile_metrics/browser_profile_type.h"
#include "components/strings/grit/components_strings.h"
#include "mojo/public/cpp/bindings/message.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/models/simple_menu_model.h"
#include "ui/base/mojom/window_open_disposition.mojom.h"
#include "ui/base/window_open_disposition.h"
#include "ui/base/window_open_disposition_utils.h"
namespace {
class BookmarkContextMenu : public ui::SimpleMenuModel,
public ui::SimpleMenuModel::Delegate,
public BookmarkContextMenuControllerDelegate { … };
std::unique_ptr<BookmarkContextMenu> ContextMenuFromNodes(
const std::vector<int64_t> node_ids,
base::WeakPtr<TopChromeWebUIController::Embedder> embedder,
side_panel::mojom::ActionSource source,
commerce::ShoppingListContextMenuController* shopping_list_controller) { … }
}
BookmarksPageHandler::BookmarksPageHandler(
mojo::PendingReceiver<side_panel::mojom::BookmarksPageHandler> receiver,
BookmarksSidePanelUI* bookmarks_ui)
: … { … }
BookmarksPageHandler::BookmarksPageHandler(
mojo::PendingReceiver<side_panel::mojom::BookmarksPageHandler> receiver,
ReadingListUI* reading_list_ui)
: … { … }
BookmarksPageHandler::~BookmarksPageHandler() = default;
void BookmarksPageHandler::BookmarkCurrentTabInFolder(int64_t folder_id) { … }
void BookmarksPageHandler::ExecuteOpenInNewTabCommand(
const std::vector<int64_t>& node_ids,
side_panel::mojom::ActionSource source) { … }
void BookmarksPageHandler::ExecuteOpenInNewWindowCommand(
const std::vector<int64_t>& node_ids,
side_panel::mojom::ActionSource source) { … }
void BookmarksPageHandler::ExecuteOpenInIncognitoWindowCommand(
const std::vector<int64_t>& node_ids,
side_panel::mojom::ActionSource source) { … }
void BookmarksPageHandler::ExecuteOpenInNewTabGroupCommand(
const std::vector<int64_t>& node_ids,
side_panel::mojom::ActionSource source) { … }
void BookmarksPageHandler::ExecuteAddToBookmarksBarCommand(
const int64_t node_id,
side_panel::mojom::ActionSource source) { … }
void BookmarksPageHandler::ExecuteRemoveFromBookmarksBarCommand(
int64_t node_id,
side_panel::mojom::ActionSource source) { … }
void BookmarksPageHandler::ExecuteDeleteCommand(
const std::vector<int64_t>& node_ids,
side_panel::mojom::ActionSource source) { … }
void BookmarksPageHandler::ExecuteContextMenuCommand(
const std::vector<int64_t>& node_ids,
side_panel::mojom::ActionSource source,
int command_id) { … }
void BookmarksPageHandler::OpenBookmark(
int64_t node_id,
int32_t parent_folder_depth,
ui::mojom::ClickModifiersPtr click_modifiers,
side_panel::mojom::ActionSource source) { … }
void BookmarksPageHandler::SetSortOrder(
side_panel::mojom::SortOrder sort_order) { … }
void BookmarksPageHandler::SetViewType(side_panel::mojom::ViewType view_type) { … }
void BookmarksPageHandler::ShowContextMenu(
const std::string& id_string,
const gfx::Point& point,
side_panel::mojom::ActionSource source) { … }
void BookmarksPageHandler::ShowUI() { … }