| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // Do not refresh screenshot, do not create a new tab | 132 // Do not refresh screenshot, do not create a new tab |
| 133 browser->ActivateTabAt(feedback_tab_index, true); | 133 browser->ActivateTabAt(feedback_tab_index, true); |
| 134 return; | 134 return; |
| 135 } | 135 } |
| 136 | 136 |
| 137 std::vector<unsigned char>* last_screenshot_png = | 137 std::vector<unsigned char>* last_screenshot_png = |
| 138 BugReportUtil::GetScreenshotPng(); | 138 BugReportUtil::GetScreenshotPng(); |
| 139 last_screenshot_png->clear(); | 139 last_screenshot_png->clear(); |
| 140 | 140 |
| 141 gfx::NativeWindow native_window = browser->window()->GetNativeHandle(); | 141 gfx::NativeWindow native_window = browser->window()->GetNativeHandle(); |
| 142 BugReportUtil::SetScreenshotSize( | 142 gfx::Rect snapshot_bounds = gfx::Rect(browser->window()->GetBounds().size()); |
| 143 browser::GrabWindowSnapshot(native_window, last_screenshot_png)); | 143 bool success = browser::GrabWindowSnapshot(native_window, |
| 144 last_screenshot_png, |
| 145 snapshot_bounds); |
| 146 BugReportUtil::SetScreenshotSize(success ? snapshot_bounds : gfx::Rect()); |
| 144 | 147 |
| 145 std::string bug_report_url = std::string(chrome::kChromeUIBugReportURL) + | 148 std::string bug_report_url = std::string(chrome::kChromeUIBugReportURL) + |
| 146 "#" + base::IntToString(browser->active_index()) + | 149 "#" + base::IntToString(browser->active_index()) + |
| 147 "?description=" + net::EscapeUrlEncodedData(description_template, false) + | 150 "?description=" + net::EscapeUrlEncodedData(description_template, false) + |
| 148 "&issueType=" + base::IntToString(issue_type); | 151 "&issueType=" + base::IntToString(issue_type); |
| 149 browser->ShowSingletonTab(GURL(bug_report_url)); | 152 browser->ShowSingletonTab(GURL(bug_report_url)); |
| 150 } | 153 } |
| 151 | 154 |
| 152 } // namespace browser | 155 } // namespace browser |
| 153 | 156 |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 AddMessageHandler((handler)->Attach(this)); | 620 AddMessageHandler((handler)->Attach(this)); |
| 618 | 621 |
| 619 // The handler's init will determine whether we show the error html page. | 622 // The handler's init will determine whether we show the error html page. |
| 620 ChromeWebUIDataSource* html_source = | 623 ChromeWebUIDataSource* html_source = |
| 621 CreateBugReportUIHTMLSource(handler->Init()); | 624 CreateBugReportUIHTMLSource(handler->Init()); |
| 622 | 625 |
| 623 // Set up the chrome://bugreport/ source. | 626 // Set up the chrome://bugreport/ source. |
| 624 Profile* profile = Profile::FromBrowserContext(tab->browser_context()); | 627 Profile* profile = Profile::FromBrowserContext(tab->browser_context()); |
| 625 profile->GetChromeURLDataManager()->AddDataSource(html_source); | 628 profile->GetChromeURLDataManager()->AddDataSource(html_source); |
| 626 } | 629 } |
| OLD | NEW |