[AndroidWebViewShell] Replace rebaseline script with a new version using test_runner.py
[chromium-blink-merge.git] / components / test_runner / app_banner_client.cc
blobc76c2511f376c837800a39f173399b1443168ec1
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
3 // found in the LICENSE file.
5 #include "components/test_runner/app_banner_client.h"
7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerPromptResult.h"
11 namespace test_runner {
13 AppBannerClient::AppBannerClient() {
16 AppBannerClient::~AppBannerClient() {
19 void AppBannerClient::registerBannerCallbacks(
20 int requestId,
21 blink::WebAppBannerCallbacks* callbacks) {
22 callbacks_map_.AddWithID(callbacks, requestId);
25 void AppBannerClient::ResolvePromise(int request_id,
26 const std::string& resolve_platform) {
27 blink::WebAppBannerCallbacks* callbacks = callbacks_map_.Lookup(request_id);
28 DCHECK(callbacks);
30 scoped_ptr<blink::WebAppBannerPromptResult> result(
31 new blink::WebAppBannerPromptResult(
32 blink::WebString::fromUTF8(resolve_platform),
33 blink::WebAppBannerPromptResult::Outcome::Accepted));
35 // If no platform has been set, treat it as dismissal.
36 if (resolve_platform.empty())
37 result->outcome = blink::WebAppBannerPromptResult::Outcome::Dismissed;
39 callbacks->onSuccess(result.release());
40 callbacks_map_.Remove(request_id);
43 } // namespace test_runner