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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 #endif | 232 #endif |
233 | 233 |
234 #if defined(USE_X11) | 234 #if defined(USE_X11) |
235 #include "chrome/browser/chrome_browser_main_extra_parts_x11.h" | 235 #include "chrome/browser/chrome_browser_main_extra_parts_x11.h" |
236 #endif | 236 #endif |
237 | 237 |
238 #if defined(ENABLE_SPELLCHECK) | 238 #if defined(ENABLE_SPELLCHECK) |
239 #include "chrome/browser/spellchecker/spellcheck_message_filter.h" | 239 #include "chrome/browser/spellchecker/spellcheck_message_filter.h" |
240 #endif | 240 #endif |
241 | 241 |
242 using WebKit::WebWindowFeatures; | 242 using blink::WebWindowFeatures; |
243 using base::FileDescriptor; | 243 using base::FileDescriptor; |
244 using content::AccessTokenStore; | 244 using content::AccessTokenStore; |
245 using content::BrowserChildProcessHostIterator; | 245 using content::BrowserChildProcessHostIterator; |
246 using content::BrowserThread; | 246 using content::BrowserThread; |
247 using content::BrowserURLHandler; | 247 using content::BrowserURLHandler; |
248 using content::ChildProcessSecurityPolicy; | 248 using content::ChildProcessSecurityPolicy; |
249 using content::FileDescriptorInfo; | 249 using content::FileDescriptorInfo; |
250 using content::QuotaPermissionContext; | 250 using content::QuotaPermissionContext; |
251 using content::RenderViewHost; | 251 using content::RenderViewHost; |
252 using content::SiteInstance; | 252 using content::SiteInstance; |
(...skipping 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1924 return; | 1924 return; |
1925 } | 1925 } |
1926 | 1926 |
1927 notification_service->RequestPermission(source_origin, render_process_id, | 1927 notification_service->RequestPermission(source_origin, render_process_id, |
1928 render_view_id, callback_context, contents); | 1928 render_view_id, callback_context, contents); |
1929 #else | 1929 #else |
1930 NOTIMPLEMENTED(); | 1930 NOTIMPLEMENTED(); |
1931 #endif | 1931 #endif |
1932 } | 1932 } |
1933 | 1933 |
1934 WebKit::WebNotificationPresenter::Permission | 1934 blink::WebNotificationPresenter::Permission |
1935 ChromeContentBrowserClient::CheckDesktopNotificationPermission( | 1935 ChromeContentBrowserClient::CheckDesktopNotificationPermission( |
1936 const GURL& source_origin, | 1936 const GURL& source_origin, |
1937 content::ResourceContext* context, | 1937 content::ResourceContext* context, |
1938 int render_process_id) { | 1938 int render_process_id) { |
1939 #if defined(ENABLE_NOTIFICATIONS) | 1939 #if defined(ENABLE_NOTIFICATIONS) |
1940 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 1940 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
1941 // Sometimes a notification may be invoked during the shutdown. | 1941 // Sometimes a notification may be invoked during the shutdown. |
1942 // See http://crbug.com/256638 | 1942 // See http://crbug.com/256638 |
1943 if (browser_shutdown::IsTryingToQuit()) | 1943 if (browser_shutdown::IsTryingToQuit()) |
1944 return WebKit::WebNotificationPresenter::PermissionNotAllowed; | 1944 return blink::WebNotificationPresenter::PermissionNotAllowed; |
1945 | 1945 |
1946 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); | 1946 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); |
1947 | 1947 |
1948 DesktopNotificationService* notification_service = | 1948 DesktopNotificationService* notification_service = |
1949 io_data->GetNotificationService(); | 1949 io_data->GetNotificationService(); |
1950 if (notification_service) { | 1950 if (notification_service) { |
1951 ExtensionInfoMap* extension_info_map = io_data->GetExtensionInfoMap(); | 1951 ExtensionInfoMap* extension_info_map = io_data->GetExtensionInfoMap(); |
1952 ExtensionSet extensions; | 1952 ExtensionSet extensions; |
1953 extension_info_map->GetExtensionsWithAPIPermissionForSecurityOrigin( | 1953 extension_info_map->GetExtensionsWithAPIPermissionForSecurityOrigin( |
1954 source_origin, render_process_id, | 1954 source_origin, render_process_id, |
1955 extensions::APIPermission::kNotification, &extensions); | 1955 extensions::APIPermission::kNotification, &extensions); |
1956 for (ExtensionSet::const_iterator iter = extensions.begin(); | 1956 for (ExtensionSet::const_iterator iter = extensions.begin(); |
1957 iter != extensions.end(); ++iter) { | 1957 iter != extensions.end(); ++iter) { |
1958 NotifierId notifier_id(NotifierId::APPLICATION, (*iter)->id()); | 1958 NotifierId notifier_id(NotifierId::APPLICATION, (*iter)->id()); |
1959 if (notification_service->IsNotifierEnabled(notifier_id)) | 1959 if (notification_service->IsNotifierEnabled(notifier_id)) |
1960 return WebKit::WebNotificationPresenter::PermissionAllowed; | 1960 return blink::WebNotificationPresenter::PermissionAllowed; |
1961 } | 1961 } |
1962 | 1962 |
1963 return notification_service->HasPermission(source_origin); | 1963 return notification_service->HasPermission(source_origin); |
1964 } | 1964 } |
1965 | 1965 |
1966 return WebKit::WebNotificationPresenter::PermissionNotAllowed; | 1966 return blink::WebNotificationPresenter::PermissionNotAllowed; |
1967 #else | 1967 #else |
1968 return WebKit::WebNotificationPresenter::PermissionAllowed; | 1968 return blink::WebNotificationPresenter::PermissionAllowed; |
1969 #endif | 1969 #endif |
1970 } | 1970 } |
1971 | 1971 |
1972 void ChromeContentBrowserClient::ShowDesktopNotification( | 1972 void ChromeContentBrowserClient::ShowDesktopNotification( |
1973 const content::ShowDesktopNotificationHostMsgParams& params, | 1973 const content::ShowDesktopNotificationHostMsgParams& params, |
1974 int render_process_id, | 1974 int render_process_id, |
1975 int render_view_id, | 1975 int render_view_id, |
1976 bool worker) { | 1976 bool worker) { |
1977 #if defined(ENABLE_NOTIFICATIONS) | 1977 #if defined(ENABLE_NOTIFICATIONS) |
1978 RenderViewHost* rvh = RenderViewHost::FromID( | 1978 RenderViewHost* rvh = RenderViewHost::FromID( |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2644 return IsExtensionOrSharedModuleWhitelisted(url, extension_set, | 2644 return IsExtensionOrSharedModuleWhitelisted(url, extension_set, |
2645 allowed_file_handle_origins_) || | 2645 allowed_file_handle_origins_) || |
2646 IsHostAllowedByCommandLine(url, extension_set, | 2646 IsHostAllowedByCommandLine(url, extension_set, |
2647 switches::kAllowNaClFileHandleAPI); | 2647 switches::kAllowNaClFileHandleAPI); |
2648 #else | 2648 #else |
2649 return false; | 2649 return false; |
2650 #endif | 2650 #endif |
2651 } | 2651 } |
2652 | 2652 |
2653 } // namespace chrome | 2653 } // namespace chrome |
OLD | NEW |