Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1953)

Unified Diff: content/shell/browser/shell_content_browser_client.cc

Issue 395883002: Support layout testing Web Notifications from Document and Worker contexts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/shell/browser/shell_content_browser_client.cc
diff --git a/content/shell/browser/shell_content_browser_client.cc b/content/shell/browser/shell_content_browser_client.cc
index 560cef1dfa14251596a4f3e23c1e04bf92320947..ffb25d39b455b205c56203dc27a5d5859fbf8951 100644
--- a/content/shell/browser/shell_content_browser_client.cc
+++ b/content/shell/browser/shell_content_browser_client.cc
@@ -22,6 +22,7 @@
#include "content/shell/browser/shell_devtools_delegate.h"
#include "content/shell/browser/shell_message_filter.h"
#include "content/shell/browser/shell_net_log.h"
+#include "content/shell/browser/shell_notification_manager.h"
#include "content/shell/browser/shell_quota_permission_context.h"
#include "content/shell/browser/shell_resource_dispatcher_host_delegate.h"
#include "content/shell/browser/shell_web_contents_view_delegate_creator.h"
@@ -137,6 +138,17 @@ ShellContentBrowserClient::~ShellContentBrowserClient() {
g_browser_client = NULL;
}
+ShellNotificationManager*
+ShellContentBrowserClient::GetShellNotificationManager() {
jochen (gone - plz use gerrit) 2014/07/17 09:29:45 add a DCHECK() that we're on the IO thread?
Peter Beverloo 2014/07/17 12:22:52 Ugh, fantastic. CBC::RequestDesktopNotificationPer
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree))
+ return NULL;
+
+ if (!shell_notification_manager_)
+ shell_notification_manager_.reset(new ShellNotificationManager());
+
+ return shell_notification_manager_.get();
+}
+
BrowserMainParts* ShellContentBrowserClient::CreateBrowserMainParts(
const MainFunctionParams& parameters) {
shell_browser_main_parts_ = new ShellBrowserMainParts(parameters);
@@ -273,6 +285,27 @@ ShellContentBrowserClient::CreateQuotaPermissionContext() {
return new ShellQuotaPermissionContext();
}
+void ShellContentBrowserClient::RequestDesktopNotificationPermission(
+ const GURL& source_origin,
+ RenderFrameHost* render_frame_host,
+ const base::Closure& callback) {
+ ShellNotificationManager* manager = GetShellNotificationManager();
+ if (manager)
+ manager->RequestPermission(source_origin, callback);
jochen (gone - plz use gerrit) 2014/07/17 09:29:45 invoke the callback with some default if no manage
Peter Beverloo 2014/07/17 12:22:52 Done.
+}
+
+blink::WebNotificationPresenter::Permission
+ShellContentBrowserClient::CheckDesktopNotificationPermission(
+ const GURL& source_url,
+ ResourceContext* context,
+ int render_process_id) {
+ ShellNotificationManager* manager = GetShellNotificationManager();
+ if (manager)
+ return manager->CheckPermission(source_url);
+
+ return blink::WebNotificationPresenter::PermissionAllowed;
+}
+
SpeechRecognitionManagerDelegate*
ShellContentBrowserClient::GetSpeechRecognitionManagerDelegate() {
return new ShellSpeechRecognitionManagerDelegate();

Powered by Google App Engine
This is Rietveld 408576698