OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/dom_ui/bug_report_ui.h" | 5 #include "chrome/browser/dom_ui/bug_report_ui.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 } | 447 } |
448 | 448 |
449 base::StringPiece BugReportHandler::Init() { | 449 base::StringPiece BugReportHandler::Init() { |
450 std::string page_url; | 450 std::string page_url; |
451 if (tab_->controller().GetActiveEntry()) { | 451 if (tab_->controller().GetActiveEntry()) { |
452 page_url = tab_->controller().GetActiveEntry()->url().spec(); | 452 page_url = tab_->controller().GetActiveEntry()->url().spec(); |
453 } | 453 } |
454 | 454 |
455 std::string params = page_url.substr(strlen(chrome::kChromeUIBugReportURL)); | 455 std::string params = page_url.substr(strlen(chrome::kChromeUIBugReportURL)); |
456 // Erase the # - the first character. | 456 // Erase the # - the first character. |
457 params.erase(params.begin(),params.begin() + 1); | 457 if (params.length()) |
| 458 params.erase(params.begin(),params.begin() + 1); |
458 | 459 |
459 int index = 0; | 460 int index = 0; |
460 if (!base::StringToInt(params, &index)) { | 461 if (!base::StringToInt(params, &index)) { |
461 return base::StringPiece( | 462 return base::StringPiece( |
462 ResourceBundle::GetSharedInstance().GetRawDataResource( | 463 ResourceBundle::GetSharedInstance().GetRawDataResource( |
463 IDR_BUGREPORT_HTML_INVALID)); | 464 IDR_BUGREPORT_HTML_INVALID)); |
464 } | 465 } |
465 | 466 |
466 Browser* browser = BrowserList::GetLastActive(); | 467 Browser* browser = BrowserList::GetLastActive(); |
467 // Sanity checks. | 468 // Sanity checks. |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 BugReportUIHTMLSource* html_source = | 689 BugReportUIHTMLSource* html_source = |
689 new BugReportUIHTMLSource(handler->Init()); | 690 new BugReportUIHTMLSource(handler->Init()); |
690 // Set up the chrome://bugreport/ source. | 691 // Set up the chrome://bugreport/ source. |
691 ChromeThread::PostTask( | 692 ChromeThread::PostTask( |
692 ChromeThread::IO, FROM_HERE, | 693 ChromeThread::IO, FROM_HERE, |
693 NewRunnableMethod( | 694 NewRunnableMethod( |
694 Singleton<ChromeURLDataManager>::get(), | 695 Singleton<ChromeURLDataManager>::get(), |
695 &ChromeURLDataManager::AddDataSource, | 696 &ChromeURLDataManager::AddDataSource, |
696 make_scoped_refptr(html_source))); | 697 make_scoped_refptr(html_source))); |
697 } | 698 } |
OLD | NEW |