| OLD | NEW |
| 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 "chrome/renderer/banners/app_banner_client.h" | 5 #include "chrome/renderer/banners/app_banner_client.h" |
| 6 | 6 |
| 7 #include "chrome/common/render_messages.h" | 7 #include "chrome/common/render_messages.h" |
| 8 #include "ipc/ipc_message.h" | 8 #include "ipc/ipc_message.h" |
| 9 #include "third_party/WebKit/public/platform/WebString.h" | 9 #include "third_party/WebKit/public/platform/WebString.h" |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 void AppBannerClient::ResolveEvent( | 47 void AppBannerClient::ResolveEvent( |
| 48 int request_id, | 48 int request_id, |
| 49 const std::string& platform, | 49 const std::string& platform, |
| 50 const blink::WebAppBannerPromptResult::Outcome& outcome) { | 50 const blink::WebAppBannerPromptResult::Outcome& outcome) { |
| 51 blink::WebAppBannerCallbacks* callbacks = | 51 blink::WebAppBannerCallbacks* callbacks = |
| 52 banner_callbacks_.Lookup(request_id); | 52 banner_callbacks_.Lookup(request_id); |
| 53 if (!callbacks) | 53 if (!callbacks) |
| 54 return; | 54 return; |
| 55 | 55 |
| 56 scoped_ptr<blink::WebAppBannerPromptResult> result( | 56 callbacks->onSuccess(blink::WebAppBannerPromptResult( |
| 57 new blink::WebAppBannerPromptResult( | 57 blink::WebString::fromUTF8(platform), outcome)); |
| 58 blink::WebString::fromUTF8(platform), | |
| 59 outcome)); | |
| 60 callbacks->onSuccess(result.release()); | |
| 61 banner_callbacks_.Remove(request_id); | 58 banner_callbacks_.Remove(request_id); |
| 62 } | 59 } |
| 63 | 60 |
| 64 void AppBannerClient::OnBannerAccepted(int request_id, | 61 void AppBannerClient::OnBannerAccepted(int request_id, |
| 65 const std::string& platform) { | 62 const std::string& platform) { |
| 66 ResolveEvent(request_id, platform, | 63 ResolveEvent(request_id, platform, |
| 67 blink::WebAppBannerPromptResult::Outcome::Accepted); | 64 blink::WebAppBannerPromptResult::Outcome::Accepted); |
| 68 } | 65 } |
| 69 | 66 |
| 70 void AppBannerClient::OnBannerDismissed(int request_id) { | 67 void AppBannerClient::OnBannerDismissed(int request_id) { |
| 71 ResolveEvent(request_id, "", | 68 ResolveEvent(request_id, "", |
| 72 blink::WebAppBannerPromptResult::Outcome::Dismissed); | 69 blink::WebAppBannerPromptResult::Outcome::Dismissed); |
| 73 } | 70 } |
| OLD | NEW |