OLD | NEW |
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 content::RenderFrameHost* render_frame_host, | 112 content::RenderFrameHost* render_frame_host, |
113 const GURL& src_url) { | 113 const GURL& src_url) { |
114 chrome::mojom::ThumbnailCapturerPtr thumbnail_capturer; | 114 chrome::mojom::ThumbnailCapturerPtr thumbnail_capturer; |
115 render_frame_host->GetRemoteInterfaces()->GetInterface(&thumbnail_capturer); | 115 render_frame_host->GetRemoteInterfaces()->GetInterface(&thumbnail_capturer); |
116 // Bind the InterfacePtr into the callback so that it's kept alive until | 116 // Bind the InterfacePtr into the callback so that it's kept alive until |
117 // there's either a connection error or a response. | 117 // there's either a connection error or a response. |
118 auto* thumbnail_capturer_proxy = thumbnail_capturer.get(); | 118 auto* thumbnail_capturer_proxy = thumbnail_capturer.get(); |
119 thumbnail_capturer_proxy->RequestThumbnailForContextNode( | 119 thumbnail_capturer_proxy->RequestThumbnailForContextNode( |
120 kImageSearchThumbnailMinSize, | 120 kImageSearchThumbnailMinSize, |
121 gfx::Size(kImageSearchThumbnailMaxWidth, kImageSearchThumbnailMaxHeight), | 121 gfx::Size(kImageSearchThumbnailMaxWidth, kImageSearchThumbnailMaxHeight), |
| 122 chrome::mojom::ImageFormat::JPEG, |
122 base::Bind(&CoreTabHelper::DoSearchByImageInNewTab, | 123 base::Bind(&CoreTabHelper::DoSearchByImageInNewTab, |
123 weak_factory_.GetWeakPtr(), base::Passed(&thumbnail_capturer), | 124 weak_factory_.GetWeakPtr(), base::Passed(&thumbnail_capturer), |
124 src_url)); | 125 src_url)); |
125 } | 126 } |
126 | 127 |
127 // static | 128 // static |
128 bool CoreTabHelper::GetStatusTextForWebContents( | 129 bool CoreTabHelper::GetStatusTextForWebContents( |
129 base::string16* status_text, content::WebContents* source) { | 130 base::string16* status_text, content::WebContents* source) { |
130 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/467185 is | 131 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/467185 is |
131 // fixed. | 132 // fixed. |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 DCHECK(!content_type.empty()); | 347 DCHECK(!content_type.empty()); |
347 open_url_params.uses_post = true; | 348 open_url_params.uses_post = true; |
348 open_url_params.post_data = content::ResourceRequestBody::CreateFromBytes( | 349 open_url_params.post_data = content::ResourceRequestBody::CreateFromBytes( |
349 post_data.data(), post_data.size()); | 350 post_data.data(), post_data.size()); |
350 open_url_params.extra_headers += base::StringPrintf( | 351 open_url_params.extra_headers += base::StringPrintf( |
351 "%s: %s\r\n", net::HttpRequestHeaders::kContentType, | 352 "%s: %s\r\n", net::HttpRequestHeaders::kContentType, |
352 content_type.c_str()); | 353 content_type.c_str()); |
353 } | 354 } |
354 web_contents()->OpenURL(open_url_params); | 355 web_contents()->OpenURL(open_url_params); |
355 } | 356 } |
OLD | NEW |