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

Side by Side Diff: chrome/browser/ui/android/context_menu_helper.cc

Issue 2943363003: Fixing transparent pixels appearing black when rendered for the context menu. (Closed)
Patch Set: Created 3 years, 6 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ui/android/context_menu_helper.h" 5 #include "chrome/browser/ui/android/context_menu_helper.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 19 matching lines...) Expand all
30 using base::android::ConvertJavaStringToUTF8; 30 using base::android::ConvertJavaStringToUTF8;
31 using base::android::ConvertUTF8ToJavaString; 31 using base::android::ConvertUTF8ToJavaString;
32 using base::android::ConvertUTF16ToJavaString; 32 using base::android::ConvertUTF16ToJavaString;
33 using base::android::JavaParamRef; 33 using base::android::JavaParamRef;
34 34
35 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ContextMenuHelper); 35 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ContextMenuHelper);
36 36
37 const char kDataReductionProxyPassthroughHeader[] = 37 const char kDataReductionProxyPassthroughHeader[] =
38 "Chrome-Proxy-Accept-Transform: identity\r\n"; 38 "Chrome-Proxy-Accept-Transform: identity\r\n";
39 39
40 const bool kUsePNGCodec = true;
41
40 namespace { 42 namespace {
41 43
42 void OnRetrieveImage(chrome::mojom::ThumbnailCapturerPtr thumbnail_capturer, 44 void OnRetrieveImage(chrome::mojom::ThumbnailCapturerPtr thumbnail_capturer,
43 const base::android::JavaRef<jobject>& jcallback, 45 const base::android::JavaRef<jobject>& jcallback,
44 const std::vector<uint8_t>& thumbnail_data, 46 const std::vector<uint8_t>& thumbnail_data,
45 const gfx::Size& original_size) { 47 const gfx::Size& original_size) {
46 base::android::RunCallbackAndroid(jcallback, thumbnail_data); 48 base::android::RunCallbackAndroid(jcallback, thumbnail_data);
47 } 49 }
48 50
49 } // namespace 51 } // namespace
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 content::RenderFrameHost::FromID(render_process_id_, render_frame_id_); 171 content::RenderFrameHost::FromID(render_process_id_, render_frame_id_);
170 if (!render_frame_host) 172 if (!render_frame_host)
171 return; 173 return;
172 174
173 chrome::mojom::ThumbnailCapturerPtr thumbnail_capturer; 175 chrome::mojom::ThumbnailCapturerPtr thumbnail_capturer;
174 render_frame_host->GetRemoteInterfaces()->GetInterface(&thumbnail_capturer); 176 render_frame_host->GetRemoteInterfaces()->GetInterface(&thumbnail_capturer);
175 // Bind the InterfacePtr into the callback so that it's kept alive until 177 // Bind the InterfacePtr into the callback so that it's kept alive until
176 // there's either a connection error or a response. 178 // there's either a connection error or a response.
177 auto* thumbnail_capturer_proxy = thumbnail_capturer.get(); 179 auto* thumbnail_capturer_proxy = thumbnail_capturer.get();
178 thumbnail_capturer_proxy->RequestThumbnailForContextNode( 180 thumbnail_capturer_proxy->RequestThumbnailForContextNode(
179 0, gfx::Size(max_dimen_px, max_dimen_px), 181 0, gfx::Size(max_dimen_px, max_dimen_px), kUsePNGCodec,
180 base::Bind(&OnRetrieveImage, base::Passed(&thumbnail_capturer), 182 base::Bind(&OnRetrieveImage, base::Passed(&thumbnail_capturer),
181 base::android::ScopedJavaGlobalRef<jobject>(env, jcallback))); 183 base::android::ScopedJavaGlobalRef<jobject>(env, jcallback)));
182 } 184 }
183 185
184 bool RegisterContextMenuHelper(JNIEnv* env) { 186 bool RegisterContextMenuHelper(JNIEnv* env) {
185 return RegisterNativesImpl(env); 187 return RegisterNativesImpl(env);
186 } 188 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698