Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: chrome/browser/views/bug_report_view.cc

Issue 3061044: HTML UI implementation for the Google Feedback client for Chrome/ChromeOS.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/views/bug_report_view.h ('k') | chrome/browser/views/frame/browser_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/views/bug_report_view.h"
6
7 #include <string>
8 #include <vector>
9
10 #include "app/combobox_model.h"
11 #include "app/l10n_util.h"
12 #include "base/file_path.h"
13 #include "base/file_util.h"
14 #include "base/file_version_info.h"
15 #include "base/path_service.h"
16 #include "base/utf_string_conversions.h"
17 #include "base/waitable_event.h"
18 #include "chrome/browser/bug_report_util.h"
19 #include "chrome/browser/pref_service.h"
20 #include "chrome/browser/profile.h"
21 #include "chrome/browser/browser_list.h"
22 #include "chrome/browser/chrome_thread.h"
23 #include "chrome/browser/safe_browsing/safe_browsing_util.h"
24 #include "chrome/browser/tab_contents/navigation_controller.h"
25 #include "chrome/browser/tab_contents/navigation_entry.h"
26 #include "chrome/browser/tab_contents/tab_contents.h"
27 #include "chrome/common/chrome_paths.h"
28 #include "chrome/common/chrome_version_info.h"
29 #include "chrome/common/net/url_fetcher.h"
30 #include "chrome/common/pref_names.h"
31 #include "chrome/common/url_constants.h"
32 #include "grit/chromium_strings.h"
33 #include "grit/generated_resources.h"
34 #include "grit/locale_settings.h"
35 #include "net/base/escape.h"
36 #include "unicode/locid.h"
37 #include "views/controls/button/checkbox.h"
38 #include "views/controls/label.h"
39 #include "views/grid_layout.h"
40 #include "views/standard_layout.h"
41 #include "views/widget/widget.h"
42 #include "views/window/client_view.h"
43 #include "views/window/window.h"
44
45 #if defined(OS_LINUX)
46 #include "app/x11_util.h"
47 #else
48 #include "app/win_util.h"
49 #endif
50
51 #if defined(OS_CHROMEOS)
52 #include "chrome/browser/chromeos/login/user_manager.h"
53 #endif
54
55 using views::ColumnSet;
56 using views::GridLayout;
57
58 // Report a bug data version.
59 static const int kBugReportVersion = 1;
60 static const int kScreenImageRadioGroup = 2;
61 static const char kScreenshotsRelativePath[] = "/Screenshots";
62 static const char kScreenshotPattern[] = "*.png";
63
64 // Number of lines description field can display at one time.
65 static const int kDescriptionLines = 5;
66
67 class BugReportComboBoxModel : public ComboboxModel {
68 public:
69 BugReportComboBoxModel() {}
70
71 // ComboboxModel interface.
72 virtual int GetItemCount() {
73 return BugReportUtil::OTHER_PROBLEM + 1;
74 }
75
76 virtual std::wstring GetItemAt(int index) {
77 return GetItemAtIndex(index);
78 }
79
80 static std::wstring GetItemAtIndex(int index) {
81 #if defined(OS_CHROMEOS)
82 switch (index) {
83 case BugReportUtil::CONNECTIVITY_ISSUE:
84 return l10n_util::GetString(IDS_BUGREPORT_CONNECTIVITY_ISSUE);
85 case BugReportUtil::SYNC_ISSUE:
86 return l10n_util::GetString(IDS_BUGREPORT_SYNC_ISSUE);
87 case BugReportUtil::CRASH_ISSUE:
88 return l10n_util::GetString(IDS_BUGREPORT_CRASH_ISSUE);
89 case BugReportUtil::PAGE_FORMATTING:
90 return l10n_util::GetString(IDS_BUGREPORT_PAGE_FORMATTING);
91 case BugReportUtil::EXTENSION_ISSUE:
92 return l10n_util::GetString(IDS_BUGREPORT_EXTENSION_ISSUE);
93 case BugReportUtil::SUSPEND_ISSUE:
94 return l10n_util::GetString(IDS_BUGREPORT_SUSPEND_ISSUE);
95 case BugReportUtil::PHISHING_PAGE:
96 return l10n_util::GetString(IDS_BUGREPORT_PHISHING_PAGE);
97 case BugReportUtil::OTHER_PROBLEM:
98 return l10n_util::GetString(IDS_BUGREPORT_OTHER_PROBLEM);
99 default:
100 NOTREACHED();
101 return std::wstring();
102 }
103 #else
104 switch (index) {
105 case BugReportUtil::PAGE_WONT_LOAD:
106 return l10n_util::GetString(IDS_BUGREPORT_PAGE_WONT_LOAD);
107 case BugReportUtil::PAGE_LOOKS_ODD:
108 return l10n_util::GetString(IDS_BUGREPORT_PAGE_LOOKS_ODD);
109 case BugReportUtil::PHISHING_PAGE:
110 return l10n_util::GetString(IDS_BUGREPORT_PHISHING_PAGE);
111 case BugReportUtil::CANT_SIGN_IN:
112 return l10n_util::GetString(IDS_BUGREPORT_CANT_SIGN_IN);
113 case BugReportUtil::CHROME_MISBEHAVES:
114 return l10n_util::GetString(IDS_BUGREPORT_CHROME_MISBEHAVES);
115 case BugReportUtil::SOMETHING_MISSING:
116 return l10n_util::GetString(IDS_BUGREPORT_SOMETHING_MISSING);
117 case BugReportUtil::BROWSER_CRASH:
118 return l10n_util::GetString(IDS_BUGREPORT_BROWSER_CRASH);
119 case BugReportUtil::OTHER_PROBLEM:
120 return l10n_util::GetString(IDS_BUGREPORT_OTHER_PROBLEM);
121 default:
122 NOTREACHED();
123 return std::wstring();
124 }
125 #endif
126 }
127
128 private:
129 DISALLOW_COPY_AND_ASSIGN(BugReportComboBoxModel);
130 };
131
132 namespace {
133
134 #if defined(OS_CHROMEOS)
135 class LastScreenshotTask : public Task {
136 public:
137 LastScreenshotTask(std::string* image_str,
138 base::WaitableEvent* task_waitable)
139 : image_str_(image_str),
140 task_waitable_(task_waitable) {
141 }
142
143 private:
144 void Run() {
145 FilePath fileshelf_path;
146 // TODO(rkc): Change this to use FilePath.Append() once the cros
147 // issue with with it is fixed
148 if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS,
149 &fileshelf_path)) {
150 *image_str_ = "";
151 task_waitable_->Signal();
152 }
153
154 FilePath screenshots_path(fileshelf_path.value() +
155 std::string(kScreenshotsRelativePath));
156 file_util::FileEnumerator screenshots(screenshots_path, false,
157 file_util::FileEnumerator::FILES,
158 std::string(kScreenshotPattern));
159 FilePath screenshot = screenshots.Next();
160 FilePath latest("");
161 time_t last_mtime = 0;
162 while (!screenshot.empty()) {
163 file_util::FileEnumerator::FindInfo info;
164 screenshots.GetFindInfo(&info);
165 if (info.stat.st_mtime > last_mtime) {
166 last_mtime = info.stat.st_mtime;
167 latest = screenshot;
168 }
169 screenshot = screenshots.Next();
170 }
171
172 if (!file_util::ReadFileToString(latest, image_str_))
173 *image_str_ = "";
174 task_waitable_->Signal();
175 }
176 private:
177 std::string* image_str_;
178 base::WaitableEvent* task_waitable_;
179 };
180 #endif
181
182 bool GetLastScreenshot(std::string* image_str) {
183 #if defined(OS_CHROMEOS)
184 base::WaitableEvent task_waitable(true, false);
185 ChromeThread::PostTask(ChromeThread::FILE, FROM_HERE,
186 new LastScreenshotTask(image_str, &task_waitable));
187 task_waitable.Wait();
188 if (*image_str == "")
189 return false;
190 else
191 return true;
192 #else
193 return false;
194 #endif
195 }
196
197 } // namespace
198
199 namespace browser {
200
201 // Global "display this dialog" function declared in browser_dialogs.h.
202 void ShowBugReportView(views::Window* parent,
203 Profile* profile,
204 TabContents* tab) {
205 BugReportView* view = new BugReportView(profile, tab);
206
207 // Get the size of the parent window to capture screenshot dimensions
208 gfx::Rect screen_size = parent->GetBounds();
209 view->set_screen_size(screen_size);
210
211 // Grab an exact snapshot of the window that the user is seeing (i.e. as
212 // rendered--do not re-render, and include windowed plugins).
213 std::vector<unsigned char> *screenshot_png = new std::vector<unsigned char>;
214
215 #if defined(OS_LINUX)
216 x11_util::GrabWindowSnapshot(parent->GetNativeWindow(), screenshot_png);
217 #else
218 win_util::GrabWindowSnapshot(parent->GetNativeWindow(), screenshot_png);
219 #endif
220
221 // The BugReportView takes ownership of the image data, and will dispose of
222 // it in its destructor
223 view->set_captured_image(screenshot_png);
224
225 #if defined(OS_CHROMEOS)
226 // Get last screenshot taken
227 std::string image_str;
228 bool have_last_image = false;
229 if (GetLastScreenshot(&image_str)) {
230 // reuse screenshot_png; previous pointer now owned by BugReportView
231 screenshot_png = new std::vector<unsigned char>(image_str.begin(),
232 image_str.end());
233 have_last_image = true;
234 } else {
235 // else set it to be an empty vector
236 screenshot_png = new std::vector<unsigned char>;
237 }
238 view->set_last_image(screenshot_png);
239
240 // Create and show the dialog
241 views::Window::CreateChromeWindow(parent->GetNativeWindow(), gfx::Rect(),
242 view)->Show();
243 if (!have_last_image)
244 view->DisableLastImageRadio();
245 #endif
246 }
247
248 } // namespace browser
249
250 // BugReportView - create and submit a bug report from the user.
251 // This is separate from crash reporting, which is handled by Breakpad.
252 BugReportView::BugReportView(Profile* profile, TabContents* tab)
253 : include_page_source_checkbox_(NULL),
254 include_page_image_checkbox_(NULL),
255 profile_(profile),
256 tab_(tab),
257 problem_type_(0) {
258 DCHECK(profile);
259 SetupControl();
260
261 // We want to use the URL of the current committed entry (the current URL may
262 // actually be the pending one).
263 if (tab->controller().GetActiveEntry()) {
264 page_url_text_->SetText(UTF8ToUTF16(
265 tab->controller().GetActiveEntry()->url().spec()));
266 }
267
268 #if defined(OS_CHROMEOS)
269 // Get and set the gaia e-mail
270 chromeos::UserManager* manager = chromeos::UserManager::Get();
271 if (!manager) {
272 user_email_text_->SetText(UTF8ToUTF16(std::string("")));
273 } else {
274 const std::string& email = manager->logged_in_user().email();
275 user_email_text_->SetText(UTF8ToUTF16(email));
276 if (!email.empty())
277 user_email_text_->SetEnabled(false);
278 }
279 #endif
280
281 // Retrieve the application version info.
282 scoped_ptr<FileVersionInfo> version_info(chrome::GetChromeVersionInfo());
283 if (version_info.get()) {
284 version_ = version_info->product_name() + L" - " +
285 version_info->file_version() +
286 L" (" + version_info->last_change() + L")";
287 }
288
289
290 FilePath tmpfilename;
291
292 #if defined(OS_CHROMEOS)
293 chromeos::SyslogsLibrary* syslogs_lib =
294 chromeos::CrosLibrary::Get()->GetSyslogsLibrary();
295 if (syslogs_lib) {
296 sys_info_.reset(syslogs_lib->GetSyslogs(&tmpfilename));
297 }
298 #endif
299 }
300
301 BugReportView::~BugReportView() {
302 }
303
304 void BugReportView::SetupControl() {
305 bug_type_model_.reset(new BugReportComboBoxModel);
306
307 // Adds all controls.
308 bug_type_label_ = new views::Label(
309 l10n_util::GetString(IDS_BUGREPORT_BUG_TYPE));
310 bug_type_combo_ = new views::Combobox(bug_type_model_.get());
311 bug_type_combo_->set_listener(this);
312 bug_type_combo_->SetAccessibleName(bug_type_label_->GetText());
313
314 page_title_label_ = new views::Label(
315 l10n_util::GetString(IDS_BUGREPORT_REPORT_PAGE_TITLE));
316 page_title_text_ = new views::Label(UTF16ToWideHack(tab_->GetTitle()));
317 page_url_label_ = new views::Label(
318 l10n_util::GetString(IDS_BUGREPORT_REPORT_URL_LABEL));
319 // page_url_text_'s text (if any) is filled in after dialog creation.
320 page_url_text_ = new views::Textfield;
321 page_url_text_->SetController(this);
322 page_url_text_->SetAccessibleName(page_url_label_->GetText());
323
324 #if defined(OS_CHROMEOS)
325 user_email_label_ = new views::Label(
326 l10n_util::GetString(IDS_BUGREPORT_USER_EMAIL_LABEL));
327 // user_email_text_'s text (if any) is filled in after dialog creation.
328 user_email_text_ = new views::Textfield;
329 user_email_text_->SetController(this);
330 user_email_text_->SetAccessibleName(user_email_label_->GetText());
331 #endif
332
333 description_label_ = new views::Label(
334 l10n_util::GetString(IDS_BUGREPORT_DESCRIPTION_LABEL));
335 description_text_ =
336 new views::Textfield(views::Textfield::STYLE_MULTILINE);
337 description_text_->SetHeightInLines(kDescriptionLines);
338 description_text_->SetAccessibleName(description_label_->GetText());
339
340 include_page_source_checkbox_ = new views::Checkbox(
341 l10n_util::GetString(IDS_BUGREPORT_INCLUDE_PAGE_SOURCE_CHKBOX));
342 include_page_source_checkbox_->SetChecked(true);
343
344 #if defined(OS_CHROMEOS)
345 include_last_screen_image_radio_ = new views::RadioButton(
346 l10n_util::GetString(IDS_BUGREPORT_INCLUDE_LAST_SCREEN_IMAGE),
347 kScreenImageRadioGroup);
348
349 include_new_screen_image_radio_ = new views::RadioButton(
350 l10n_util::GetString(IDS_BUGREPORT_INCLUDE_NEW_SCREEN_IMAGE),
351 kScreenImageRadioGroup);
352
353 include_no_screen_image_radio_ = new views::RadioButton(
354 l10n_util::GetString(IDS_BUGREPORT_INCLUDE_NO_SCREEN_IMAGE),
355 kScreenImageRadioGroup);
356
357 system_information_url_control_ = new views::Link(
358 l10n_util::GetString(IDS_BUGREPORT_SYSTEM_INFORMATION_URL_TEXT));
359 system_information_url_control_->SetController(this);
360
361 include_new_screen_image_radio_->SetChecked(true);
362 #endif
363 include_page_image_checkbox_ = new views::Checkbox(
364 l10n_util::GetString(IDS_BUGREPORT_INCLUDE_PAGE_IMAGE_CHKBOX));
365 include_page_image_checkbox_->SetChecked(true);
366
367 // Arranges controls by using GridLayout.
368 const int column_set_id = 0;
369 GridLayout* layout = CreatePanelGridLayout(this);
370 SetLayoutManager(layout);
371 ColumnSet* column_set = layout->AddColumnSet(column_set_id);
372 column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 0,
373 GridLayout::USE_PREF, 0, 0);
374 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing * 2);
375 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1,
376 GridLayout::USE_PREF, 0, 0);
377
378 // Page Title and text.
379 layout->StartRow(0, column_set_id);
380 layout->AddView(page_title_label_);
381 layout->AddView(page_title_text_, 1, 1, GridLayout::LEADING,
382 GridLayout::FILL);
383 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
384
385 // Bug type and combo box.
386 layout->StartRow(0, column_set_id);
387 layout->AddView(bug_type_label_, 1, 1, GridLayout::LEADING, GridLayout::FILL);
388 layout->AddView(bug_type_combo_);
389 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
390
391 // Page URL and text field.
392 layout->StartRow(0, column_set_id);
393 layout->AddView(page_url_label_);
394 layout->AddView(page_url_text_);
395 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
396
397 // Description label and text field.
398 layout->StartRow(0, column_set_id);
399 layout->AddView(description_label_, 1, 1, GridLayout::LEADING,
400 GridLayout::LEADING);
401 layout->AddView(description_text_, 1, 1, GridLayout::FILL,
402 GridLayout::LEADING);
403 #if defined(OS_CHROMEOS)
404 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
405 // Page URL and text field.
406 layout->StartRow(0, column_set_id);
407 layout->AddView(user_email_label_);
408 layout->AddView(user_email_text_);
409 #endif
410 layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing);
411
412 // Checkboxes.
413 // The include page source checkbox is hidden until we can make it work.
414 // layout->StartRow(0, column_set_id);
415 // layout->SkipColumns(1);
416 // layout->AddView(include_page_source_checkbox_);
417 // layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
418 layout->StartRow(0, column_set_id);
419 layout->SkipColumns(1);
420 #if defined(OS_CHROMEOS)
421 // Radio boxes to select last screen shot or,
422
423 // new screenshot
424 layout->AddView(include_new_screen_image_radio_);
425 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
426 // last screenshot taken
427 layout->StartRow(0, column_set_id);
428 layout->SkipColumns(1);
429 layout->AddView(include_last_screen_image_radio_);
430 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
431 // no screenshot
432 layout->StartRow(0, column_set_id);
433 layout->SkipColumns(1);
434 layout->AddView(include_no_screen_image_radio_);
435 layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing);
436
437 layout->StartRow(0, column_set_id);
438 layout->SkipColumns(1);
439 layout->AddView(system_information_url_control_, 1, 1, GridLayout::LEADING,
440 GridLayout::CENTER);
441 #else
442 if (include_page_image_checkbox_) {
443 layout->StartRow(0, column_set_id);
444 layout->SkipColumns(1);
445 layout->AddView(include_page_image_checkbox_);
446 }
447 #endif
448
449 layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing);
450 }
451
452 gfx::Size BugReportView::GetPreferredSize() {
453 gfx::Size size = views::Window::GetLocalizedContentsSize(
454 IDS_BUGREPORT_DIALOG_WIDTH_CHARS,
455 #if defined(OS_CHROMEOS)
456 IDS_CHROMEOS_BUGREPORT_DIALOG_HEIGHT_LINES);
457 #else
458 IDS_BUGREPORT_DIALOG_HEIGHT_LINES);
459 #endif
460 return size;
461 }
462
463 void BugReportView::UpdateReportingControls(bool is_phishing_report) {
464 // page source, screen/page images, system information
465 // are not needed if it's a phishing report
466
467 include_page_source_checkbox_->SetEnabled(!is_phishing_report);
468 include_page_source_checkbox_->SetChecked(!is_phishing_report);
469
470 #if defined(OS_CHROMEOS)
471 include_new_screen_image_radio_->SetEnabled(!is_phishing_report);
472 if (!last_image_->empty())
473 include_last_screen_image_radio_->SetEnabled(!is_phishing_report);
474 include_no_screen_image_radio_->SetEnabled(!is_phishing_report);
475 #else
476 if (include_page_image_checkbox_) {
477 include_page_image_checkbox_->SetEnabled(!is_phishing_report);
478 include_page_image_checkbox_->SetChecked(!is_phishing_report);
479 }
480 #endif
481 }
482
483 void BugReportView::ItemChanged(views::Combobox* combobox,
484 int prev_index,
485 int new_index) {
486 if (new_index == prev_index)
487 return;
488
489 problem_type_ = new_index;
490 bool is_phishing_report = new_index == BugReportUtil::PHISHING_PAGE;
491
492 description_text_->SetEnabled(!is_phishing_report);
493 description_text_->SetReadOnly(is_phishing_report);
494 if (is_phishing_report) {
495 old_report_text_ = UTF16ToWide(description_text_->text());
496 description_text_->SetText(string16());
497 } else if (!old_report_text_.empty()) {
498 description_text_->SetText(WideToUTF16Hack(old_report_text_));
499 old_report_text_.clear();
500 }
501
502 UpdateReportingControls(is_phishing_report);
503 GetDialogClientView()->UpdateDialogButtons();
504 }
505
506 void BugReportView::ContentsChanged(views::Textfield* sender,
507 const string16& new_contents) {
508 }
509
510 bool BugReportView::HandleKeystroke(views::Textfield* sender,
511 const views::Textfield::Keystroke& key) {
512 return false;
513 }
514
515 std::wstring BugReportView::GetDialogButtonLabel(
516 MessageBoxFlags::DialogButton button) const {
517 if (button == MessageBoxFlags::DIALOGBUTTON_OK) {
518 if (problem_type_ == BugReportUtil::PHISHING_PAGE)
519 return l10n_util::GetString(IDS_BUGREPORT_SEND_PHISHING_REPORT);
520 else
521 return l10n_util::GetString(IDS_BUGREPORT_SEND_REPORT);
522 } else {
523 return std::wstring();
524 }
525 }
526
527 int BugReportView::GetDefaultDialogButton() const {
528 return MessageBoxFlags::DIALOGBUTTON_NONE;
529 }
530
531 bool BugReportView::CanResize() const {
532 return false;
533 }
534
535 bool BugReportView::CanMaximize() const {
536 return false;
537 }
538
539 bool BugReportView::IsAlwaysOnTop() const {
540 return false;
541 }
542
543 bool BugReportView::HasAlwaysOnTopMenu() const {
544 return false;
545 }
546
547 bool BugReportView::IsModal() const {
548 return true;
549 }
550
551 std::wstring BugReportView::GetWindowTitle() const {
552 return l10n_util::GetString(IDS_BUGREPORT_TITLE);
553 }
554
555
556 bool BugReportView::Accept() {
557 if (IsDialogButtonEnabled(MessageBoxFlags::DIALOGBUTTON_OK)) {
558 if (problem_type_ == BugReportUtil::PHISHING_PAGE) {
559 BugReportUtil::ReportPhishing(tab_,
560 UTF16ToUTF8(page_url_text_->text()));
561 } else {
562 char* image_data = NULL;
563 size_t image_data_size = 0;
564 #if defined(OS_CHROMEOS)
565 if (include_new_screen_image_radio_->checked() &&
566 !captured_image_->empty()) {
567 image_data = reinterpret_cast<char *>(&captured_image_->front());
568 image_data_size = captured_image_->size();
569 } else if (include_last_screen_image_radio_->checked() &&
570 !last_image_->empty()) {
571 image_data = reinterpret_cast<char *>(&last_image_->front());
572 image_data_size = last_image_->size();
573 }
574 #else
575 if (include_page_image_checkbox_->checked() && captured_image_.get() &&
576 !captured_image_->empty()) {
577 image_data = reinterpret_cast<char *>(&captured_image_->front());
578 image_data_size = captured_image_->size();
579 }
580 #endif
581 #if defined(OS_CHROMEOS)
582 BugReportUtil::SendReport(profile_,
583 WideToUTF8(page_title_text_->GetText()),
584 problem_type_,
585 UTF16ToUTF8(page_url_text_->text()),
586 UTF16ToUTF8(user_email_text_->text()),
587 UTF16ToUTF8(description_text_->text()),
588 image_data, image_data_size,
589 screen_size_.width(), screen_size_.height(),
590 WideToUTF8(bug_type_combo_->model()->GetItemAt(problem_type_)),
591 sys_info_.get());
592 #else
593 BugReportUtil::SendReport(profile_,
594 WideToUTF8(page_title_text_->GetText()),
595 problem_type_,
596 UTF16ToUTF8(page_url_text_->text()),
597 std::string(),
598 UTF16ToUTF8(description_text_->text()),
599 image_data, image_data_size,
600 screen_size_.width(), screen_size_.height());
601 #endif
602 }
603 }
604 return true;
605 }
606
607 #if defined(OS_CHROMEOS)
608 void BugReportView::LinkActivated(views::Link* source,
609 int event_flags) {
610 GURL url;
611 if (source == system_information_url_control_) {
612 url = GURL(chrome::kAboutSystemURL);
613 } else {
614 NOTREACHED() << "Unknown link source";
615 return;
616 }
617
618 Browser* browser = BrowserList::GetLastActive();
619 if (browser)
620 browser->OpenURL(url, GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK);
621 }
622 #endif
623
624
625 views::View* BugReportView::GetContentsView() {
626 return this;
627 }
OLDNEW
« no previous file with comments | « chrome/browser/views/bug_report_view.h ('k') | chrome/browser/views/frame/browser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698