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/browser/banners/app_banner_infobar_delegate_desktop.h" | 5 #include "chrome/browser/banners/app_banner_infobar_delegate_desktop.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "chrome/browser/banners/app_banner_data_fetcher_desktop.h" | 8 #include "chrome/browser/banners/app_banner_data_fetcher_desktop.h" |
9 #include "chrome/browser/banners/app_banner_metrics.h" | 9 #include "chrome/browser/banners/app_banner_metrics.h" |
10 #include "chrome/browser/banners/app_banner_settings_helper.h" | 10 #include "chrome/browser/banners/app_banner_settings_helper.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 TrackUserResponse(USER_RESPONSE_WEB_APP_ACCEPTED); | 87 TrackUserResponse(USER_RESPONSE_WEB_APP_ACCEPTED); |
88 has_user_interaction_ = true; | 88 has_user_interaction_ = true; |
89 | 89 |
90 bookmark_app_helper_->CreateFromAppBanner( | 90 bookmark_app_helper_->CreateFromAppBanner( |
91 base::Bind(&AppBannerDataFetcherDesktop::FinishCreateBookmarkApp, | 91 base::Bind(&AppBannerDataFetcherDesktop::FinishCreateBookmarkApp, |
92 fetcher_), | 92 fetcher_), |
93 web_manifest_); | 93 web_manifest_); |
94 return true; | 94 return true; |
95 } | 95 } |
96 | 96 |
| 97 infobars::InfoBarDelegate::InfoBarIdentifier |
| 98 AppBannerInfoBarDelegateDesktop::GetIdentifier() const { |
| 99 return APP_BANNER_INFOBAR_DELEGATE_DESKTOP; |
| 100 } |
| 101 |
97 void AppBannerInfoBarDelegateDesktop::InfoBarDismissed() { | 102 void AppBannerInfoBarDelegateDesktop::InfoBarDismissed() { |
98 TrackUserResponse(USER_RESPONSE_WEB_APP_DISMISSED); | 103 TrackUserResponse(USER_RESPONSE_WEB_APP_DISMISSED); |
99 has_user_interaction_ = true; | 104 has_user_interaction_ = true; |
100 | 105 |
101 content::WebContents* web_contents = | 106 content::WebContents* web_contents = |
102 InfoBarService::WebContentsFromInfoBar(infobar()); | 107 InfoBarService::WebContentsFromInfoBar(infobar()); |
103 if (web_contents) { | 108 if (web_contents) { |
104 fetcher_.get()->Cancel(); | 109 fetcher_.get()->Cancel(); |
105 | 110 |
106 web_contents->GetMainFrame()->Send( | 111 web_contents->GetMainFrame()->Send( |
107 new ChromeViewMsg_AppBannerDismissed( | 112 new ChromeViewMsg_AppBannerDismissed( |
108 web_contents->GetMainFrame()->GetRoutingID(), | 113 web_contents->GetMainFrame()->GetRoutingID(), |
109 event_request_id_)); | 114 event_request_id_)); |
110 | 115 |
111 AppBannerSettingsHelper::RecordBannerDismissEvent( | 116 AppBannerSettingsHelper::RecordBannerDismissEvent( |
112 web_contents, web_manifest_.start_url.spec(), | 117 web_contents, web_manifest_.start_url.spec(), |
113 AppBannerSettingsHelper::WEB); | 118 AppBannerSettingsHelper::WEB); |
114 } | 119 } |
115 } | 120 } |
116 | 121 |
117 } // namespace banners | 122 } // namespace banners |
OLD | NEW |