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

Unified Diff: remoting/host/host_session_options.cc

Issue 2858813002: [Chromoting] Use ProcessStatsSender in host process
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/host_session_options.h ('k') | remoting/host/host_session_options_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/host_session_options.cc
diff --git a/remoting/host/host_session_options.cc b/remoting/host/host_session_options.cc
index 8511f278ceddc6d297a55a4378d16ee19bf00edf..b97018ddc2bb4e1592548f488abcd233dca7ca43 100644
--- a/remoting/host/host_session_options.cc
+++ b/remoting/host/host_session_options.cc
@@ -7,6 +7,7 @@
#include <vector>
#include "base/logging.h"
+#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
@@ -54,6 +55,25 @@ base::Optional<std::string> HostSessionOptions::Get(
return it->second;
}
+base::Optional<bool> HostSessionOptions::GetBool(const std::string& key) const {
+ base::Optional<std::string> value = Get(key);
+ if (!value) {
+ return base::nullopt;
+ }
+ return base::ToLowerASCII(*value) == "true" ||
+ (*value) == "1" ||
+ (*value).empty();
+}
+
+base::Optional<int> HostSessionOptions::GetInt(const std::string& key) const {
+ base::Optional<std::string> value = Get(key);
+ int result;
+ if (!value || !base::StringToInt(*value, &result)) {
+ return base::nullopt;
+ }
+ return result;
+}
+
std::string HostSessionOptions::Export() const {
std::string result;
for (const auto& pair : options_) {
« no previous file with comments | « remoting/host/host_session_options.h ('k') | remoting/host/host_session_options_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698