mirror of
				https://bitbucket.org/chromiumembedded/cef
				synced 2025-06-05 21:39:12 +02:00 
			
		
		
		
	
		
			
				
	
	
		
			52 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
| diff --git chrome/browser/ui/permission_bubble/permission_prompt.h chrome/browser/ui/permission_bubble/permission_prompt.h
 | |
| index fbce13c16ad10..0512b2f09937e 100644
 | |
| --- chrome/browser/ui/permission_bubble/permission_prompt.h
 | |
| +++ chrome/browser/ui/permission_bubble/permission_prompt.h
 | |
| @@ -11,6 +11,13 @@ namespace content {
 | |
|  class WebContents;
 | |
|  }
 | |
|  
 | |
| +using CreatePermissionPromptFunctionPtr =
 | |
| +    std::unique_ptr<permissions::PermissionPrompt> (*)(
 | |
| +        content::WebContents* web_contents,
 | |
| +        permissions::PermissionPrompt::Delegate* delegate,
 | |
| +        bool* default_handling);
 | |
| +void SetCreatePermissionPromptFunction(CreatePermissionPromptFunctionPtr);
 | |
| +
 | |
|  // Factory function to create permission prompts for chrome.
 | |
|  std::unique_ptr<permissions::PermissionPrompt> CreatePermissionPrompt(
 | |
|      content::WebContents* web_contents,
 | |
| diff --git chrome/browser/ui/views/permissions/permission_prompt_factory.cc chrome/browser/ui/views/permissions/permission_prompt_factory.cc
 | |
| index 0f19f3eeeea54..20a942f2e4007 100644
 | |
| --- chrome/browser/ui/views/permissions/permission_prompt_factory.cc
 | |
| +++ chrome/browser/ui/views/permissions/permission_prompt_factory.cc
 | |
| @@ -209,11 +209,28 @@ std::unique_ptr<permissions::PermissionPrompt> CreateQuietPrompt(
 | |
|    }
 | |
|  }
 | |
|  
 | |
| +CreatePermissionPromptFunctionPtr g_create_permission_prompt_ptr = nullptr;
 | |
| +
 | |
|  }  // namespace
 | |
|  
 | |
| +void SetCreatePermissionPromptFunction(
 | |
| +    CreatePermissionPromptFunctionPtr ptr) {
 | |
| +  g_create_permission_prompt_ptr = ptr;
 | |
| +}
 | |
| +
 | |
|  std::unique_ptr<permissions::PermissionPrompt> CreatePermissionPrompt(
 | |
|      content::WebContents* web_contents,
 | |
|      permissions::PermissionPrompt::Delegate* delegate) {
 | |
| +  if (g_create_permission_prompt_ptr) {
 | |
| +    bool default_handling = true;
 | |
| +    auto prompt = g_create_permission_prompt_ptr(web_contents, delegate,
 | |
| +                                                 &default_handling);
 | |
| +    if (prompt)
 | |
| +      return prompt;
 | |
| +    if (!default_handling)
 | |
| +      return nullptr;
 | |
| +  }
 | |
| +
 | |
|    Browser* browser = chrome::FindBrowserWithTab(web_contents);
 | |
|    if (!browser) {
 | |
|      DLOG(WARNING) << "Permission prompt suppressed because the WebContents is "
 |