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

Side by Side Diff: components/test_runner/app_banner_client.cc

Issue 1483903002: [App Banner] Use appropriate type parameters for WebCallbacks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/test_runner/app_banner_client.h" 5 #include "components/test_runner/app_banner_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/modules/app_banner/WebAppBannerProm ptResult.h" 9 #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerProm ptResult.h"
10 10
(...skipping 10 matching lines...) Expand all
21 blink::WebAppBannerCallbacks* callbacks) { 21 blink::WebAppBannerCallbacks* callbacks) {
22 callbacks_map_.AddWithID(callbacks, requestId); 22 callbacks_map_.AddWithID(callbacks, requestId);
23 } 23 }
24 24
25 void AppBannerClient::ResolvePromise(int request_id, 25 void AppBannerClient::ResolvePromise(int request_id,
26 const std::string& resolve_platform) { 26 const std::string& resolve_platform) {
27 blink::WebAppBannerCallbacks* callbacks = callbacks_map_.Lookup(request_id); 27 blink::WebAppBannerCallbacks* callbacks = callbacks_map_.Lookup(request_id);
28 if (!callbacks) 28 if (!callbacks)
29 return; 29 return;
30 30
31 scoped_ptr<blink::WebAppBannerPromptResult> result(
32 new blink::WebAppBannerPromptResult(
33 blink::WebString::fromUTF8(resolve_platform),
34 blink::WebAppBannerPromptResult::Outcome::Accepted));
35
36 // If no platform has been set, treat it as dismissal. 31 // If no platform has been set, treat it as dismissal.
37 if (resolve_platform.empty()) 32 callbacks->onSuccess(blink::WebAppBannerPromptResult(
38 result->outcome = blink::WebAppBannerPromptResult::Outcome::Dismissed; 33 blink::WebString::fromUTF8(resolve_platform),
39 34 resolve_platform.empty()
40 callbacks->onSuccess(result.release()); 35 ? blink::WebAppBannerPromptResult::Outcome::Dismissed
36 : blink::WebAppBannerPromptResult::Outcome::Accepted));
41 callbacks_map_.Remove(request_id); 37 callbacks_map_.Remove(request_id);
42 } 38 }
43 39
44 } // namespace test_runner 40 } // namespace test_runner
OLDNEW
« no previous file with comments | « chrome/renderer/banners/app_banner_client.cc ('k') | third_party/WebKit/Source/modules/app_banner/AppBannerCallbacks.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698