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/callback.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" |
| 11 #include "base/callback_old.h" |
10 #include "base/logging.h" | 12 #include "base/logging.h" |
11 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
12 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
13 #include "base/string_number_conversions.h" | 15 #include "base/string_number_conversions.h" |
14 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
15 #include "base/values.h" | 17 #include "base/values.h" |
16 #include "chrome/browser/bug_report_data.h" | 18 #include "chrome/browser/bug_report_data.h" |
17 #include "chrome/browser/bug_report_util.h" | 19 #include "chrome/browser/bug_report_util.h" |
18 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/ui/browser.h" | 21 #include "chrome/browser/ui/browser.h" |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 } | 382 } |
381 | 383 |
382 // Setup the screenshot source after we've verified input is legit. | 384 // Setup the screenshot source after we've verified input is legit. |
383 SetupScreenshotsSource(); | 385 SetupScreenshotsSource(); |
384 | 386 |
385 return true; | 387 return true; |
386 } | 388 } |
387 | 389 |
388 void BugReportHandler::RegisterMessages() { | 390 void BugReportHandler::RegisterMessages() { |
389 web_ui_->RegisterMessageCallback("getDialogDefaults", | 391 web_ui_->RegisterMessageCallback("getDialogDefaults", |
390 NewCallback(this, &BugReportHandler::HandleGetDialogDefaults)); | 392 base::Bind(&BugReportHandler::HandleGetDialogDefaults, |
| 393 base::Unretained(this))); |
391 web_ui_->RegisterMessageCallback("refreshCurrentScreenshot", | 394 web_ui_->RegisterMessageCallback("refreshCurrentScreenshot", |
392 NewCallback(this, &BugReportHandler::HandleRefreshCurrentScreenshot)); | 395 base::Bind(&BugReportHandler::HandleRefreshCurrentScreenshot, |
| 396 base::Unretained(this))); |
393 #if defined(OS_CHROMEOS) | 397 #if defined(OS_CHROMEOS) |
394 web_ui_->RegisterMessageCallback("refreshSavedScreenshots", | 398 web_ui_->RegisterMessageCallback("refreshSavedScreenshots", |
395 NewCallback(this, &BugReportHandler::HandleRefreshSavedScreenshots)); | 399 base::Bind(&BugReportHandler::HandleRefreshSavedScreenshots, |
| 400 base::Unretained(this))); |
396 #endif | 401 #endif |
397 web_ui_->RegisterMessageCallback("sendReport", | 402 web_ui_->RegisterMessageCallback("sendReport", |
398 NewCallback(this, &BugReportHandler::HandleSendReport)); | 403 base::Bind(&BugReportHandler::HandleSendReport, |
| 404 base::Unretained(this))); |
399 web_ui_->RegisterMessageCallback("cancel", | 405 web_ui_->RegisterMessageCallback("cancel", |
400 NewCallback(this, &BugReportHandler::HandleCancel)); | 406 base::Bind(&BugReportHandler::HandleCancel, |
| 407 base::Unretained(this))); |
401 web_ui_->RegisterMessageCallback("openSystemTab", | 408 web_ui_->RegisterMessageCallback("openSystemTab", |
402 NewCallback(this, &BugReportHandler::HandleOpenSystemTab)); | 409 base::Bind(&BugReportHandler::HandleOpenSystemTab, |
| 410 base::Unretained(this))); |
403 } | 411 } |
404 | 412 |
405 void BugReportHandler::HandleGetDialogDefaults(const ListValue*) { | 413 void BugReportHandler::HandleGetDialogDefaults(const ListValue*) { |
406 // Will delete itself when bug_report_data_->SendReport() is called. | 414 // Will delete itself when bug_report_data_->SendReport() is called. |
407 bug_report_data_ = new BugReportData(); | 415 bug_report_data_ = new BugReportData(); |
408 | 416 |
409 // send back values which the dialog js needs initially | 417 // send back values which the dialog js needs initially |
410 ListValue dialog_defaults; | 418 ListValue dialog_defaults; |
411 | 419 |
412 // 0: current url | 420 // 0: current url |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 AddMessageHandler((handler)->Attach(this)); | 615 AddMessageHandler((handler)->Attach(this)); |
608 | 616 |
609 // The handler's init will determine whether we show the error html page. | 617 // The handler's init will determine whether we show the error html page. |
610 ChromeWebUIDataSource* html_source = | 618 ChromeWebUIDataSource* html_source = |
611 CreateBugReportUIHTMLSource(handler->Init()); | 619 CreateBugReportUIHTMLSource(handler->Init()); |
612 | 620 |
613 // Set up the chrome://bugreport/ source. | 621 // Set up the chrome://bugreport/ source. |
614 Profile* profile = Profile::FromBrowserContext(tab->browser_context()); | 622 Profile* profile = Profile::FromBrowserContext(tab->browser_context()); |
615 profile->GetChromeURLDataManager()->AddDataSource(html_source); | 623 profile->GetChromeURLDataManager()->AddDataSource(html_source); |
616 } | 624 } |
OLD | NEW |