Chromium Code Reviews| 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 "chrome/browser/android/banners/app_banner_infobar_delegate_android.h" | 7 #include "chrome/browser/android/banners/app_banner_infobar_delegate_android.h" |
| 8 #include "chrome/browser/banners/app_banner_metrics.h" | 8 #include "chrome/browser/banners/app_banner_metrics.h" |
| 9 #include "chrome/browser/infobars/infobar_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
| 10 #include "chrome/browser/ui/android/infobars/app_banner_infobar_android.h" | 10 #include "chrome/browser/ui/android/infobars/app_banner_infobar_android.h" |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 } | 28 } |
| 29 | 29 |
| 30 bool AppBannerDataFetcherAndroid::ContinueFetching( | 30 bool AppBannerDataFetcherAndroid::ContinueFetching( |
| 31 const base::string16& app_title, | 31 const base::string16& app_title, |
| 32 const std::string& app_package, | 32 const std::string& app_package, |
| 33 base::android::ScopedJavaLocalRef<jobject> app_data, | 33 base::android::ScopedJavaLocalRef<jobject> app_data, |
| 34 const GURL& image_url) { | 34 const GURL& image_url) { |
| 35 set_app_title(app_title); | 35 set_app_title(app_title); |
| 36 native_app_package_ = app_package; | 36 native_app_package_ = app_package; |
| 37 native_app_data_.Reset(app_data); | 37 native_app_data_.Reset(app_data); |
| 38 return FetchIcon(image_url); | 38 |
| 39 content::WebContents* web_contents = GetWebContents(); | |
| 40 DCHECK(web_contents); | |
|
mlamouri (slow - plz ping)
2015/08/05 08:20:16
nit: I would move the DCHECK() inside FetchAppIcon
Lalit Maganti
2015/08/05 14:47:13
Got rid of web contents all together as I don't ev
| |
| 41 | |
| 42 return FetchAppIcon(web_contents, image_url); | |
| 39 } | 43 } |
| 40 | 44 |
| 41 std::string AppBannerDataFetcherAndroid::GetAppIdentifier() { | 45 std::string AppBannerDataFetcherAndroid::GetAppIdentifier() { |
| 42 return native_app_data_.is_null() | 46 return native_app_data_.is_null() |
| 43 ? AppBannerDataFetcher::GetAppIdentifier() : native_app_package_; | 47 ? AppBannerDataFetcher::GetAppIdentifier() : native_app_package_; |
| 44 } | 48 } |
| 45 | 49 |
| 46 void AppBannerDataFetcherAndroid::ShowBanner(const SkBitmap* icon, | 50 void AppBannerDataFetcherAndroid::ShowBanner(const SkBitmap* icon, |
| 47 const base::string16& title) { | 51 const base::string16& title) { |
| 48 content::WebContents* web_contents = GetWebContents(); | 52 content::WebContents* web_contents = GetWebContents(); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 69 if (infobar) { | 73 if (infobar) { |
| 70 RecordDidShowBanner("AppBanner.NativeApp.Shown"); | 74 RecordDidShowBanner("AppBanner.NativeApp.Shown"); |
| 71 TrackDisplayEvent(DISPLAY_EVENT_NATIVE_APP_BANNER_CREATED); | 75 TrackDisplayEvent(DISPLAY_EVENT_NATIVE_APP_BANNER_CREATED); |
| 72 } | 76 } |
| 73 } | 77 } |
| 74 InfoBarService::FromWebContents(web_contents) | 78 InfoBarService::FromWebContents(web_contents) |
| 75 ->AddInfoBar(make_scoped_ptr(infobar)); | 79 ->AddInfoBar(make_scoped_ptr(infobar)); |
| 76 } | 80 } |
| 77 | 81 |
| 78 } // namespace banners | 82 } // namespace banners |
| OLD | NEW |