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

Side by Side Diff: chrome/browser/ui/webui/version_handler_chromeos.cc

Issue 2858073002: Use constexpr TaskTraits constructor in chrome. (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/version_handler_chromeos.h" 5 #include "chrome/browser/ui/webui/version_handler_chromeos.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/task_scheduler/post_task.h" 8 #include "base/task_scheduler/post_task.h"
9 #include "content/public/browser/web_ui.h" 9 #include "content/public/browser/web_ui.h"
10 10
11 VersionHandlerChromeOS::VersionHandlerChromeOS() : weak_factory_(this) {} 11 VersionHandlerChromeOS::VersionHandlerChromeOS() : weak_factory_(this) {}
12 12
13 VersionHandlerChromeOS::~VersionHandlerChromeOS() {} 13 VersionHandlerChromeOS::~VersionHandlerChromeOS() {}
14 14
15 void VersionHandlerChromeOS::HandleRequestVersionInfo( 15 void VersionHandlerChromeOS::HandleRequestVersionInfo(
16 const base::ListValue* args) { 16 const base::ListValue* args) {
17 // Start the asynchronous load of the versions. 17 // Start the asynchronous load of the versions.
18 base::PostTaskWithTraitsAndReplyWithResult( 18 base::PostTaskWithTraitsAndReplyWithResult(
19 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( 19 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND},
20 base::TaskPriority::BACKGROUND),
21 base::Bind(&chromeos::version_loader::GetVersion, 20 base::Bind(&chromeos::version_loader::GetVersion,
22 chromeos::version_loader::VERSION_FULL), 21 chromeos::version_loader::VERSION_FULL),
23 base::Bind(&VersionHandlerChromeOS::OnVersion, 22 base::Bind(&VersionHandlerChromeOS::OnVersion,
24 weak_factory_.GetWeakPtr())); 23 weak_factory_.GetWeakPtr()));
25 base::PostTaskWithTraitsAndReplyWithResult( 24 base::PostTaskWithTraitsAndReplyWithResult(
26 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( 25 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND},
27 base::TaskPriority::BACKGROUND),
28 base::Bind(&chromeos::version_loader::GetFirmware), 26 base::Bind(&chromeos::version_loader::GetFirmware),
29 base::Bind(&VersionHandlerChromeOS::OnOSFirmware, 27 base::Bind(&VersionHandlerChromeOS::OnOSFirmware,
30 weak_factory_.GetWeakPtr())); 28 weak_factory_.GetWeakPtr()));
31 base::PostTaskWithTraitsAndReplyWithResult( 29 base::PostTaskWithTraitsAndReplyWithResult(
32 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( 30 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND},
33 base::TaskPriority::BACKGROUND),
34 base::Bind(&chromeos::version_loader::GetARCVersion), 31 base::Bind(&chromeos::version_loader::GetARCVersion),
35 base::Bind(&VersionHandlerChromeOS::OnARCVersion, 32 base::Bind(&VersionHandlerChromeOS::OnARCVersion,
36 weak_factory_.GetWeakPtr())); 33 weak_factory_.GetWeakPtr()));
37 34
38 // Parent class takes care of the rest. 35 // Parent class takes care of the rest.
39 VersionHandler::HandleRequestVersionInfo(args); 36 VersionHandler::HandleRequestVersionInfo(args);
40 } 37 }
41 38
42 void VersionHandlerChromeOS::OnVersion(const std::string& version) { 39 void VersionHandlerChromeOS::OnVersion(const std::string& version) {
43 base::Value arg(version); 40 base::Value arg(version);
44 web_ui()->CallJavascriptFunctionUnsafe("returnOsVersion", arg); 41 web_ui()->CallJavascriptFunctionUnsafe("returnOsVersion", arg);
45 } 42 }
46 43
47 void VersionHandlerChromeOS::OnOSFirmware(const std::string& version) { 44 void VersionHandlerChromeOS::OnOSFirmware(const std::string& version) {
48 base::Value arg(version); 45 base::Value arg(version);
49 web_ui()->CallJavascriptFunctionUnsafe("returnOsFirmwareVersion", arg); 46 web_ui()->CallJavascriptFunctionUnsafe("returnOsFirmwareVersion", arg);
50 } 47 }
51 48
52 void VersionHandlerChromeOS::OnARCVersion(const std::string& version) { 49 void VersionHandlerChromeOS::OnARCVersion(const std::string& version) {
53 base::Value arg(version); 50 base::Value arg(version);
54 web_ui()->CallJavascriptFunctionUnsafe("returnARCVersion", arg); 51 web_ui()->CallJavascriptFunctionUnsafe("returnARCVersion", arg);
55 } 52 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/settings/chromeos/device_storage_handler.cc ('k') | chrome/browser/web_applications/web_app_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698