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

Side by Side Diff: chrome/browser/renderer_host/chrome_render_view_host_observer.cc

Issue 23200006: Don't show the search-by-image menu item when the image is blocked (no image pixel data) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 4 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/tab_contents/render_view_context_menu.cc » ('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 (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/renderer_host/chrome_render_view_host_observer.h" 5 #include "chrome/browser/renderer_host/chrome_render_view_host_observer.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 #if defined(OS_WIN) && defined(USE_AURA) 199 #if defined(OS_WIN) && defined(USE_AURA)
200 base::win::DismissVirtualKeyboard(); 200 base::win::DismissVirtualKeyboard();
201 #endif 201 #endif
202 } 202 }
203 } 203 }
204 204
205 // Handles the image thumbnail for the context node, composes a image search 205 // Handles the image thumbnail for the context node, composes a image search
206 // request based on the received thumbnail and opens the request in a new tab. 206 // request based on the received thumbnail and opens the request in a new tab.
207 void ChromeRenderViewHostObserver::OnRequestThumbnailForContextNodeACK( 207 void ChromeRenderViewHostObserver::OnRequestThumbnailForContextNodeACK(
208 const SkBitmap& bitmap) { 208 const SkBitmap& bitmap) {
209 if (bitmap.isNull())
210 return;
209 WebContents* web_contents = 211 WebContents* web_contents =
210 WebContents::FromRenderViewHost(render_view_host()); 212 WebContents::FromRenderViewHost(render_view_host());
211 const TemplateURL* const default_provider = 213 const TemplateURL* const default_provider =
212 TemplateURLServiceFactory::GetForProfile(profile_)-> 214 TemplateURLServiceFactory::GetForProfile(profile_)->
213 GetDefaultSearchProvider(); 215 GetDefaultSearchProvider();
214 if (!web_contents || !default_provider) 216 if (!web_contents || !default_provider)
215 return; 217 return;
216 218
217 const int kDefaultQualityForImageSearch = 90; 219 const int kDefaultQualityForImageSearch = 90;
218 std::vector<unsigned char> data; 220 std::vector<unsigned char> data;
(...skipping 24 matching lines...) Expand all
243 DCHECK(!content_type.empty()); 245 DCHECK(!content_type.empty());
244 open_url_params.uses_post = true; 246 open_url_params.uses_post = true;
245 open_url_params.browser_initiated_post_data = 247 open_url_params.browser_initiated_post_data =
246 base::RefCountedString::TakeString(post_data); 248 base::RefCountedString::TakeString(post_data);
247 open_url_params.extra_headers += base::StringPrintf( 249 open_url_params.extra_headers += base::StringPrintf(
248 "%s: %s\r\n", net::HttpRequestHeaders::kContentType, 250 "%s: %s\r\n", net::HttpRequestHeaders::kContentType,
249 content_type.c_str()); 251 content_type.c_str());
250 } 252 }
251 web_contents->OpenURL(open_url_params); 253 web_contents->OpenURL(open_url_params);
252 } 254 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/tab_contents/render_view_context_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698