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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 TemplateURLRef::PostContent post_content; | 343 TemplateURLRef::PostContent post_content; |
344 GURL result(default_provider->image_url_ref().ReplaceSearchTerms( | 344 GURL result(default_provider->image_url_ref().ReplaceSearchTerms( |
345 search_args, template_url_service->search_terms_data(), &post_content)); | 345 search_args, template_url_service->search_terms_data(), &post_content)); |
346 if (!result.is_valid()) | 346 if (!result.is_valid()) |
347 return; | 347 return; |
348 | 348 |
349 content::OpenURLParams open_url_params( | 349 content::OpenURLParams open_url_params( |
350 result, content::Referrer(), NEW_FOREGROUND_TAB, | 350 result, content::Referrer(), NEW_FOREGROUND_TAB, |
351 ui::PAGE_TRANSITION_LINK, false); | 351 ui::PAGE_TRANSITION_LINK, false); |
352 const std::string& content_type = post_content.first; | 352 const std::string& content_type = post_content.first; |
353 std::string* post_data = &post_content.second; | 353 const std::string& post_data = post_content.second; |
354 if (!post_data->empty()) { | 354 if (!post_data.empty()) { |
355 DCHECK(!content_type.empty()); | 355 DCHECK(!content_type.empty()); |
356 open_url_params.uses_post = true; | 356 open_url_params.uses_post = true; |
357 open_url_params.browser_initiated_post_data = | 357 open_url_params.post_data = content::ResourceRequestBody::CreateFromBytes( |
358 base::RefCountedString::TakeString(post_data); | 358 post_data.data(), post_data.size()); |
359 open_url_params.extra_headers += base::StringPrintf( | 359 open_url_params.extra_headers += base::StringPrintf( |
360 "%s: %s\r\n", net::HttpRequestHeaders::kContentType, | 360 "%s: %s\r\n", net::HttpRequestHeaders::kContentType, |
361 content_type.c_str()); | 361 content_type.c_str()); |
362 } | 362 } |
363 web_contents()->OpenURL(open_url_params); | 363 web_contents()->OpenURL(open_url_params); |
364 } | 364 } |
OLD | NEW |