| 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/android/banners/app_banner_data_fetcher_android.h" | 5 #include "chrome/browser/android/banners/app_banner_data_fetcher_android.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "chrome/browser/android/banners/app_banner_infobar_delegate_android.h" | 9 #include "chrome/browser/android/banners/app_banner_infobar_delegate_android.h" |
| 8 #include "chrome/browser/android/shortcut_helper.h" | 10 #include "chrome/browser/android/shortcut_helper.h" |
| 9 #include "chrome/browser/banners/app_banner_metrics.h" | 11 #include "chrome/browser/banners/app_banner_metrics.h" |
| 10 #include "chrome/browser/infobars/infobar_service.h" | 12 #include "chrome/browser/infobars/infobar_service.h" |
| 11 #include "chrome/browser/manifest/manifest_icon_selector.h" | 13 #include "chrome/browser/manifest/manifest_icon_selector.h" |
| 12 #include "chrome/browser/ui/android/infobars/app_banner_infobar_android.h" | 14 #include "chrome/browser/ui/android/infobars/app_banner_infobar_android.h" |
| 13 #include "third_party/skia/include/core/SkBitmap.h" | 15 #include "third_party/skia/include/core/SkBitmap.h" |
| 14 #include "ui/gfx/screen.h" | 16 #include "ui/gfx/screen.h" |
| 15 | 17 |
| 16 namespace banners { | 18 namespace banners { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 content::WebContents* web_contents = GetWebContents(); | 81 content::WebContents* web_contents = GetWebContents(); |
| 80 DCHECK(web_contents); | 82 DCHECK(web_contents); |
| 81 | 83 |
| 82 infobars::InfoBar* infobar = nullptr; | 84 infobars::InfoBar* infobar = nullptr; |
| 83 if (native_app_data_.is_null()) { | 85 if (native_app_data_.is_null()) { |
| 84 scoped_ptr<AppBannerInfoBarDelegateAndroid> delegate( | 86 scoped_ptr<AppBannerInfoBarDelegateAndroid> delegate( |
| 85 new AppBannerInfoBarDelegateAndroid( | 87 new AppBannerInfoBarDelegateAndroid( |
| 86 event_request_id(), this, title, new SkBitmap(*icon), | 88 event_request_id(), this, title, new SkBitmap(*icon), |
| 87 web_app_data())); | 89 web_app_data())); |
| 88 | 90 |
| 89 infobar = | 91 infobar = new AppBannerInfoBarAndroid(std::move(delegate), |
| 90 new AppBannerInfoBarAndroid(delegate.Pass(), web_app_data().start_url); | 92 web_app_data().start_url); |
| 91 if (infobar) { | 93 if (infobar) { |
| 92 RecordDidShowBanner("AppBanner.WebApp.Shown"); | 94 RecordDidShowBanner("AppBanner.WebApp.Shown"); |
| 93 TrackDisplayEvent(DISPLAY_EVENT_WEB_APP_BANNER_CREATED); | 95 TrackDisplayEvent(DISPLAY_EVENT_WEB_APP_BANNER_CREATED); |
| 94 } | 96 } |
| 95 } else { | 97 } else { |
| 96 scoped_ptr<AppBannerInfoBarDelegateAndroid> delegate( | 98 scoped_ptr<AppBannerInfoBarDelegateAndroid> delegate( |
| 97 new AppBannerInfoBarDelegateAndroid( | 99 new AppBannerInfoBarDelegateAndroid( |
| 98 event_request_id(), title, new SkBitmap(*icon), native_app_data_, | 100 event_request_id(), title, new SkBitmap(*icon), native_app_data_, |
| 99 native_app_package_, referrer)); | 101 native_app_package_, referrer)); |
| 100 infobar = new AppBannerInfoBarAndroid(delegate.Pass(), native_app_data_); | 102 infobar = |
| 103 new AppBannerInfoBarAndroid(std::move(delegate), native_app_data_); |
| 101 if (infobar) { | 104 if (infobar) { |
| 102 RecordDidShowBanner("AppBanner.NativeApp.Shown"); | 105 RecordDidShowBanner("AppBanner.NativeApp.Shown"); |
| 103 TrackDisplayEvent(DISPLAY_EVENT_NATIVE_APP_BANNER_CREATED); | 106 TrackDisplayEvent(DISPLAY_EVENT_NATIVE_APP_BANNER_CREATED); |
| 104 } | 107 } |
| 105 } | 108 } |
| 106 InfoBarService::FromWebContents(web_contents) | 109 InfoBarService::FromWebContents(web_contents) |
| 107 ->AddInfoBar(make_scoped_ptr(infobar)); | 110 ->AddInfoBar(make_scoped_ptr(infobar)); |
| 108 } | 111 } |
| 109 | 112 |
| 110 } // namespace banners | 113 } // namespace banners |
| OLD | NEW |