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

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

Issue 640593003: Remove the sender_id from the Push API code path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: add TODOs Created 6 years, 2 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 | « 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/WebPushRegistration.h" 10 #include "third_party/WebKit/public/platform/WebPushRegistration.h"
(...skipping 18 matching lines...) Expand all
29 } 29 }
30 30
31 void MockWebPushClient::SetMockErrorValues(const std::string& message) { 31 void MockWebPushClient::SetMockErrorValues(const std::string& message) {
32 end_point_ = ""; 32 end_point_ = "";
33 registration_id_ = ""; 33 registration_id_ = "";
34 error_message_ = message; 34 error_message_ = message;
35 } 35 }
36 36
37 void MockWebPushClient::registerPushMessaging( 37 void MockWebPushClient::registerPushMessaging(
38 const WebString& sender_id, 38 const WebString& sender_id,
39 blink::WebPushRegistrationCallbacks* callbacks) {
40 registerPushMessaging(sender_id, callbacks, NULL);
41 }
42
43 void MockWebPushClient::registerPushMessaging(
44 const WebString& sender_id,
45 blink::WebPushRegistrationCallbacks* callbacks, 39 blink::WebPushRegistrationCallbacks* callbacks,
46 blink::WebServiceWorkerProvider* service_worker_provider) { 40 blink::WebServiceWorkerProvider* service_worker_provider) {
41 registerPushMessaging(callbacks, service_worker_provider);
42 }
43
44 void MockWebPushClient::registerPushMessaging(
45 blink::WebPushRegistrationCallbacks* callbacks,
46 blink::WebServiceWorkerProvider* service_worker_provider) {
47 DCHECK(callbacks); 47 DCHECK(callbacks);
48 48
49 if (!error_message_.empty()) { 49 if (!error_message_.empty()) {
50 scoped_ptr<blink::WebPushError> error( 50 scoped_ptr<blink::WebPushError> error(
51 new blink::WebPushError(blink::WebPushError::ErrorTypeAbort, 51 new blink::WebPushError(blink::WebPushError::ErrorTypeAbort,
52 WebString::fromUTF8(error_message_))); 52 WebString::fromUTF8(error_message_)));
53 callbacks->onError(error.release()); 53 callbacks->onError(error.release());
54 } else { 54 } else {
55 DCHECK(!end_point_.empty() && !registration_id_.empty()); 55 DCHECK(!end_point_.empty() && !registration_id_.empty());
56 56
57 scoped_ptr<blink::WebPushRegistration> registration( 57 scoped_ptr<blink::WebPushRegistration> registration(
58 new blink::WebPushRegistration(WebString::fromUTF8(end_point_), 58 new blink::WebPushRegistration(WebString::fromUTF8(end_point_),
59 WebString::fromUTF8(registration_id_))); 59 WebString::fromUTF8(registration_id_)));
60 callbacks->onSuccess(registration.release()); 60 callbacks->onSuccess(registration.release());
61 } 61 }
62 62
63 delete callbacks; 63 delete callbacks;
64 } 64 }
65 65
66 } // namespace content 66 } // 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