| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/shell/browser/layout_test/layout_test_content_browser_client.h
" | 5 #include "content/shell/browser/layout_test/layout_test_content_browser_client.h
" |
| 6 | 6 |
| 7 #include "content/public/browser/browser_context.h" | 7 #include "content/public/browser/browser_context.h" |
| 8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
| 9 #include "content/public/browser/render_process_host.h" | 9 #include "content/public/browser/render_process_host.h" |
| 10 #include "content/public/browser/storage_partition.h" | 10 #include "content/public/browser/storage_partition.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 BrowserThread::UI, | 33 BrowserThread::UI, |
| 34 FROM_HERE, | 34 FROM_HERE, |
| 35 base::Bind(callback, allowed)); | 35 base::Bind(callback, allowed)); |
| 36 } | 36 } |
| 37 | 37 |
| 38 } // namespace | 38 } // namespace |
| 39 | 39 |
| 40 LayoutTestContentBrowserClient::LayoutTestContentBrowserClient() { | 40 LayoutTestContentBrowserClient::LayoutTestContentBrowserClient() { |
| 41 DCHECK(!g_layout_test_browser_client); | 41 DCHECK(!g_layout_test_browser_client); |
| 42 | 42 |
| 43 layout_test_notification_manager_.reset( | 43 layout_test_notification_manager_.reset(new LayoutTestNotificationManager()); |
| 44 new LayoutTestNotificationManager()); | |
| 45 | 44 |
| 46 g_layout_test_browser_client = this; | 45 g_layout_test_browser_client = this; |
| 47 } | 46 } |
| 48 | 47 |
| 49 LayoutTestContentBrowserClient::~LayoutTestContentBrowserClient() { | 48 LayoutTestContentBrowserClient::~LayoutTestContentBrowserClient() { |
| 50 g_layout_test_browser_client = nullptr; | 49 g_layout_test_browser_client = nullptr; |
| 51 } | 50 } |
| 52 | 51 |
| 53 LayoutTestContentBrowserClient* LayoutTestContentBrowserClient::Get() { | 52 LayoutTestContentBrowserClient* LayoutTestContentBrowserClient::Get() { |
| 54 return g_layout_test_browser_client; | 53 return g_layout_test_browser_client; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 return; | 96 return; |
| 98 } | 97 } |
| 99 ShellContentBrowserClient::RequestPermission(permission, | 98 ShellContentBrowserClient::RequestPermission(permission, |
| 100 web_contents, | 99 web_contents, |
| 101 bridge_id, | 100 bridge_id, |
| 102 requesting_frame, | 101 requesting_frame, |
| 103 user_gesture, | 102 user_gesture, |
| 104 result_callback); | 103 result_callback); |
| 105 } | 104 } |
| 106 | 105 |
| 107 blink::WebNotificationPermission | 106 PlatformNotificationService* |
| 108 LayoutTestContentBrowserClient::CheckDesktopNotificationPermission( | 107 LayoutTestContentBrowserClient::GetPlatformNotificationService() { |
| 109 const GURL& source_url, | 108 return layout_test_notification_manager_.get(); |
| 110 ResourceContext* context, | |
| 111 int render_process_id) { | |
| 112 LayoutTestNotificationManager* manager = GetLayoutTestNotificationManager(); | |
| 113 if (manager) | |
| 114 return manager->CheckPermission(source_url); | |
| 115 | |
| 116 return blink::WebNotificationPermissionAllowed; | |
| 117 } | |
| 118 | |
| 119 void LayoutTestContentBrowserClient::ShowDesktopNotification( | |
| 120 const ShowDesktopNotificationHostMsgParams& params, | |
| 121 BrowserContext* browser_context, | |
| 122 int render_process_id, | |
| 123 scoped_ptr<DesktopNotificationDelegate> delegate, | |
| 124 base::Closure* cancel_callback) { | |
| 125 if (auto* manager = GetLayoutTestNotificationManager()) | |
| 126 manager->Show(params, delegate.Pass(), cancel_callback); | |
| 127 } | 109 } |
| 128 | 110 |
| 129 } // namespace content | 111 } // namespace content |
| OLD | NEW |