| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/settings/about_handler.h" | 5 #include "chrome/browser/ui/webui/settings/about_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "ash/system/chromeos/devicetype_utils.h" | 11 #include "ash/system/chromeos/devicetype_utils.h" |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 16 #include "base/files/file_util.h" | 16 #include "base/files/file_util.h" |
| 17 #include "base/i18n/message_formatter.h" | 17 #include "base/i18n/message_formatter.h" |
| 18 #include "base/location.h" | 18 #include "base/location.h" |
| 19 #include "base/macros.h" | 19 #include "base/macros.h" |
| 20 #include "base/strings/string16.h" | 20 #include "base/strings/string16.h" |
| 21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
| 22 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
| 23 #include "base/task_runner_util.h" | 23 #include "base/task_runner_util.h" |
| 24 #include "base/time/time.h" | 24 #include "base/time/time.h" |
| 25 #include "base/values.h" | 25 #include "base/values.h" |
| 26 #include "build/build_config.h" | 26 #include "build/build_config.h" |
| 27 #include "chrome/browser/browser_process.h" | 27 #include "chrome/browser/browser_process.h" |
| 28 #include "chrome/browser/chrome_notification_types.h" | 28 #include "chrome/browser/chrome_notification_types.h" |
| 29 #include "chrome/browser/lifetime/application_lifetime.h" | |
| 30 #include "chrome/browser/obsolete_system/obsolete_system.h" | 29 #include "chrome/browser/obsolete_system/obsolete_system.h" |
| 31 #include "chrome/browser/ui/browser.h" | 30 #include "chrome/browser/ui/browser.h" |
| 32 #include "chrome/browser/ui/browser_commands.h" | 31 #include "chrome/browser/ui/browser_commands.h" |
| 33 #include "chrome/browser/ui/browser_finder.h" | 32 #include "chrome/browser/ui/browser_finder.h" |
| 34 #include "chrome/browser/ui/chrome_pages.h" | 33 #include "chrome/browser/ui/chrome_pages.h" |
| 35 #include "chrome/common/channel_info.h" | 34 #include "chrome/common/channel_info.h" |
| 36 #include "chrome/common/chrome_content_client.h" | 35 #include "chrome/common/chrome_content_client.h" |
| 37 #include "chrome/common/pref_names.h" | 36 #include "chrome/common/pref_names.h" |
| 38 #include "chrome/common/url_constants.h" | 37 #include "chrome/common/url_constants.h" |
| 39 #include "chrome/grit/chromium_strings.h" | 38 #include "chrome/grit/chromium_strings.h" |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 | 321 |
| 323 void AboutHandler::RegisterMessages() { | 322 void AboutHandler::RegisterMessages() { |
| 324 web_ui()->RegisterMessageCallback( | 323 web_ui()->RegisterMessageCallback( |
| 325 "aboutPageReady", | 324 "aboutPageReady", |
| 326 base::Bind(&AboutHandler::HandlePageReady, base::Unretained(this))); | 325 base::Bind(&AboutHandler::HandlePageReady, base::Unretained(this))); |
| 327 web_ui()->RegisterMessageCallback( | 326 web_ui()->RegisterMessageCallback( |
| 328 "refreshUpdateStatus", | 327 "refreshUpdateStatus", |
| 329 base::Bind(&AboutHandler::HandleRefreshUpdateStatus, | 328 base::Bind(&AboutHandler::HandleRefreshUpdateStatus, |
| 330 base::Unretained(this))); | 329 base::Unretained(this))); |
| 331 web_ui()->RegisterMessageCallback( | 330 web_ui()->RegisterMessageCallback( |
| 332 "relaunchNow", | |
| 333 base::Bind(&AboutHandler::HandleRelaunchNow, base::Unretained(this))); | |
| 334 web_ui()->RegisterMessageCallback( | |
| 335 "openFeedbackDialog", base::Bind(&AboutHandler::HandleOpenFeedbackDialog, | 331 "openFeedbackDialog", base::Bind(&AboutHandler::HandleOpenFeedbackDialog, |
| 336 base::Unretained(this))); | 332 base::Unretained(this))); |
| 337 web_ui()->RegisterMessageCallback( | 333 web_ui()->RegisterMessageCallback( |
| 338 "openHelpPage", | 334 "openHelpPage", |
| 339 base::Bind(&AboutHandler::HandleOpenHelpPage, base::Unretained(this))); | 335 base::Bind(&AboutHandler::HandleOpenHelpPage, base::Unretained(this))); |
| 340 #if defined(OS_CHROMEOS) | 336 #if defined(OS_CHROMEOS) |
| 341 web_ui()->RegisterMessageCallback( | 337 web_ui()->RegisterMessageCallback( |
| 342 "setChannel", | 338 "setChannel", |
| 343 base::Bind(&AboutHandler::HandleSetChannel, base::Unretained(this))); | 339 base::Bind(&AboutHandler::HandleSetChannel, base::Unretained(this))); |
| 344 web_ui()->RegisterMessageCallback( | 340 web_ui()->RegisterMessageCallback( |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 RequestUpdate(); | 447 RequestUpdate(); |
| 452 #endif | 448 #endif |
| 453 } | 449 } |
| 454 | 450 |
| 455 #if defined(OS_MACOSX) | 451 #if defined(OS_MACOSX) |
| 456 void AboutHandler::PromoteUpdater(const base::ListValue* args) { | 452 void AboutHandler::PromoteUpdater(const base::ListValue* args) { |
| 457 version_updater_->PromoteUpdater(); | 453 version_updater_->PromoteUpdater(); |
| 458 } | 454 } |
| 459 #endif | 455 #endif |
| 460 | 456 |
| 461 void AboutHandler::HandleRelaunchNow(const base::ListValue* args) { | |
| 462 DCHECK(args->empty()); | |
| 463 chrome::AttemptRelaunch(); | |
| 464 } | |
| 465 | |
| 466 void AboutHandler::HandleOpenFeedbackDialog(const base::ListValue* args) { | 457 void AboutHandler::HandleOpenFeedbackDialog(const base::ListValue* args) { |
| 467 DCHECK(args->empty()); | 458 DCHECK(args->empty()); |
| 468 Browser* browser = | 459 Browser* browser = |
| 469 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents()); | 460 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents()); |
| 470 chrome::OpenFeedbackDialog(browser); | 461 chrome::OpenFeedbackDialog(browser); |
| 471 } | 462 } |
| 472 | 463 |
| 473 void AboutHandler::HandleOpenHelpPage(const base::ListValue* args) { | 464 void AboutHandler::HandleOpenHelpPage(const base::ListValue* args) { |
| 474 DCHECK(args->empty()); | 465 DCHECK(args->empty()); |
| 475 Browser* browser = | 466 Browser* browser = |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 std::string url = std::string("chrome://") + chrome::kChromeOSAssetHost + | 644 std::string url = std::string("chrome://") + chrome::kChromeOSAssetHost + |
| 654 "/" + path.MaybeAsASCII(); | 645 "/" + path.MaybeAsASCII(); |
| 655 regulatory_info->SetString("url", url); | 646 regulatory_info->SetString("url", url); |
| 656 | 647 |
| 657 ResolveJavascriptCallback(base::StringValue(callback_id), *regulatory_info); | 648 ResolveJavascriptCallback(base::StringValue(callback_id), *regulatory_info); |
| 658 } | 649 } |
| 659 | 650 |
| 660 #endif // defined(OS_CHROMEOS) | 651 #endif // defined(OS_CHROMEOS) |
| 661 | 652 |
| 662 } // namespace settings | 653 } // namespace settings |
| OLD | NEW |