Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1375)

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 955383003: ContentBrowserClient::RequestPermission replies with PermissionStatus instead of bool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) 672 #if defined(OS_ANDROID) || defined(OS_CHROMEOS)
673 case content::PERMISSION_PROTECTED_MEDIA_IDENTIFIER: 673 case content::PERMISSION_PROTECTED_MEDIA_IDENTIFIER:
674 return CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER; 674 return CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER;
675 #endif 675 #endif
676 default: 676 default:
677 NOTREACHED() << "Unknown content setting for permission " << permission; 677 NOTREACHED() << "Unknown content setting for permission " << permission;
678 return CONTENT_SETTINGS_TYPE_DEFAULT; 678 return CONTENT_SETTINGS_TYPE_DEFAULT;
679 } 679 }
680 } 680 }
681 681
682 void OnRequestPermission(
683 const base::Callback<void(content::PermissionStatus)>& callback,
684 ContentSetting content_setting) {
685 callback.Run(ContentSettingToPermissionStatus(content_setting));
686 }
687
682 } // namespace 688 } // namespace
683 689
684 namespace chrome { 690 namespace chrome {
685 691
686 ChromeContentBrowserClient::ChromeContentBrowserClient() 692 ChromeContentBrowserClient::ChromeContentBrowserClient()
687 : prerender_tracker_(NULL), 693 : prerender_tracker_(NULL),
688 #if defined(OS_POSIX) && !defined(OS_MACOSX) 694 #if defined(OS_POSIX) && !defined(OS_MACOSX)
689 v8_natives_fd_(-1), 695 v8_natives_fd_(-1),
690 v8_snapshot_fd_(-1), 696 v8_snapshot_fd_(-1),
691 #endif // OS_POSIX && !OS_MACOSX 697 #endif // OS_POSIX && !OS_MACOSX
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1927 return NULL; 1933 return NULL;
1928 #endif 1934 #endif
1929 } 1935 }
1930 1936
1931 void ChromeContentBrowserClient::RequestPermission( 1937 void ChromeContentBrowserClient::RequestPermission(
1932 content::PermissionType permission, 1938 content::PermissionType permission,
1933 content::WebContents* web_contents, 1939 content::WebContents* web_contents,
1934 int bridge_id, 1940 int bridge_id,
1935 const GURL& requesting_frame, 1941 const GURL& requesting_frame,
1936 bool user_gesture, 1942 bool user_gesture,
1937 const base::Callback<void(bool)>& result_callback) { 1943 const base::Callback<void(content::PermissionStatus)>& result_callback) {
1938 int render_process_id = web_contents->GetRenderProcessHost()->GetID(); 1944 int render_process_id = web_contents->GetRenderProcessHost()->GetID();
1939 int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID(); 1945 int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID();
1940 const PermissionRequestID request_id(render_process_id, 1946 const PermissionRequestID request_id(render_process_id,
1941 render_view_id, 1947 render_view_id,
1942 bridge_id, 1948 bridge_id,
1943 requesting_frame); 1949 requesting_frame);
1944 Profile* profile = 1950 Profile* profile =
1945 Profile::FromBrowserContext(web_contents->GetBrowserContext()); 1951 Profile::FromBrowserContext(web_contents->GetBrowserContext());
1946 PermissionContextBase* context = GetPermissionContext(profile, permission); 1952 PermissionContextBase* context = GetPermissionContext(profile, permission);
1947 1953
1948 if (!context) 1954 if (!context)
1949 return; 1955 return;
1950 1956
1951 context->RequestPermission(web_contents, request_id, requesting_frame, 1957 context->RequestPermission(web_contents, request_id, requesting_frame,
1952 user_gesture, result_callback); 1958 user_gesture,
1959 base::Bind(&OnRequestPermission, result_callback));
1953 } 1960 }
1954 1961
1955 content::PermissionStatus ChromeContentBrowserClient::GetPermissionStatus( 1962 content::PermissionStatus ChromeContentBrowserClient::GetPermissionStatus(
1956 content::PermissionType permission, 1963 content::PermissionType permission,
1957 content::BrowserContext* browser_context, 1964 content::BrowserContext* browser_context,
1958 const GURL& requesting_origin, 1965 const GURL& requesting_origin,
1959 const GURL& embedding_origin) { 1966 const GURL& embedding_origin) {
1960 DCHECK(browser_context); 1967 DCHECK(browser_context);
1961 Profile* profile = Profile::FromBrowserContext(browser_context); 1968 Profile* profile = Profile::FromBrowserContext(browser_context);
1962 PermissionContextBase* context = GetPermissionContext(profile, permission); 1969 PermissionContextBase* context = GetPermissionContext(profile, permission);
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
2639 switches::kDisableWebRtcEncryption, 2646 switches::kDisableWebRtcEncryption,
2640 }; 2647 };
2641 to_command_line->CopySwitchesFrom(from_command_line, 2648 to_command_line->CopySwitchesFrom(from_command_line,
2642 kWebRtcDevSwitchNames, 2649 kWebRtcDevSwitchNames,
2643 arraysize(kWebRtcDevSwitchNames)); 2650 arraysize(kWebRtcDevSwitchNames));
2644 } 2651 }
2645 } 2652 }
2646 #endif // defined(ENABLE_WEBRTC) 2653 #endif // defined(ENABLE_WEBRTC)
2647 2654
2648 } // namespace chrome 2655 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698