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_BROWSER_BANNERS_APP_BANNER_INFOBAR_DELEGATE_DESKTOP_H_ | 5 #ifndef CHROME_BROWSER_BANNERS_APP_BANNER_INFOBAR_DELEGATE_DESKTOP_H_ |
6 #define CHROME_BROWSER_BANNERS_APP_BANNER_INFOBAR_DELEGATE_DESKTOP_H_ | 6 #define CHROME_BROWSER_BANNERS_APP_BANNER_INFOBAR_DELEGATE_DESKTOP_H_ |
7 | 7 |
8 #include <memory> | |
9 | |
10 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" |
11 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
12 #include "components/infobars/core/confirm_infobar_delegate.h" | 11 #include "components/infobars/core/confirm_infobar_delegate.h" |
13 #include "content/public/common/manifest.h" | 12 #include "content/public/common/manifest.h" |
14 | 13 |
15 namespace content { | 14 namespace content { |
16 class WebContents; | 15 class WebContents; |
17 } // namespace content | 16 } |
18 | 17 |
19 namespace extensions { | 18 namespace extensions { |
20 class BookmarkAppHelper; | 19 class BookmarkAppHelper; |
21 class Extension; | 20 class Extension; |
22 } // namespace extensions | 21 } |
23 | 22 |
24 namespace infobars { | 23 namespace infobars { |
25 class InfoBar; | 24 class InfoBar; |
26 } // namespace infobars | 25 } |
27 | 26 |
28 namespace banners { | 27 namespace banners { |
29 | 28 |
30 class AppBannerDataFetcherDesktop; | 29 class AppBannerManager; |
31 | 30 |
32 class AppBannerInfoBarDelegateDesktop : public ConfirmInfoBarDelegate { | 31 class AppBannerInfoBarDelegateDesktop : public ConfirmInfoBarDelegate { |
33 | 32 |
34 public: | 33 public: |
35 ~AppBannerInfoBarDelegateDesktop() override; | 34 ~AppBannerInfoBarDelegateDesktop() override; |
36 | 35 |
37 static infobars::InfoBar* Create( | 36 static infobars::InfoBar* Create( |
38 scoped_refptr<AppBannerDataFetcherDesktop> fetcher, | |
39 content::WebContents* web_contents, | 37 content::WebContents* web_contents, |
40 const content::Manifest& web_manifest, | 38 base::WeakPtr<AppBannerManager> weak_manager, |
41 extensions::BookmarkAppHelper* bookmark_app_helper, | 39 extensions::BookmarkAppHelper* bookmark_app_helper, |
| 40 const content::Manifest& manifest, |
42 int event_request_id); | 41 int event_request_id); |
43 | 42 |
44 // ConfirmInfoBarDelegate overrides. | 43 // ConfirmInfoBarDelegate overrides. |
45 base::string16 GetMessageText() const override; | 44 base::string16 GetMessageText() const override; |
46 int GetButtons() const override; | 45 int GetButtons() const override; |
47 base::string16 GetButtonLabel(InfoBarButton button) const override; | 46 base::string16 GetButtonLabel(InfoBarButton button) const override; |
48 | 47 |
49 bool Accept() override; | 48 bool Accept() override; |
50 | 49 |
51 // InfoBarDelegate override. | 50 // InfoBarDelegate override. |
52 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; | 51 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; |
53 void InfoBarDismissed() override; | 52 void InfoBarDismissed() override; |
54 | 53 |
55 protected: | 54 protected: |
56 AppBannerInfoBarDelegateDesktop( | 55 AppBannerInfoBarDelegateDesktop( |
57 scoped_refptr<AppBannerDataFetcherDesktop> fetcher, | 56 base::WeakPtr<AppBannerManager> weak_manager, |
58 const content::Manifest& web_manifest, | |
59 extensions::BookmarkAppHelper* bookmark_app_helper, | 57 extensions::BookmarkAppHelper* bookmark_app_helper, |
| 58 const content::Manifest& manifest, |
60 int event_request_id); | 59 int event_request_id); |
61 | 60 |
62 private: | 61 private: |
63 scoped_refptr<AppBannerDataFetcherDesktop> fetcher_; | 62 base::WeakPtr<AppBannerManager> weak_manager_; |
64 content::Manifest web_manifest_; | |
65 extensions::BookmarkAppHelper* bookmark_app_helper_; | 63 extensions::BookmarkAppHelper* bookmark_app_helper_; |
| 64 content::Manifest manifest_; |
66 int event_request_id_; | 65 int event_request_id_; |
67 bool has_user_interaction_; | 66 bool has_user_interaction_; |
68 | 67 |
69 Type GetInfoBarType() const override; | 68 Type GetInfoBarType() const override; |
70 int GetIconId() const override; | 69 int GetIconId() const override; |
71 gfx::VectorIconId GetVectorIconId() const override; | 70 gfx::VectorIconId GetVectorIconId() const override; |
72 | 71 |
73 DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegateDesktop); | 72 DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegateDesktop); |
74 }; | 73 }; |
75 | 74 |
76 } // namespace banners | 75 } // namespace banners |
77 | 76 |
78 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_INFOBAR_DELEGATE_DESKTOP_H_ | 77 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_INFOBAR_DELEGATE_DESKTOP_H_ |
OLD | NEW |