| 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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 search_args.image_thumbnail_content = thumbnail_data; | 374 search_args.image_thumbnail_content = thumbnail_data; |
| 375 search_args.image_url = src_url; | 375 search_args.image_url = src_url; |
| 376 search_args.image_original_size = original_size; | 376 search_args.image_original_size = original_size; |
| 377 TemplateURLRef::PostContent post_content; | 377 TemplateURLRef::PostContent post_content; |
| 378 GURL result(default_provider->image_url_ref().ReplaceSearchTerms( | 378 GURL result(default_provider->image_url_ref().ReplaceSearchTerms( |
| 379 search_args, template_url_service->search_terms_data(), &post_content)); | 379 search_args, template_url_service->search_terms_data(), &post_content)); |
| 380 if (!result.is_valid()) | 380 if (!result.is_valid()) |
| 381 return; | 381 return; |
| 382 | 382 |
| 383 content::OpenURLParams open_url_params( | 383 content::OpenURLParams open_url_params( |
| 384 result, content::Referrer(), NEW_FOREGROUND_TAB, | 384 result, content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 385 ui::PAGE_TRANSITION_LINK, false); | 385 ui::PAGE_TRANSITION_LINK, false); |
| 386 const std::string& content_type = post_content.first; | 386 const std::string& content_type = post_content.first; |
| 387 const std::string& post_data = post_content.second; | 387 const std::string& post_data = post_content.second; |
| 388 if (!post_data.empty()) { | 388 if (!post_data.empty()) { |
| 389 DCHECK(!content_type.empty()); | 389 DCHECK(!content_type.empty()); |
| 390 open_url_params.uses_post = true; | 390 open_url_params.uses_post = true; |
| 391 open_url_params.post_data = content::ResourceRequestBody::CreateFromBytes( | 391 open_url_params.post_data = content::ResourceRequestBody::CreateFromBytes( |
| 392 post_data.data(), post_data.size()); | 392 post_data.data(), post_data.size()); |
| 393 open_url_params.extra_headers += base::StringPrintf( | 393 open_url_params.extra_headers += base::StringPrintf( |
| 394 "%s: %s\r\n", net::HttpRequestHeaders::kContentType, | 394 "%s: %s\r\n", net::HttpRequestHeaders::kContentType, |
| 395 content_type.c_str()); | 395 content_type.c_str()); |
| 396 } | 396 } |
| 397 web_contents()->OpenURL(open_url_params); | 397 web_contents()->OpenURL(open_url_params); |
| 398 } | 398 } |
| OLD | NEW |