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 2115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2126 } | 2126 } |
2127 } | 2127 } |
2128 } | 2128 } |
2129 if (IsExtensionWithPermissionOrSuggestInConsole( | 2129 if (IsExtensionWithPermissionOrSuggestInConsole( |
2130 APIPermission::kNotification, extension, | 2130 APIPermission::kNotification, extension, |
2131 render_frame_host->GetRenderViewHost())) { | 2131 render_frame_host->GetRenderViewHost())) { |
2132 callback.Run(); | 2132 callback.Run(); |
2133 return; | 2133 return; |
2134 } | 2134 } |
2135 | 2135 |
| 2136 WebContents* web_contents = WebContents::FromRenderFrameHost( |
| 2137 render_frame_host); |
| 2138 int render_process_id = render_frame_host->GetProcess()->GetID(); |
| 2139 const PermissionRequestID request_id(render_process_id, |
| 2140 web_contents->GetRoutingID(), |
| 2141 -1 /* bridge id */, |
| 2142 GURL()); |
| 2143 |
2136 notification_service->RequestPermission( | 2144 notification_service->RequestPermission( |
2137 source_origin, render_frame_host, callback); | 2145 web_contents, |
| 2146 request_id, |
| 2147 source_origin, |
| 2148 // TODO(peter): plumb user_gesture over IPC |
| 2149 true, |
| 2150 base::Bind(&ChromeContentBrowserClient::NotificationPermissionRequested, |
| 2151 weak_factory_.GetWeakPtr(), |
| 2152 callback)); |
| 2153 |
2138 #else | 2154 #else |
2139 NOTIMPLEMENTED(); | 2155 NOTIMPLEMENTED(); |
2140 #endif | 2156 #endif |
2141 } | 2157 } |
2142 | 2158 |
2143 blink::WebNotificationPresenter::Permission | 2159 blink::WebNotificationPresenter::Permission |
2144 ChromeContentBrowserClient::CheckDesktopNotificationPermission( | 2160 ChromeContentBrowserClient::CheckDesktopNotificationPermission( |
2145 const GURL& source_origin, | 2161 const GURL& source_origin, |
2146 content::ResourceContext* context, | 2162 content::ResourceContext* context, |
2147 int render_process_id) { | 2163 int render_process_id) { |
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2932 static const char* const kWebRtcDevSwitchNames[] = { | 2948 static const char* const kWebRtcDevSwitchNames[] = { |
2933 switches::kDisableWebRtcEncryption, | 2949 switches::kDisableWebRtcEncryption, |
2934 }; | 2950 }; |
2935 to_command_line->CopySwitchesFrom(from_command_line, | 2951 to_command_line->CopySwitchesFrom(from_command_line, |
2936 kWebRtcDevSwitchNames, | 2952 kWebRtcDevSwitchNames, |
2937 arraysize(kWebRtcDevSwitchNames)); | 2953 arraysize(kWebRtcDevSwitchNames)); |
2938 } | 2954 } |
2939 } | 2955 } |
2940 #endif // defined(ENABLE_WEBRTC) | 2956 #endif // defined(ENABLE_WEBRTC) |
2941 | 2957 |
| 2958 |
| 2959 void ChromeContentBrowserClient::NotificationPermissionRequested( |
| 2960 const base::Closure& callback, bool result) { |
| 2961 callback.Run(); |
| 2962 } |
| 2963 |
2942 } // namespace chrome | 2964 } // namespace chrome |
OLD | NEW |