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

Side by Side Diff: content/shell/renderer/test_runner/mock_web_push_client.cc

Issue 700993002: Revert of Implement getPermissionStatus in MockWebPushClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@push_has_permission
Patch Set: Created 6 years, 1 month 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 | « content/shell/renderer/test_runner/mock_web_push_client.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 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/renderer/test_runner/mock_web_push_client.h" 5 #include "content/shell/renderer/test_runner/mock_web_push_client.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "third_party/WebKit/public/platform/WebPushError.h" 9 #include "third_party/WebKit/public/platform/WebPushError.h"
10 #include "third_party/WebKit/public/platform/WebPushPermissionStatus.h"
11 #include "third_party/WebKit/public/platform/WebPushRegistration.h" 10 #include "third_party/WebKit/public/platform/WebPushRegistration.h"
12 #include "third_party/WebKit/public/platform/WebString.h" 11 #include "third_party/WebKit/public/platform/WebString.h"
13 12
14 using blink::WebString; 13 using blink::WebString;
15 14
16 namespace content { 15 namespace content {
17 16
18 MockWebPushClient::MockWebPushClient() 17 MockWebPushClient::MockWebPushClient()
19 : error_message_( 18 : error_message_(
20 "Registration failed (default mock client error message)") { 19 "Registration failed (default mock client error message)") {
(...skipping 29 matching lines...) Expand all
50 49
51 scoped_ptr<blink::WebPushRegistration> registration( 50 scoped_ptr<blink::WebPushRegistration> registration(
52 new blink::WebPushRegistration(WebString::fromUTF8(end_point_), 51 new blink::WebPushRegistration(WebString::fromUTF8(end_point_),
53 WebString::fromUTF8(registration_id_))); 52 WebString::fromUTF8(registration_id_)));
54 callbacks->onSuccess(registration.release()); 53 callbacks->onSuccess(registration.release());
55 } 54 }
56 55
57 delete callbacks; 56 delete callbacks;
58 } 57 }
59 58
60 void MockWebPushClient::getPermissionStatus(
61 blink::WebPushPermissionCallback* callback,
62 blink::WebServiceWorkerProvider* provider) {
63 blink::WebPushPermissionStatus status;
64 if (error_message_.empty())
65 status = blink::WebPushPermissionStatusGranted;
66 else if (error_message_.compare("deny_permission") == 0)
67 status = blink::WebPushPermissionStatusDenied;
68 else
69 status = blink::WebPushPermissionStatusDefault;
70
71 callback->onSuccess(&status);
72 delete callback;
73 }
74
75
76 } // namespace content 59 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/mock_web_push_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698