| 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 |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 html_source->AddString("aboutUserAgent", GetUserAgent()); | 304 html_source->AddString("aboutUserAgent", GetUserAgent()); |
| 305 html_source->AddString("aboutJsEngineVersion", v8::V8::GetVersion()); | 305 html_source->AddString("aboutJsEngineVersion", v8::V8::GetVersion()); |
| 306 html_source->AddString("aboutBlinkVersion", content::GetWebKitVersion()); | 306 html_source->AddString("aboutBlinkVersion", content::GetWebKitVersion()); |
| 307 #endif | 307 #endif |
| 308 | 308 |
| 309 return new AboutHandler(); | 309 return new AboutHandler(); |
| 310 } | 310 } |
| 311 | 311 |
| 312 void AboutHandler::RegisterMessages() { | 312 void AboutHandler::RegisterMessages() { |
| 313 web_ui()->RegisterMessageCallback( | 313 web_ui()->RegisterMessageCallback( |
| 314 "aboutPageReady", |
| 315 base::Bind(&AboutHandler::HandlePageReady, base::Unretained(this))); |
| 316 web_ui()->RegisterMessageCallback( |
| 314 "refreshUpdateStatus", | 317 "refreshUpdateStatus", |
| 315 base::Bind(&AboutHandler::HandleRefreshUpdateStatus, | 318 base::Bind(&AboutHandler::HandleRefreshUpdateStatus, |
| 316 base::Unretained(this))); | 319 base::Unretained(this))); |
| 317 web_ui()->RegisterMessageCallback( | 320 web_ui()->RegisterMessageCallback( |
| 318 "relaunchNow", | 321 "relaunchNow", |
| 319 base::Bind(&AboutHandler::HandleRelaunchNow, base::Unretained(this))); | 322 base::Bind(&AboutHandler::HandleRelaunchNow, base::Unretained(this))); |
| 320 web_ui()->RegisterMessageCallback( | 323 web_ui()->RegisterMessageCallback( |
| 321 "openFeedbackDialog", base::Bind(&AboutHandler::HandleOpenFeedbackDialog, | 324 "openFeedbackDialog", base::Bind(&AboutHandler::HandleOpenFeedbackDialog, |
| 322 base::Unretained(this))); | 325 base::Unretained(this))); |
| 323 web_ui()->RegisterMessageCallback( | 326 web_ui()->RegisterMessageCallback( |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 bool current_auto_update_disabled = false; | 420 bool current_auto_update_disabled = false; |
| 418 if (current_policy) | 421 if (current_policy) |
| 419 CHECK(current_policy->GetAsBoolean(¤t_auto_update_disabled)); | 422 CHECK(current_policy->GetAsBoolean(¤t_auto_update_disabled)); |
| 420 | 423 |
| 421 if (current_auto_update_disabled != previous_auto_update_disabled) { | 424 if (current_auto_update_disabled != previous_auto_update_disabled) { |
| 422 // Refresh the update status to refresh the status of the UI. | 425 // Refresh the update status to refresh the status of the UI. |
| 423 RefreshUpdateStatus(); | 426 RefreshUpdateStatus(); |
| 424 } | 427 } |
| 425 } | 428 } |
| 426 | 429 |
| 430 void AboutHandler::HandlePageReady(const base::ListValue* args) { |
| 431 AllowJavascript(); |
| 432 } |
| 433 |
| 427 void AboutHandler::HandleRefreshUpdateStatus(const base::ListValue* args) { | 434 void AboutHandler::HandleRefreshUpdateStatus(const base::ListValue* args) { |
| 428 AllowJavascript(); | |
| 429 RefreshUpdateStatus(); | 435 RefreshUpdateStatus(); |
| 430 } | 436 } |
| 431 | 437 |
| 432 void AboutHandler::RefreshUpdateStatus() { | 438 void AboutHandler::RefreshUpdateStatus() { |
| 433 // On Chrome OS, do not check for an update automatically. | 439 // On Chrome OS, do not check for an update automatically. |
| 434 #if defined(OS_CHROMEOS) | 440 #if defined(OS_CHROMEOS) |
| 435 static_cast<VersionUpdaterCros*>(version_updater_.get()) | 441 static_cast<VersionUpdaterCros*>(version_updater_.get()) |
| 436 ->GetUpdateStatus( | 442 ->GetUpdateStatus( |
| 437 base::Bind(&AboutHandler::SetUpdateStatus, base::Unretained(this))); | 443 base::Bind(&AboutHandler::SetUpdateStatus, base::Unretained(this))); |
| 438 #else | 444 #else |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 std::string url = std::string("chrome://") + chrome::kChromeOSAssetHost + | 647 std::string url = std::string("chrome://") + chrome::kChromeOSAssetHost + |
| 642 "/" + path.MaybeAsASCII(); | 648 "/" + path.MaybeAsASCII(); |
| 643 regulatory_info->SetString("url", url); | 649 regulatory_info->SetString("url", url); |
| 644 | 650 |
| 645 ResolveJavascriptCallback(base::StringValue(callback_id), *regulatory_info); | 651 ResolveJavascriptCallback(base::StringValue(callback_id), *regulatory_info); |
| 646 } | 652 } |
| 647 | 653 |
| 648 #endif // defined(OS_CHROMEOS) | 654 #endif // defined(OS_CHROMEOS) |
| 649 | 655 |
| 650 } // namespace settings | 656 } // namespace settings |
| OLD | NEW |