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

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

Issue 2393513004: Convert app banners to use Mojo. (Closed)
Patch Set: Add TODO Created 4 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 | « components/test_runner/app_banner_service.h ('k') | components/test_runner/test_interfaces.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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.
4
5 #include "components/test_runner/app_banner_service.h"
6
7 namespace test_runner {
8
9 AppBannerService::AppBannerService() : binding_(this) {}
10
11 AppBannerService::~AppBannerService() {}
12
13 void AppBannerService::ResolvePromise(const std::string& platform) {
14 if (!event_.is_bound())
15 return;
16
17 // Empty platform means to resolve as a dismissal.
18 if (platform.empty())
19 event_->BannerDismissed();
20 else
21 event_->BannerAccepted(platform);
22 }
23
24 void AppBannerService::SendBannerPromptRequest(
25 const std::vector<std::string>& platforms,
26 const base::Callback<void(bool)>& callback) {
27 if (!controller_.is_bound())
28 return;
29
30 controller_->BannerPromptRequest(
31 binding_.CreateInterfacePtrAndBind(), mojo::GetProxy(&event_), platforms,
32 base::Bind(&AppBannerService::OnBannerPromptReply, base::Unretained(this),
33 callback));
34 }
35
36 void AppBannerService::DisplayAppBanner() { /* do nothing */ }
37
38 void AppBannerService::OnBannerPromptReply(
39 const base::Callback<void(bool)>& callback,
40 blink::mojom::AppBannerPromptReply reply,
41 const std::string& referrer) {
42 callback.Run(reply == blink::mojom::AppBannerPromptReply::CANCEL);
43 }
44
45 } // namespace test_runner
OLDNEW
« no previous file with comments | « components/test_runner/app_banner_service.h ('k') | components/test_runner/test_interfaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698