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

Side by Side Diff: chrome/browser/dom_ui/bug_report_ui.cc

Issue 6461024: Revert 74292 - Splits ChromeURLDataManager into 2 chunks:... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 10 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/dom_ui/bookmarks_ui.cc ('k') | chrome/browser/dom_ui/chrome_url_data_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/dom_ui/bug_report_ui.h" 5 #include "chrome/browser/dom_ui/bug_report_ui.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/singleton.h" 14 #include "base/singleton.h"
15 #include "base/string_number_conversions.h" 15 #include "base/string_number_conversions.h"
16 #include "base/string_piece.h" 16 #include "base/string_piece.h"
17 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
18 #include "base/values.h" 18 #include "base/values.h"
19 #include "base/weak_ptr.h" 19 #include "base/weak_ptr.h"
20 #include "chrome/browser/browser_thread.h" 20 #include "chrome/browser/browser_thread.h"
21 #include "chrome/browser/bug_report_data.h" 21 #include "chrome/browser/bug_report_data.h"
22 #include "chrome/browser/bug_report_util.h" 22 #include "chrome/browser/bug_report_util.h"
23 #include "chrome/browser/dom_ui/web_ui_screenshot_source.h" 23 #include "chrome/browser/dom_ui/web_ui_screenshot_source.h"
24 #include "chrome/browser/profiles/profile.h"
25 #include "chrome/browser/tab_contents/tab_contents.h" 24 #include "chrome/browser/tab_contents/tab_contents.h"
26 #include "chrome/browser/ui/browser.h" 25 #include "chrome/browser/ui/browser.h"
27 #include "chrome/browser/ui/browser_list.h" 26 #include "chrome/browser/ui/browser_list.h"
28 #include "chrome/browser/ui/browser_window.h" 27 #include "chrome/browser/ui/browser_window.h"
29 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" 28 #include "chrome/browser/ui/window_snapshot/window_snapshot.h"
30 #include "chrome/common/chrome_paths.h" 29 #include "chrome/common/chrome_paths.h"
31 #include "chrome/common/jstemplate_builder.h" 30 #include "chrome/common/jstemplate_builder.h"
32 #include "chrome/common/url_constants.h" 31 #include "chrome/common/url_constants.h"
33 #include "grit/browser_resources.h" 32 #include "grit/browser_resources.h"
34 #include "grit/chromium_strings.h" 33 #include "grit/chromium_strings.h"
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 delete this; 425 delete this;
427 } 426 }
428 427
429 428
430 //////////////////////////////////////////////////////////////////////////////// 429 ////////////////////////////////////////////////////////////////////////////////
431 // 430 //
432 // BugReportHandler 431 // BugReportHandler
433 // 432 //
434 //////////////////////////////////////////////////////////////////////////////// 433 ////////////////////////////////////////////////////////////////////////////////
435 BugReportHandler::BugReportHandler(TabContents* tab) 434 BugReportHandler::BugReportHandler(TabContents* tab)
436 : tab_(tab), 435 : tab_(tab)
437 screenshot_source_(NULL), 436 , screenshot_source_(NULL)
438 bug_report_(NULL) 437 , bug_report_(NULL)
439 #if defined(OS_CHROMEOS) 438 #if defined(OS_CHROMEOS)
440 , syslogs_handle_(0) 439 , syslogs_handle_(0)
441 #endif 440 #endif
442 { 441 {
443 } 442 }
444 443
445 BugReportHandler::~BugReportHandler() { 444 BugReportHandler::~BugReportHandler() {
446 // Just in case we didn't send off bug_report_ to SendReport 445 // Just in case we didn't send off bug_report_ to SendReport
447 if (bug_report_) { 446 if (bug_report_) {
448 // If we're deleting the report object, cancel feedback collection first 447 // If we're deleting the report object, cancel feedback collection first
449 CancelFeedbackCollection(); 448 CancelFeedbackCollection();
450 delete bug_report_; 449 delete bug_report_;
451 } 450 }
452 } 451 }
453 452
454 void BugReportHandler::ClobberScreenshotsSource() { 453 void BugReportHandler::ClobberScreenshotsSource() {
455 // Re-create our screenshots data source (this clobbers the last source) 454 // Re-create our screenshots data source (this clobbers the last source)
456 // setting the screenshot to NULL, effectively disabling the source 455 // setting the screenshot to NULL, effectively disabling the source
457 // TODO(rkc): Once there is a method to 'remove' a source, change this code 456 // TODO(rkc): Once there is a method to 'remove' a source, change this code
458 tab_->profile()->GetChromeURLDataManager()->AddDataSource( 457 BrowserThread::PostTask(
459 new WebUIScreenshotSource(NULL)); 458 BrowserThread::IO, FROM_HERE,
459 NewRunnableMethod(
460 ChromeURLDataManager::GetInstance(),
461 &ChromeURLDataManager::AddDataSource,
462 make_scoped_refptr(new WebUIScreenshotSource(NULL))));
460 463
461 // clobber last screenshot 464 // clobber last screenshot
462 if (browser::last_screenshot_png) 465 if (browser::last_screenshot_png)
463 browser::last_screenshot_png->clear(); 466 browser::last_screenshot_png->clear();
464 } 467 }
465 468
466 void BugReportHandler::SetupScreenshotsSource() { 469 void BugReportHandler::SetupScreenshotsSource() {
467 // If we don't already have a screenshot source object created, create one. 470 // If we don't already have a screenshot source object created, create one.
468 if (!screenshot_source_) 471 if (!screenshot_source_)
469 screenshot_source_ = new WebUIScreenshotSource( 472 screenshot_source_ = new WebUIScreenshotSource(
470 browser::last_screenshot_png); 473 browser::last_screenshot_png);
471 474
472 // Add the source to the data manager. 475 // Add the source to the data manager.
473 tab_->profile()->GetChromeURLDataManager()->AddDataSource(screenshot_source_); 476 BrowserThread::PostTask(
477 BrowserThread::IO, FROM_HERE,
478 NewRunnableMethod(
479 ChromeURLDataManager::GetInstance(),
480 &ChromeURLDataManager::AddDataSource,
481 make_scoped_refptr(screenshot_source_)));
474 } 482 }
475 483
476 WebUIMessageHandler* BugReportHandler::Attach(DOMUI* dom_ui) { 484 WebUIMessageHandler* BugReportHandler::Attach(DOMUI* dom_ui) {
477 SetupScreenshotsSource(); 485 SetupScreenshotsSource();
478 return WebUIMessageHandler::Attach(dom_ui); 486 return WebUIMessageHandler::Attach(dom_ui);
479 } 487 }
480 488
481 base::StringPiece BugReportHandler::Init() { 489 base::StringPiece BugReportHandler::Init() {
482 std::string page_url; 490 std::string page_url;
483 if (tab_->controller().GetActiveEntry()) { 491 if (tab_->controller().GetActiveEntry()) {
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 //////////////////////////////////////////////////////////////////////////////// 742 ////////////////////////////////////////////////////////////////////////////////
735 BugReportUI::BugReportUI(TabContents* tab) : HtmlDialogUI(tab) { 743 BugReportUI::BugReportUI(TabContents* tab) : HtmlDialogUI(tab) {
736 BugReportHandler* handler = new BugReportHandler(tab); 744 BugReportHandler* handler = new BugReportHandler(tab);
737 AddMessageHandler((handler)->Attach(this)); 745 AddMessageHandler((handler)->Attach(this));
738 746
739 // The handler's init will specify which html 747 // The handler's init will specify which html
740 // resource we'll display to the user 748 // resource we'll display to the user
741 BugReportUIHTMLSource* html_source = 749 BugReportUIHTMLSource* html_source =
742 new BugReportUIHTMLSource(handler->Init()); 750 new BugReportUIHTMLSource(handler->Init());
743 // Set up the chrome://bugreport/ source. 751 // Set up the chrome://bugreport/ source.
744 tab->profile()->GetChromeURLDataManager()->AddDataSource(html_source); 752 BrowserThread::PostTask(
753 BrowserThread::IO, FROM_HERE,
754 NewRunnableMethod(
755 ChromeURLDataManager::GetInstance(),
756 &ChromeURLDataManager::AddDataSource,
757 make_scoped_refptr(html_source)));
745 } 758 }
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/bookmarks_ui.cc ('k') | chrome/browser/dom_ui/chrome_url_data_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698