Commit c70f4175 authored by rkc@google.com's avatar rkc@google.com

Change the path used to refer to tabs to a reference.

ShowSingletonTab considers only base URL's as unique; adding a /path opens another tab despite one being present at the base URL; changing the path to a ref fixes it.

Review URL: http://codereview.chromium.org/3155038

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57090 0039d316-1c4b-4281-b951-d872f2087c98
parent 94d5f1dc
...@@ -165,7 +165,7 @@ void RefreshLastScreenshot(views::Window* parent) { ...@@ -165,7 +165,7 @@ void RefreshLastScreenshot(views::Window* parent) {
// Global "display this dialog" function declared in browser_dialogs.h. // Global "display this dialog" function declared in browser_dialogs.h.
void ShowHtmlBugReportView(views::Window* parent, Browser* browser) { void ShowHtmlBugReportView(views::Window* parent, Browser* browser) {
std::string bug_report_url = std::string(chrome::kChromeUIBugReportURL) + std::string bug_report_url = std::string(chrome::kChromeUIBugReportURL) +
base::IntToString(browser->selected_index()); "#" + base::IntToString(browser->selected_index());
RefreshLastScreenshot(parent); RefreshLastScreenshot(parent);
browser->ShowSingletonTab(GURL(bug_report_url)); browser->ShowSingletonTab(GURL(bug_report_url));
...@@ -424,10 +424,11 @@ base::StringPiece BugReportHandler::Init() { ...@@ -424,10 +424,11 @@ base::StringPiece BugReportHandler::Init() {
} }
std::string params = page_url.substr(strlen(chrome::kChromeUIBugReportURL)); std::string params = page_url.substr(strlen(chrome::kChromeUIBugReportURL));
// Erase the # - the first character.
params.erase(params.begin(),params.begin() + 1);
int index = 0; int index = 0;
if (!base::StringToInt(params, &index)) { if (!base::StringToInt(params, &index)) {
ClobberScreenshotsSource();
return base::StringPiece( return base::StringPiece(
ResourceBundle::GetSharedInstance().GetRawDataResource( ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_BUGREPORT_HTML_INVALID)); IDR_BUGREPORT_HTML_INVALID));
...@@ -435,7 +436,6 @@ base::StringPiece BugReportHandler::Init() { ...@@ -435,7 +436,6 @@ base::StringPiece BugReportHandler::Init() {
// Sanity checks. // Sanity checks.
if (((index == 0) && (params != "0")) || (index >= browser_->tab_count())) { if (((index == 0) && (params != "0")) || (index >= browser_->tab_count())) {
ClobberScreenshotsSource();
return base::StringPiece( return base::StringPiece(
ResourceBundle::GetSharedInstance().GetRawDataResource( ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_BUGREPORT_HTML_INVALID)); IDR_BUGREPORT_HTML_INVALID));
...@@ -446,6 +446,9 @@ base::StringPiece BugReportHandler::Init() { ...@@ -446,6 +446,9 @@ base::StringPiece BugReportHandler::Init() {
else else
LOG(FATAL) << "Failed to get last active browser."; LOG(FATAL) << "Failed to get last active browser.";
// Setup the screenshot source after we've verified input is legit.
SetupScreenshotsSource();
return base::StringPiece( return base::StringPiece(
ResourceBundle::GetSharedInstance().GetRawDataResource( ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_BUGREPORT_HTML)); IDR_BUGREPORT_HTML));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment