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/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 |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 } | 504 } |
505 } | 505 } |
506 | 506 |
507 void BugReportHandler::ClobberScreenshotsSource() { | 507 void BugReportHandler::ClobberScreenshotsSource() { |
508 // Re-create our screenshots data source (this clobbers the last source) | 508 // Re-create our screenshots data source (this clobbers the last source) |
509 // setting the screenshot to NULL, effectively disabling the source | 509 // setting the screenshot to NULL, effectively disabling the source |
510 // TODO(rkc): Once there is a method to 'remove' a source, change this code | 510 // TODO(rkc): Once there is a method to 'remove' a source, change this code |
511 BrowserThread::PostTask( | 511 BrowserThread::PostTask( |
512 BrowserThread::IO, FROM_HERE, | 512 BrowserThread::IO, FROM_HERE, |
513 NewRunnableMethod( | 513 NewRunnableMethod( |
514 Singleton<ChromeURLDataManager>::get(), | 514 ChromeURLDataManager::GetInstance(), |
515 &ChromeURLDataManager::AddDataSource, | 515 &ChromeURLDataManager::AddDataSource, |
516 make_scoped_refptr(new DOMUIScreenshotSource(NULL)))); | 516 make_scoped_refptr(new DOMUIScreenshotSource(NULL)))); |
517 | 517 |
518 // clobber last screenshot | 518 // clobber last screenshot |
519 if (browser::last_screenshot_png) | 519 if (browser::last_screenshot_png) |
520 browser::last_screenshot_png->clear(); | 520 browser::last_screenshot_png->clear(); |
521 } | 521 } |
522 | 522 |
523 void BugReportHandler::SetupScreenshotsSource() { | 523 void BugReportHandler::SetupScreenshotsSource() { |
524 // If we don't already have a screenshot source object created, create one. | 524 // If we don't already have a screenshot source object created, create one. |
525 if (!screenshot_source_) | 525 if (!screenshot_source_) |
526 screenshot_source_ = new DOMUIScreenshotSource( | 526 screenshot_source_ = new DOMUIScreenshotSource( |
527 browser::last_screenshot_png); | 527 browser::last_screenshot_png); |
528 | 528 |
529 // Add the source to the data manager. | 529 // Add the source to the data manager. |
530 BrowserThread::PostTask( | 530 BrowserThread::PostTask( |
531 BrowserThread::IO, FROM_HERE, | 531 BrowserThread::IO, FROM_HERE, |
532 NewRunnableMethod( | 532 NewRunnableMethod( |
533 Singleton<ChromeURLDataManager>::get(), | 533 ChromeURLDataManager::GetInstance(), |
534 &ChromeURLDataManager::AddDataSource, | 534 &ChromeURLDataManager::AddDataSource, |
535 make_scoped_refptr(screenshot_source_))); | 535 make_scoped_refptr(screenshot_source_))); |
536 } | 536 } |
537 | 537 |
538 DOMMessageHandler* BugReportHandler::Attach(DOMUI* dom_ui) { | 538 DOMMessageHandler* BugReportHandler::Attach(DOMUI* dom_ui) { |
539 SetupScreenshotsSource(); | 539 SetupScreenshotsSource(); |
540 return DOMMessageHandler::Attach(dom_ui); | 540 return DOMMessageHandler::Attach(dom_ui); |
541 } | 541 } |
542 | 542 |
543 base::StringPiece BugReportHandler::Init() { | 543 base::StringPiece BugReportHandler::Init() { |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 AddMessageHandler((handler)->Attach(this)); | 796 AddMessageHandler((handler)->Attach(this)); |
797 | 797 |
798 // The handler's init will specify which html | 798 // The handler's init will specify which html |
799 // resource we'll display to the user | 799 // resource we'll display to the user |
800 BugReportUIHTMLSource* html_source = | 800 BugReportUIHTMLSource* html_source = |
801 new BugReportUIHTMLSource(handler->Init()); | 801 new BugReportUIHTMLSource(handler->Init()); |
802 // Set up the chrome://bugreport/ source. | 802 // Set up the chrome://bugreport/ source. |
803 BrowserThread::PostTask( | 803 BrowserThread::PostTask( |
804 BrowserThread::IO, FROM_HERE, | 804 BrowserThread::IO, FROM_HERE, |
805 NewRunnableMethod( | 805 NewRunnableMethod( |
806 Singleton<ChromeURLDataManager>::get(), | 806 ChromeURLDataManager::GetInstance(), |
807 &ChromeURLDataManager::AddDataSource, | 807 &ChromeURLDataManager::AddDataSource, |
808 make_scoped_refptr(html_source))); | 808 make_scoped_refptr(html_source))); |
809 } | 809 } |
OLD | NEW |