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 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
640 return ratio * (kMaxFSM - kMinFSM) + kMinFSM; | 640 return ratio * (kMaxFSM - kMinFSM) + kMinFSM; |
641 } | 641 } |
642 | 642 |
643 #endif // defined(OS_ANDROID) | 643 #endif // defined(OS_ANDROID) |
644 | 644 |
645 } // namespace | 645 } // namespace |
646 | 646 |
647 namespace chrome { | 647 namespace chrome { |
648 | 648 |
649 ChromeContentBrowserClient::ChromeContentBrowserClient() | 649 ChromeContentBrowserClient::ChromeContentBrowserClient() |
650 : prerender_tracker_(NULL) { | 650 : prerender_tracker_(NULL), |
651 weak_factory_(this) { | |
651 #if defined(ENABLE_PLUGINS) | 652 #if defined(ENABLE_PLUGINS) |
652 for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i) | 653 for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i) |
653 allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]); | 654 allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]); |
654 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i) | 655 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i) |
655 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); | 656 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); |
656 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) | 657 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) |
657 allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]); | 658 allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]); |
658 #endif | 659 #endif |
659 | 660 |
660 permissions_policy_delegate_.reset( | 661 permissions_policy_delegate_.reset( |
(...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2029 } | 2030 } |
2030 } | 2031 } |
2031 } | 2032 } |
2032 if (IsExtensionWithPermissionOrSuggestInConsole( | 2033 if (IsExtensionWithPermissionOrSuggestInConsole( |
2033 APIPermission::kNotification, extension, | 2034 APIPermission::kNotification, extension, |
2034 render_frame_host->GetRenderViewHost())) { | 2035 render_frame_host->GetRenderViewHost())) { |
2035 callback.Run(); | 2036 callback.Run(); |
2036 return; | 2037 return; |
2037 } | 2038 } |
2038 | 2039 |
2040 WebContents* web_contents = WebContents::FromRenderFrameHost( | |
2041 render_frame_host); | |
2042 const PermissionRequestID id(render_frame_host->GetProcess()->GetID(), | |
Peter Beverloo
2014/07/10 11:29:38
Can we name this request_id? There's a lot of Ids
Miguel Garcia
2014/07/17 17:24:47
Done.
| |
2043 web_contents->GetRoutingID(), -1 /* bridge id */, | |
2044 GURL()); | |
2045 | |
2039 notification_service->RequestPermission( | 2046 notification_service->RequestPermission( |
2040 source_origin, render_frame_host, callback); | 2047 web_contents, |
2048 id, | |
2049 source_origin, | |
2050 true, /* user gesture always true for notifications */ | |
Peter Beverloo
2014/07/10 11:29:38
This is not true anymore, and we'll have to pass t
Miguel Garcia
2014/07/17 17:24:47
Seems out of scope for the CL though, the current
| |
2051 base::Bind(&ChromeContentBrowserClient::NotificationPermissionRequested, | |
2052 weak_factory_.GetWeakPtr(), callback)); | |
2053 | |
2041 #else | 2054 #else |
2042 NOTIMPLEMENTED(); | 2055 NOTIMPLEMENTED(); |
2043 #endif | 2056 #endif |
2044 } | 2057 } |
2045 | 2058 |
2046 blink::WebNotificationPresenter::Permission | 2059 blink::WebNotificationPresenter::Permission |
2047 ChromeContentBrowserClient::CheckDesktopNotificationPermission( | 2060 ChromeContentBrowserClient::CheckDesktopNotificationPermission( |
2048 const GURL& source_origin, | 2061 const GURL& source_origin, |
2049 content::ResourceContext* context, | 2062 content::ResourceContext* context, |
2050 int render_process_id) { | 2063 int render_process_id) { |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2804 static const char* const kWebRtcDevSwitchNames[] = { | 2817 static const char* const kWebRtcDevSwitchNames[] = { |
2805 switches::kDisableWebRtcEncryption, | 2818 switches::kDisableWebRtcEncryption, |
2806 }; | 2819 }; |
2807 to_command_line->CopySwitchesFrom(from_command_line, | 2820 to_command_line->CopySwitchesFrom(from_command_line, |
2808 kWebRtcDevSwitchNames, | 2821 kWebRtcDevSwitchNames, |
2809 arraysize(kWebRtcDevSwitchNames)); | 2822 arraysize(kWebRtcDevSwitchNames)); |
2810 } | 2823 } |
2811 } | 2824 } |
2812 #endif // defined(ENABLE_WEBRTC) | 2825 #endif // defined(ENABLE_WEBRTC) |
2813 | 2826 |
2827 | |
2828 void ChromeContentBrowserClient::NotificationPermissionRequested( | |
2829 base::Closure callback, bool result) { | |
Peter Beverloo
2014/07/10 11:29:38
Having |result| be here makes me happy :-). This a
Miguel Garcia
2014/07/17 17:24:47
Acknowledged.
| |
2830 callback.Run(); | |
2831 } | |
2832 | |
2814 } // namespace chrome | 2833 } // namespace chrome |
OLD | NEW |