Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Side by Side Diff: chrome/browser/android/banners/app_banner_manager.cc

Issue 253623002: Remove BitmapFetcher's dependency on Profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/bitmap_fetcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_manager.h" 5 #include "chrome/browser/android/banners/app_banner_manager.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "chrome/browser/android/banners/app_banner_metrics_ids.h" 10 #include "chrome/browser/android/banners/app_banner_metrics_ids.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 jobject obj, 125 jobject obj,
126 jstring jimage_url) { 126 jstring jimage_url) {
127 std::string image_url = ConvertJavaStringToUTF8(env, jimage_url); 127 std::string image_url = ConvertJavaStringToUTF8(env, jimage_url);
128 if (!web_contents()) 128 if (!web_contents())
129 return false; 129 return false;
130 130
131 // Begin asynchronously fetching the app icon. 131 // Begin asynchronously fetching the app icon.
132 Profile* profile = 132 Profile* profile =
133 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); 133 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
134 fetcher_.reset(new chrome::BitmapFetcher(GURL(image_url), this)); 134 fetcher_.reset(new chrome::BitmapFetcher(GURL(image_url), this));
135 fetcher_.get()->Start(profile); 135 fetcher_.get()->Start(profile->GetRequestContext());
136 return true; 136 return true;
137 } 137 }
138 138
139 void RecordDismissEvent(JNIEnv* env, jclass clazz, jint metric) { 139 void RecordDismissEvent(JNIEnv* env, jclass clazz, jint metric) {
140 banners::TrackDismissEvent(metric); 140 banners::TrackDismissEvent(metric);
141 } 141 }
142 142
143 void RecordInstallEvent(JNIEnv* env, jclass clazz, jint metric) { 143 void RecordInstallEvent(JNIEnv* env, jclass clazz, jint metric) {
144 banners::TrackInstallEvent(metric); 144 banners::TrackInstallEvent(metric);
145 } 145 }
146 146
147 jlong Init(JNIEnv* env, jobject obj) { 147 jlong Init(JNIEnv* env, jobject obj) {
148 AppBannerManager* manager = new AppBannerManager(env, obj); 148 AppBannerManager* manager = new AppBannerManager(env, obj);
149 return reinterpret_cast<intptr_t>(manager); 149 return reinterpret_cast<intptr_t>(manager);
150 } 150 }
151 151
152 jboolean IsEnabled(JNIEnv* env, jclass clazz) { 152 jboolean IsEnabled(JNIEnv* env, jclass clazz) {
153 return false; 153 return false;
154 } 154 }
155 155
156 // Register native methods 156 // Register native methods
157 bool RegisterAppBannerManager(JNIEnv* env) { 157 bool RegisterAppBannerManager(JNIEnv* env) {
158 return RegisterNativesImpl(env); 158 return RegisterNativesImpl(env);
159 } 159 }
160 160
161 } // namespace banners 161 } // namespace banners
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/bitmap_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698