| OLD | NEW |
| 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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 673 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
| 674 case content::PERMISSION_PROTECTED_MEDIA_IDENTIFIER: | 674 case content::PERMISSION_PROTECTED_MEDIA_IDENTIFIER: |
| 675 return CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER; | 675 return CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER; |
| 676 #endif | 676 #endif |
| 677 default: | 677 default: |
| 678 NOTREACHED() << "Unknown content setting for permission " << permission; | 678 NOTREACHED() << "Unknown content setting for permission " << permission; |
| 679 return CONTENT_SETTINGS_TYPE_DEFAULT; | 679 return CONTENT_SETTINGS_TYPE_DEFAULT; |
| 680 } | 680 } |
| 681 } | 681 } |
| 682 | 682 |
| 683 void OnRequestPermission( |
| 684 const base::Callback<void(content::PermissionStatus)>& callback, |
| 685 ContentSetting content_setting) { |
| 686 callback.Run(ContentSettingToPermissionStatus(content_setting)); |
| 687 } |
| 688 |
| 683 } // namespace | 689 } // namespace |
| 684 | 690 |
| 685 namespace chrome { | 691 namespace chrome { |
| 686 | 692 |
| 687 ChromeContentBrowserClient::ChromeContentBrowserClient() | 693 ChromeContentBrowserClient::ChromeContentBrowserClient() |
| 688 : prerender_tracker_(NULL), | 694 : prerender_tracker_(NULL), |
| 689 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 695 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 690 v8_natives_fd_(-1), | 696 v8_natives_fd_(-1), |
| 691 v8_snapshot_fd_(-1), | 697 v8_snapshot_fd_(-1), |
| 692 #endif // OS_POSIX && !OS_MACOSX | 698 #endif // OS_POSIX && !OS_MACOSX |
| (...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2645 switches::kDisableWebRtcEncryption, | 2652 switches::kDisableWebRtcEncryption, |
| 2646 }; | 2653 }; |
| 2647 to_command_line->CopySwitchesFrom(from_command_line, | 2654 to_command_line->CopySwitchesFrom(from_command_line, |
| 2648 kWebRtcDevSwitchNames, | 2655 kWebRtcDevSwitchNames, |
| 2649 arraysize(kWebRtcDevSwitchNames)); | 2656 arraysize(kWebRtcDevSwitchNames)); |
| 2650 } | 2657 } |
| 2651 } | 2658 } |
| 2652 #endif // defined(ENABLE_WEBRTC) | 2659 #endif // defined(ENABLE_WEBRTC) |
| 2653 | 2660 |
| 2654 } // namespace chrome | 2661 } // namespace chrome |
| OLD | NEW |