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

Side by Side Diff: chrome/browser/ui/tab_contents/core_tab_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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/tab_contents/core_tab_helper.h" 5 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "components/guest_view/browser/guest_view_manager.h" 47 #include "components/guest_view/browser/guest_view_manager.h"
48 #endif 48 #endif
49 49
50 using content::WebContents; 50 using content::WebContents;
51 51
52 namespace { 52 namespace {
53 53
54 const int kImageSearchThumbnailMinSize = 300 * 300; 54 const int kImageSearchThumbnailMinSize = 300 * 300;
55 const int kImageSearchThumbnailMaxWidth = 600; 55 const int kImageSearchThumbnailMaxWidth = 600;
56 const int kImageSearchThumbnailMaxHeight = 600; 56 const int kImageSearchThumbnailMaxHeight = 600;
57 const int kUsingPNGCodec = false;
57 58
58 } // namespace 59 } // namespace
59 60
60 DEFINE_WEB_CONTENTS_USER_DATA_KEY(CoreTabHelper); 61 DEFINE_WEB_CONTENTS_USER_DATA_KEY(CoreTabHelper);
61 62
62 CoreTabHelper::CoreTabHelper(WebContents* web_contents) 63 CoreTabHelper::CoreTabHelper(WebContents* web_contents)
63 : content::WebContentsObserver(web_contents), 64 : content::WebContentsObserver(web_contents),
64 delegate_(NULL), 65 delegate_(NULL),
65 content_restrictions_(0), 66 content_restrictions_(0),
66 weak_factory_(this) {} 67 weak_factory_(this) {}
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 content::RenderFrameHost* render_frame_host, 113 content::RenderFrameHost* render_frame_host,
113 const GURL& src_url) { 114 const GURL& src_url) {
114 chrome::mojom::ThumbnailCapturerPtr thumbnail_capturer; 115 chrome::mojom::ThumbnailCapturerPtr thumbnail_capturer;
115 render_frame_host->GetRemoteInterfaces()->GetInterface(&thumbnail_capturer); 116 render_frame_host->GetRemoteInterfaces()->GetInterface(&thumbnail_capturer);
116 // Bind the InterfacePtr into the callback so that it's kept alive until 117 // Bind the InterfacePtr into the callback so that it's kept alive until
117 // there's either a connection error or a response. 118 // there's either a connection error or a response.
118 auto* thumbnail_capturer_proxy = thumbnail_capturer.get(); 119 auto* thumbnail_capturer_proxy = thumbnail_capturer.get();
119 thumbnail_capturer_proxy->RequestThumbnailForContextNode( 120 thumbnail_capturer_proxy->RequestThumbnailForContextNode(
120 kImageSearchThumbnailMinSize, 121 kImageSearchThumbnailMinSize,
121 gfx::Size(kImageSearchThumbnailMaxWidth, kImageSearchThumbnailMaxHeight), 122 gfx::Size(kImageSearchThumbnailMaxWidth, kImageSearchThumbnailMaxHeight),
123 kUsingPNGCodec,
122 base::Bind(&CoreTabHelper::DoSearchByImageInNewTab, 124 base::Bind(&CoreTabHelper::DoSearchByImageInNewTab,
123 weak_factory_.GetWeakPtr(), base::Passed(&thumbnail_capturer), 125 weak_factory_.GetWeakPtr(), base::Passed(&thumbnail_capturer),
124 src_url)); 126 src_url));
125 } 127 }
126 128
127 // static 129 // static
128 bool CoreTabHelper::GetStatusTextForWebContents( 130 bool CoreTabHelper::GetStatusTextForWebContents(
129 base::string16* status_text, content::WebContents* source) { 131 base::string16* status_text, content::WebContents* source) {
130 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/467185 is 132 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/467185 is
131 // fixed. 133 // fixed.
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 DCHECK(!content_type.empty()); 348 DCHECK(!content_type.empty());
347 open_url_params.uses_post = true; 349 open_url_params.uses_post = true;
348 open_url_params.post_data = content::ResourceRequestBody::CreateFromBytes( 350 open_url_params.post_data = content::ResourceRequestBody::CreateFromBytes(
349 post_data.data(), post_data.size()); 351 post_data.data(), post_data.size());
350 open_url_params.extra_headers += base::StringPrintf( 352 open_url_params.extra_headers += base::StringPrintf(
351 "%s: %s\r\n", net::HttpRequestHeaders::kContentType, 353 "%s: %s\r\n", net::HttpRequestHeaders::kContentType,
352 content_type.c_str()); 354 content_type.c_str());
353 } 355 }
354 web_contents()->OpenURL(open_url_params); 356 web_contents()->OpenURL(open_url_params);
355 } 357 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698