benwells | 04ab5b96 | 2015-05-06 08:29:40 | [diff] [blame^] | 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. |
| 4 | |
| 5 | #ifndef CHROME_RENDERER_BANNERS_APP_BANNER_CLIENT_H_ |
| 6 | #define CHROME_RENDERER_BANNERS_APP_BANNER_CLIENT_H_ |
| 7 | |
| 8 | #include <stdint.h> |
| 9 | #include <string> |
| 10 | |
| 11 | #include "base/id_map.h" |
| 12 | #include "content/public/renderer/render_frame_observer.h" |
| 13 | #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerClient.h" |
| 14 | #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerPromptResult.h" |
| 15 | |
| 16 | namespace IPC { |
| 17 | class Message; |
| 18 | } // namespace IPC |
| 19 | |
| 20 | class AppBannerClient : public content::RenderFrameObserver, |
| 21 | public blink::WebAppBannerClient { |
| 22 | public: |
| 23 | explicit AppBannerClient(content::RenderFrame* render_frame); |
| 24 | virtual ~AppBannerClient(); |
| 25 | |
| 26 | private: |
| 27 | // content::RenderFrame::Observer implementation. |
| 28 | bool OnMessageReceived(const IPC::Message& message) override; |
| 29 | |
| 30 | // WebAppBannerClient implementation. |
| 31 | void registerBannerCallbacks(int request_id, |
| 32 | blink::WebAppBannerCallbacks*) override; |
| 33 | |
| 34 | void ResolveEvent(int request_id, |
| 35 | const std::string& platform, |
| 36 | const blink::WebAppBannerPromptResult::Outcome& outcome); |
| 37 | void OnBannerAccepted(int request_id, const std::string& platform); |
| 38 | void OnBannerDismissed(int request_id); |
| 39 | |
| 40 | IDMap<blink::WebAppBannerCallbacks, IDMapOwnPointer> |
| 41 | banner_callbacks_; |
| 42 | |
| 43 | DISALLOW_COPY_AND_ASSIGN(AppBannerClient); |
| 44 | }; |
| 45 | |
| 46 | #endif // CHROME_RENDERER_BANNERS_APP_BANNER_CLIENT_H_ |