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

Side by Side Diff: webkit/tools/test_shell/notification_presenter.cc

Issue 2095010: Revert r46500 in an attempt to verify a perf regression on the Mac bots. (Closed)
Patch Set: Created 10 years, 7 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 unified diff | Download patch
« no previous file with comments | « webkit/tools/test_shell/notification_presenter.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "webkit/tools/test_shell/notification_presenter.h" 5 #include "webkit/tools/test_shell/notification_presenter.h"
6 6
7 #include "googleurl/src/gurl.h" 7 #include "googleurl/src/gurl.h"
8 #include "third_party/WebKit/WebKit/chromium/public/WebNotification.h" 8 #include "third_party/WebKit/WebKit/chromium/public/WebNotification.h"
9 #include "third_party/WebKit/WebKit/chromium/public/WebNotificationPermissionCal lback.h" 9 #include "third_party/WebKit/WebKit/chromium/public/WebNotificationPermissionCal lback.h"
10 #include "third_party/WebKit/WebKit/chromium/public/WebSecurityOrigin.h" 10 #include "third_party/WebKit/WebKit/chromium/public/WebSecurityOrigin.h"
11 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" 11 #include "third_party/WebKit/WebKit/chromium/public/WebString.h"
12 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" 12 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h"
13 13
14 using WebKit::WebNotification; 14 using WebKit::WebNotification;
15 using WebKit::WebNotificationPresenter; 15 using WebKit::WebNotificationPresenter;
16 using WebKit::WebNotificationPermissionCallback; 16 using WebKit::WebNotificationPermissionCallback;
17 using WebKit::WebSecurityOrigin; 17 using WebKit::WebSecurityOrigin;
18 using WebKit::WebString; 18 using WebKit::WebString;
19 using WebKit::WebURL; 19 using WebKit::WebURL;
20 20
21 void TestNotificationPresenter::grantPermission(const std::string& origin) { 21 void TestNotificationPresenter::grantPermission(const std::string& origin) {
22 // Make sure it's in the form of an origin. 22 // Make sure it's in the form of an origin.
23 GURL url(origin); 23 GURL url(origin);
24 allowed_origins_.insert(url.GetOrigin().spec()); 24 allowed_origins_.insert(url.GetOrigin().spec());
25 } 25 }
26 26
27 // The output from all these methods matches what DumpRenderTree produces. 27 // The output from all these methods matches what DumpRenderTree produces.
28 bool TestNotificationPresenter::show(const WebNotification& notification) { 28 bool TestNotificationPresenter::show(const WebNotification& notification) {
29 if (!notification.replaceId().isEmpty()) {
30 std::string replace_id(notification.replaceId().utf8());
31 if (replacements_.find(replace_id) != replacements_.end())
32 printf("REPLACING NOTIFICATION %s\n",
33 replacements_.find(replace_id)->second.c_str());
34
35 WebString identifier = notification.isHTML() ?
36 notification.url().spec().utf16() : notification.title();
37 replacements_[replace_id] = identifier.utf8();
38 }
39
40 if (notification.isHTML()) { 29 if (notification.isHTML()) {
41 printf("DESKTOP NOTIFICATION: contents at %s\n", 30 printf("DESKTOP NOTIFICATION: contents at %s\n",
42 notification.url().spec().data()); 31 notification.url().spec().data());
43 } else { 32 } else {
44 printf("DESKTOP NOTIFICATION:%s icon %s, title %s, text %s\n", 33 printf("DESKTOP NOTIFICATION: icon %s, title %s, text %s\n",
45 notification.dir() == "rtl" ? "(RTL)" : "",
46 notification.iconURL().isEmpty() ? "" : 34 notification.iconURL().isEmpty() ? "" :
47 notification.iconURL().spec().data(), 35 notification.iconURL().spec().data(),
48 notification.title().isEmpty() ? "" : 36 notification.title().isEmpty() ? "" :
49 notification.title().utf8().data(), 37 notification.title().utf8().data(),
50 notification.body().isEmpty() ? "" : 38 notification.body().isEmpty() ? "" :
51 notification.body().utf8().data()); 39 notification.body().utf8().data());
52 } 40 }
53 41
54 WebNotification event_target(notification); 42 WebNotification event_target(notification);
55 event_target.dispatchDisplayEvent(); 43 event_target.dispatchDisplayEvent();
(...skipping 26 matching lines...) Expand all
82 : WebNotificationPresenter::PermissionDenied; 70 : WebNotificationPresenter::PermissionDenied;
83 } 71 }
84 72
85 void TestNotificationPresenter::requestPermission( 73 void TestNotificationPresenter::requestPermission(
86 const WebSecurityOrigin& origin, 74 const WebSecurityOrigin& origin,
87 WebNotificationPermissionCallback* callback) { 75 WebNotificationPermissionCallback* callback) {
88 printf("DESKTOP NOTIFICATION PERMISSION REQUESTED: %s\n", 76 printf("DESKTOP NOTIFICATION PERMISSION REQUESTED: %s\n",
89 origin.toString().utf8().data()); 77 origin.toString().utf8().data());
90 callback->permissionRequestComplete(); 78 callback->permissionRequestComplete();
91 } 79 }
OLDNEW
« no previous file with comments | « webkit/tools/test_shell/notification_presenter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698