| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/bug_report_view.h" | 5 #include "chrome/browser/views/bug_report_view.h" |
| 6 | 6 |
| 7 #include <string> |
| 8 #include <vector> |
| 9 |
| 7 #include "app/combobox_model.h" | 10 #include "app/combobox_model.h" |
| 8 #include "app/l10n_util.h" | 11 #include "app/l10n_util.h" |
| 9 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 13 #include "base/file_util.h" |
| 11 #include "base/file_version_info.h" | 14 #include "base/file_version_info.h" |
| 12 #include "base/path_service.h" | 15 #include "base/path_service.h" |
| 13 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
| 14 #include "base/waitable_event.h" | 17 #include "base/waitable_event.h" |
| 15 #include "chrome/app/chrome_version_info.h" | |
| 16 #include "chrome/browser/bug_report_util.h" | 18 #include "chrome/browser/bug_report_util.h" |
| 17 #include "chrome/browser/pref_service.h" | 19 #include "chrome/browser/pref_service.h" |
| 18 #include "chrome/browser/profile.h" | 20 #include "chrome/browser/profile.h" |
| 19 #include "chrome/browser/browser_list.h" | 21 #include "chrome/browser/browser_list.h" |
| 20 #include "chrome/browser/chrome_thread.h" | 22 #include "chrome/browser/chrome_thread.h" |
| 21 #include "chrome/browser/safe_browsing/safe_browsing_util.h" | 23 #include "chrome/browser/safe_browsing/safe_browsing_util.h" |
| 22 #include "chrome/browser/tab_contents/navigation_controller.h" | 24 #include "chrome/browser/tab_contents/navigation_controller.h" |
| 23 #include "chrome/browser/tab_contents/navigation_entry.h" | 25 #include "chrome/browser/tab_contents/navigation_entry.h" |
| 24 #include "chrome/browser/tab_contents/tab_contents.h" | 26 #include "chrome/browser/tab_contents/tab_contents.h" |
| 25 #include "chrome/common/chrome_paths.h" | 27 #include "chrome/common/chrome_paths.h" |
| 28 #include "chrome/common/chrome_version_info.h" |
| 26 #include "chrome/common/net/url_fetcher.h" | 29 #include "chrome/common/net/url_fetcher.h" |
| 27 #include "chrome/common/pref_names.h" | 30 #include "chrome/common/pref_names.h" |
| 28 #include "chrome/common/url_constants.h" | 31 #include "chrome/common/url_constants.h" |
| 29 #include "grit/chromium_strings.h" | 32 #include "grit/chromium_strings.h" |
| 30 #include "grit/generated_resources.h" | 33 #include "grit/generated_resources.h" |
| 31 #include "grit/locale_settings.h" | 34 #include "grit/locale_settings.h" |
| 32 #include "net/base/escape.h" | 35 #include "net/base/escape.h" |
| 33 #include "unicode/locid.h" | 36 #include "unicode/locid.h" |
| 34 #include "views/controls/button/checkbox.h" | 37 #include "views/controls/button/checkbox.h" |
| 35 #include "views/controls/label.h" | 38 #include "views/controls/label.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 task_waitable.Wait(); | 187 task_waitable.Wait(); |
| 185 if (*image_str == "") | 188 if (*image_str == "") |
| 186 return false; | 189 return false; |
| 187 else | 190 else |
| 188 return true; | 191 return true; |
| 189 #else | 192 #else |
| 190 return false; | 193 return false; |
| 191 #endif | 194 #endif |
| 192 } | 195 } |
| 193 | 196 |
| 194 } // namespace | 197 } // namespace |
| 195 | 198 |
| 196 namespace browser { | 199 namespace browser { |
| 197 | 200 |
| 198 // Global "display this dialog" function declared in browser_dialogs.h. | 201 // Global "display this dialog" function declared in browser_dialogs.h. |
| 199 void ShowBugReportView(views::Window* parent, | 202 void ShowBugReportView(views::Window* parent, |
| 200 Profile* profile, | 203 Profile* profile, |
| 201 TabContents* tab) { | 204 TabContents* tab) { |
| 202 BugReportView* view = new BugReportView(profile, tab); | 205 BugReportView* view = new BugReportView(profile, tab); |
| 203 | 206 |
| 204 // Get the size of the parent window to capture screenshot dimensions | 207 // Get the size of the parent window to capture screenshot dimensions |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 user_email_text_->SetText(UTF8ToUTF16(std::string(""))); | 272 user_email_text_->SetText(UTF8ToUTF16(std::string(""))); |
| 270 } else { | 273 } else { |
| 271 const std::string& email = manager->logged_in_user().email(); | 274 const std::string& email = manager->logged_in_user().email(); |
| 272 user_email_text_->SetText(UTF8ToUTF16(email)); | 275 user_email_text_->SetText(UTF8ToUTF16(email)); |
| 273 if (!email.empty()) | 276 if (!email.empty()) |
| 274 user_email_text_->SetEnabled(false); | 277 user_email_text_->SetEnabled(false); |
| 275 } | 278 } |
| 276 #endif | 279 #endif |
| 277 | 280 |
| 278 // Retrieve the application version info. | 281 // Retrieve the application version info. |
| 279 scoped_ptr<FileVersionInfo> version_info( | 282 scoped_ptr<FileVersionInfo> version_info(chrome::GetChromeVersionInfo()); |
| 280 chrome_app::GetChromeVersionInfo()); | |
| 281 if (version_info.get()) { | 283 if (version_info.get()) { |
| 282 version_ = version_info->product_name() + L" - " + | 284 version_ = version_info->product_name() + L" - " + |
| 283 version_info->file_version() + | 285 version_info->file_version() + |
| 284 L" (" + version_info->last_change() + L")"; | 286 L" (" + version_info->last_change() + L")"; |
| 285 } | 287 } |
| 286 | 288 |
| 287 | 289 |
| 288 FilePath tmpfilename; | 290 FilePath tmpfilename; |
| 289 | 291 |
| 290 #if defined(OS_CHROMEOS) | 292 #if defined(OS_CHROMEOS) |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 } | 450 } |
| 449 | 451 |
| 450 gfx::Size BugReportView::GetPreferredSize() { | 452 gfx::Size BugReportView::GetPreferredSize() { |
| 451 gfx::Size size = views::Window::GetLocalizedContentsSize( | 453 gfx::Size size = views::Window::GetLocalizedContentsSize( |
| 452 IDS_BUGREPORT_DIALOG_WIDTH_CHARS, | 454 IDS_BUGREPORT_DIALOG_WIDTH_CHARS, |
| 453 #if defined(OS_CHROMEOS) | 455 #if defined(OS_CHROMEOS) |
| 454 IDS_CHROMEOS_BUGREPORT_DIALOG_HEIGHT_LINES); | 456 IDS_CHROMEOS_BUGREPORT_DIALOG_HEIGHT_LINES); |
| 455 #else | 457 #else |
| 456 IDS_BUGREPORT_DIALOG_HEIGHT_LINES); | 458 IDS_BUGREPORT_DIALOG_HEIGHT_LINES); |
| 457 #endif | 459 #endif |
| 458 return size; | 460 return size; |
| 459 } | 461 } |
| 460 | 462 |
| 461 void BugReportView::UpdateReportingControls(bool is_phishing_report) { | 463 void BugReportView::UpdateReportingControls(bool is_phishing_report) { |
| 462 // page source, screen/page images, system information | 464 // page source, screen/page images, system information |
| 463 // are not needed if it's a phishing report | 465 // are not needed if it's a phishing report |
| 464 | 466 |
| 465 include_page_source_checkbox_->SetEnabled(!is_phishing_report); | 467 include_page_source_checkbox_->SetEnabled(!is_phishing_report); |
| 466 include_page_source_checkbox_->SetChecked(!is_phishing_report); | 468 include_page_source_checkbox_->SetChecked(!is_phishing_report); |
| 467 | 469 |
| 468 #if defined(OS_CHROMEOS) | 470 #if defined(OS_CHROMEOS) |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 Browser* browser = BrowserList::GetLastActive(); | 618 Browser* browser = BrowserList::GetLastActive(); |
| 617 if (browser) | 619 if (browser) |
| 618 browser->OpenURL(url, GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK); | 620 browser->OpenURL(url, GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK); |
| 619 } | 621 } |
| 620 #endif | 622 #endif |
| 621 | 623 |
| 622 | 624 |
| 623 views::View* BugReportView::GetContentsView() { | 625 views::View* BugReportView::GetContentsView() { |
| 624 return this; | 626 return this; |
| 625 } | 627 } |
| OLD | NEW |