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