mirror of
				https://bitbucket.org/chromiumembedded/cef
				synced 2025-06-05 21:39:12 +02:00 
			
		
		
		
	
		
			
				
	
	
		
			98 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			98 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
| diff --git chrome/browser/ui/views/frame/browser_frame_mac.h chrome/browser/ui/views/frame/browser_frame_mac.h
 | |
| index 2245c931fbe4f..761ea6b3a6afb 100644
 | |
| --- chrome/browser/ui/views/frame/browser_frame_mac.h
 | |
| +++ chrome/browser/ui/views/frame/browser_frame_mac.h
 | |
| @@ -11,6 +11,7 @@
 | |
|  #include "ui/base/mojom/window_show_state.mojom-forward.h"
 | |
|  #include "ui/views/widget/native_widget_mac.h"
 | |
|  
 | |
| +class Browser;
 | |
|  class BrowserFrame;
 | |
|  class BrowserView;
 | |
|  @class BrowserWindowTouchBarController;
 | |
| @@ -54,6 +55,21 @@ class BrowserFrameMac : public views::NativeWidgetMac,
 | |
|    bool ShouldUseInitialVisibleOnAllWorkspaces() const override;
 | |
|    void AnnounceTextInInProcessWindow(const std::u16string& text) override;
 | |
|  
 | |
| +  static void ValidateUserInterfaceItem(
 | |
| +      Browser* browser,
 | |
| +      int32_t command,
 | |
| +      remote_cocoa::mojom::ValidateUserInterfaceItemResult* result);
 | |
| +  static bool WillExecuteCommand(
 | |
| +      Browser* browser,
 | |
| +      int32_t command,
 | |
| +      WindowOpenDisposition window_open_disposition,
 | |
| +      bool is_before_first_responder);
 | |
| +  static bool ExecuteCommand(
 | |
| +      Browser* browser,
 | |
| +      int32_t command,
 | |
| +      WindowOpenDisposition window_open_disposition,
 | |
| +      bool is_before_first_responder);
 | |
| +
 | |
|   protected:
 | |
|    ~BrowserFrameMac() override;
 | |
|  
 | |
| diff --git chrome/browser/ui/views/frame/browser_frame_mac.mm chrome/browser/ui/views/frame/browser_frame_mac.mm
 | |
| index 29ba0f48f559a..07887ae9ec11c 100644
 | |
| --- chrome/browser/ui/views/frame/browser_frame_mac.mm
 | |
| +++ chrome/browser/ui/views/frame/browser_frame_mac.mm
 | |
| @@ -185,7 +185,14 @@ void BrowserFrameMac::OnWindowFullscreenTransitionComplete() {
 | |
|  void BrowserFrameMac::ValidateUserInterfaceItem(
 | |
|      int32_t tag,
 | |
|      remote_cocoa::mojom::ValidateUserInterfaceItemResult* result) {
 | |
| -  Browser* browser = browser_view_->browser();
 | |
| +  return ValidateUserInterfaceItem(browser_view_->browser(), tag, result);
 | |
| +}
 | |
| +
 | |
| +// static
 | |
| +void BrowserFrameMac::ValidateUserInterfaceItem(
 | |
| +    Browser* browser,
 | |
| +    int32_t tag,
 | |
| +    remote_cocoa::mojom::ValidateUserInterfaceItemResult* result) {
 | |
|    if (!chrome::SupportsCommand(browser, tag)) {
 | |
|      result->enable = false;
 | |
|      return;
 | |
| @@ -308,8 +315,16 @@ bool BrowserFrameMac::WillExecuteCommand(
 | |
|      int32_t command,
 | |
|      WindowOpenDisposition window_open_disposition,
 | |
|      bool is_before_first_responder) {
 | |
| -  Browser* browser = browser_view_->browser();
 | |
| +  return WillExecuteCommand(browser_view_->browser(), command,
 | |
| +                            window_open_disposition, is_before_first_responder);
 | |
| +}
 | |
|  
 | |
| +// static
 | |
| +bool BrowserFrameMac::WillExecuteCommand(
 | |
| +    Browser* browser,
 | |
| +    int32_t command,
 | |
| +    WindowOpenDisposition window_open_disposition,
 | |
| +    bool is_before_first_responder) {
 | |
|    if (is_before_first_responder) {
 | |
|      // The specification for this private extensions API is incredibly vague.
 | |
|      // For now, we avoid triggering chrome commands prior to giving the
 | |
| @@ -341,13 +356,21 @@ bool BrowserFrameMac::ExecuteCommand(
 | |
|      int32_t command,
 | |
|      WindowOpenDisposition window_open_disposition,
 | |
|      bool is_before_first_responder) {
 | |
| -  if (!WillExecuteCommand(command, window_open_disposition,
 | |
| +  return ExecuteCommand(browser_view_->browser(), command,
 | |
| +                        window_open_disposition, is_before_first_responder);
 | |
| +}
 | |
| + 
 | |
| +// static
 | |
| +bool BrowserFrameMac::ExecuteCommand(
 | |
| +    Browser* browser,
 | |
| +    int32_t command,
 | |
| +    WindowOpenDisposition window_open_disposition,
 | |
| +    bool is_before_first_responder) {
 | |
| +  if (!WillExecuteCommand(browser, command, window_open_disposition,
 | |
|                            is_before_first_responder)) {
 | |
|      return false;
 | |
|    }
 | |
|  
 | |
| -  Browser* browser = browser_view_->browser();
 | |
| -
 | |
|    chrome::ExecuteCommandWithDisposition(browser, command,
 | |
|                                          window_open_disposition);
 | |
|    return true;
 |