OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/webui/bug_report_ui.h" | 5 #include "chrome/browser/ui/webui/bug_report_ui.h" |
6 | 6 |
7 #include <algorithm> | |
8 #include <vector> | 7 #include <vector> |
9 | 8 |
10 #include "base/callback.h" | 9 #include "base/callback.h" |
11 #include "base/logging.h" | 10 #include "base/logging.h" |
12 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
13 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
14 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
15 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
16 #include "base/string_piece.h" | 15 #include "base/string_piece.h" |
17 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 l10n_util::GetStringUTF8(IDS_BUGREPORT_PHISHING_PAGE)); | 370 l10n_util::GetStringUTF8(IDS_BUGREPORT_PHISHING_PAGE)); |
372 localized_strings.SetString(std::string("issue-other"), | 371 localized_strings.SetString(std::string("issue-other"), |
373 l10n_util::GetStringUTF8(IDS_BUGREPORT_OTHER)); | 372 l10n_util::GetStringUTF8(IDS_BUGREPORT_OTHER)); |
374 localized_strings.SetString(std::string("issue-autofill"), | 373 localized_strings.SetString(std::string("issue-autofill"), |
375 l10n_util::GetStringUTF8(IDS_BUGREPORT_AUTOFILL)); | 374 l10n_util::GetStringUTF8(IDS_BUGREPORT_AUTOFILL)); |
376 | 375 |
377 #endif | 376 #endif |
378 | 377 |
379 SetFontAndTextDirection(&localized_strings); | 378 SetFontAndTextDirection(&localized_strings); |
380 | 379 |
381 const std::string full_html = jstemplate_builder::GetI18nTemplateHtml( | 380 std::string full_html = jstemplate_builder::GetI18nTemplateHtml( |
382 bug_report_html_, &localized_strings); | 381 bug_report_html_, &localized_strings); |
383 | 382 |
384 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); | 383 SendResponse(request_id, base::RefCountedString::TakeString(&full_html)); |
385 html_bytes->data.resize(full_html.size()); | |
386 std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin()); | |
387 | |
388 SendResponse(request_id, html_bytes); | |
389 } | 384 } |
390 | 385 |
391 | 386 |
392 //////////////////////////////////////////////////////////////////////////////// | 387 //////////////////////////////////////////////////////////////////////////////// |
393 // | 388 // |
394 // BugReportData | 389 // BugReportData |
395 // | 390 // |
396 //////////////////////////////////////////////////////////////////////////////// | 391 //////////////////////////////////////////////////////////////////////////////// |
397 void BugReportData::SendReport() { | 392 void BugReportData::SendReport() { |
398 #if defined(OS_CHROMEOS) | 393 #if defined(OS_CHROMEOS) |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 BugReportHandler* handler = new BugReportHandler(tab); | 748 BugReportHandler* handler = new BugReportHandler(tab); |
754 AddMessageHandler((handler)->Attach(this)); | 749 AddMessageHandler((handler)->Attach(this)); |
755 | 750 |
756 // The handler's init will specify which html | 751 // The handler's init will specify which html |
757 // resource we'll display to the user | 752 // resource we'll display to the user |
758 BugReportUIHTMLSource* html_source = | 753 BugReportUIHTMLSource* html_source = |
759 new BugReportUIHTMLSource(handler->Init()); | 754 new BugReportUIHTMLSource(handler->Init()); |
760 // Set up the chrome://bugreport/ source. | 755 // Set up the chrome://bugreport/ source. |
761 tab->profile()->GetChromeURLDataManager()->AddDataSource(html_source); | 756 tab->profile()->GetChromeURLDataManager()->AddDataSource(html_source); |
762 } | 757 } |
OLD | NEW |