diff --git a/browser/ui/brave_browser_command_controller.cc b/browser/ui/brave_browser_command_controller.cc index 6684ac369a8d..e57b26d9b0c5 100644 --- a/browser/ui/brave_browser_command_controller.cc +++ b/browser/ui/brave_browser_command_controller.cc @@ -15,6 +15,8 @@ #include "brave/browser/ai_chat/ai_chat_utils.h" #include "brave/browser/profiles/profile_util.h" #include "brave/browser/ui/brave_pages.h" +#include "brave/browser/ui/brave_screenshots_utils.h" +#include "brave/browser/ui/brave_ui_features.h" #include "brave/browser/ui/browser_commands.h" #include "brave/browser/ui/sidebar/sidebar_utils.h" #include "brave/browser/ui/tabs/features.h" @@ -322,6 +324,8 @@ void BraveBrowserCommandController::InitBraveCommandState() { browser_->is_type_normal()) { UpdateCommandForSplitView(); } + + UpdateCommandsForBraveScreenshots(); } void BraveBrowserCommandController::UpdateCommandForBraveRewards() { @@ -478,6 +482,17 @@ void BraveBrowserCommandController::UpdateCommandForSplitView() { } } +void BraveBrowserCommandController::UpdateCommandsForBraveScreenshots() { + const bool enabled = + base::FeatureList::IsEnabled(features::kBraveScreenshots); + UpdateCommandEnabled(IDC_BRAVE_UTILS_START_SCREENSHOT_SELECTION_TO_CLIPBOARD, + enabled); + UpdateCommandEnabled(IDC_BRAVE_UTILS_SCREENSHOT_VIEWPORT_TO_CLIPBOARD, + enabled); + UpdateCommandEnabled(IDC_BRAVE_UTILS_SCREENSHOT_FULLPAGE_TO_CLIPBOARD, + enabled); +} + void BraveBrowserCommandController::UpdateCommandForBraveSync() { UpdateCommandEnabled(IDC_SHOW_BRAVE_SYNC, true); } @@ -711,6 +726,17 @@ bool BraveBrowserCommandController::ExecuteBraveCommandWithDisposition( case IDC_SWAP_SPLIT_VIEW: brave::SwapTabsInTile(&*browser_); break; + case IDC_BRAVE_UTILS_START_SCREENSHOT_SELECTION_TO_CLIPBOARD: + brave_utils::ScreenshotSelectionToClipboard(browser_->AsWeakPtr()); + break; + case IDC_BRAVE_UTILS_SCREENSHOT_VIEWPORT_TO_CLIPBOARD: + brave_utils::ScreenshotViewportToClipboard( + browser_->tab_strip_model()->GetActiveWebContents()->GetWeakPtr()); + break; + case IDC_BRAVE_UTILS_SCREENSHOT_FULLPAGE_TO_CLIPBOARD: + brave_utils::ScreenshotFullPageToClipboard( + browser_->tab_strip_model()->GetActiveWebContents()->GetWeakPtr()); + break; default: LOG(WARNING) << "Received Unimplemented Command: " << id; break; diff --git a/browser/ui/brave_browser_command_controller.h b/browser/ui/brave_browser_command_controller.h index e80af24bc74c..39f1f237bef8 100644 --- a/browser/ui/brave_browser_command_controller.h +++ b/browser/ui/brave_browser_command_controller.h @@ -109,6 +109,7 @@ class BraveBrowserCommandController : public chrome::BrowserCommandController, void UpdateCommandsForSend(); void UpdateCommandsForPin(); void UpdateCommandForSplitView(); + void UpdateCommandsForBraveScreenshots(); bool ExecuteBraveCommandWithDisposition(int id, WindowOpenDisposition disposition,