Index: webkit/tools/test_shell/notification_presenter.cc |
diff --git a/webkit/tools/test_shell/notification_presenter.cc b/webkit/tools/test_shell/notification_presenter.cc |
deleted file mode 100644 |
index c42e7d28be3ea9736965769e5ce5f9708fc56b49..0000000000000000000000000000000000000000 |
--- a/webkit/tools/test_shell/notification_presenter.cc |
+++ /dev/null |
@@ -1,111 +0,0 @@ |
-// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
-// Use of this source code is governed by a BSD-style license that can be |
-// found in the LICENSE file. |
- |
-#include "webkit/tools/test_shell/notification_presenter.h" |
- |
-#include "base/bind.h" |
-#include "base/message_loop.h" |
-#include "googleurl/src/gurl.h" |
-#include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" |
-#include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h" |
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebNotification.h" |
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebNotificationPermissionCallback.h" |
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" |
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" |
- |
-using WebKit::WebNotification; |
-using WebKit::WebNotificationPresenter; |
-using WebKit::WebNotificationPermissionCallback; |
-using WebKit::WebSecurityOrigin; |
-using WebKit::WebString; |
-using WebKit::WebTextDirectionRightToLeft; |
-using WebKit::WebURL; |
- |
-namespace { |
-void DeferredDisplayDispatch(WebNotification notification) { |
- notification.dispatchDisplayEvent(); |
-} |
-} |
- |
-TestNotificationPresenter::TestNotificationPresenter(TestShell* shell) { |
-} |
- |
-TestNotificationPresenter::~TestNotificationPresenter() {} |
- |
-void TestNotificationPresenter::Reset() { |
- allowed_origins_.clear(); |
-} |
- |
-void TestNotificationPresenter::grantPermission(const std::string& origin) { |
- allowed_origins_.insert(origin); |
-} |
- |
-// The output from all these methods matches what DumpRenderTree produces. |
-bool TestNotificationPresenter::show(const WebNotification& notification) { |
- if (!notification.replaceId().isEmpty()) { |
- std::string replace_id(notification.replaceId().utf8()); |
- if (replacements_.find(replace_id) != replacements_.end()) |
- printf("REPLACING NOTIFICATION %s\n", |
- replacements_.find(replace_id)->second.c_str()); |
- |
- WebString identifier = notification.isHTML() ? |
- notification.url().spec().utf16() : notification.title(); |
- replacements_[replace_id] = identifier.utf8(); |
- } |
- |
- if (notification.isHTML()) { |
- printf("DESKTOP NOTIFICATION: contents at %s\n", |
- notification.url().spec().data()); |
- } else { |
- printf("DESKTOP NOTIFICATION:%s icon %s, title %s, text %s\n", |
- notification.direction() == WebTextDirectionRightToLeft ? "(RTL)" : |
- "", |
- notification.iconURL().isEmpty() ? "" : |
- notification.iconURL().spec().data(), |
- notification.title().isEmpty() ? "" : |
- notification.title().utf8().data(), |
- notification.body().isEmpty() ? "" : |
- notification.body().utf8().data()); |
- } |
- |
- |
- WebNotification event_target(notification); |
- MessageLoop::current()->PostTask( |
- FROM_HERE, base::Bind(&DeferredDisplayDispatch, event_target)); |
- return true; |
-} |
- |
-void TestNotificationPresenter::cancel(const WebNotification& notification) { |
- WebString identifier; |
- if (notification.isHTML()) |
- identifier = notification.url().spec().utf16(); |
- else |
- identifier = notification.title(); |
- |
- printf("DESKTOP NOTIFICATION CLOSED: %s\n", identifier.utf8().data()); |
- WebNotification event_target(notification); |
- event_target.dispatchCloseEvent(false); |
-} |
- |
-void TestNotificationPresenter::objectDestroyed( |
- const WebKit::WebNotification& notification) { |
- // Nothing to do. Not storing the objects. |
-} |
- |
-WebNotificationPresenter::Permission TestNotificationPresenter::checkPermission( |
- const WebSecurityOrigin& origin) { |
- // Check with the layout test controller |
- bool allowed = allowed_origins_.find(origin.toString().utf8().data()) |
- != allowed_origins_.end(); |
- return allowed ? WebNotificationPresenter::PermissionAllowed |
- : WebNotificationPresenter::PermissionDenied; |
-} |
- |
-void TestNotificationPresenter::requestPermission( |
- const WebSecurityOrigin& origin, |
- WebNotificationPermissionCallback* callback) { |
- printf("DESKTOP NOTIFICATION PERMISSION REQUESTED: %s\n", |
- origin.toString().utf8().data()); |
- callback->permissionRequestComplete(); |
-} |