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

Unified Diff: blimp/common/get_client_token.cc

Issue 1958033003: Allows client to access auth token from command line specified file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: blimp/common/get_client_token.cc
diff --git a/blimp/common/get_client_token.cc b/blimp/common/get_client_token.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e34583be04cbc74514858112aa40ef23d50da1b0
--- /dev/null
+++ b/blimp/common/get_client_token.cc
@@ -0,0 +1,24 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/files/file_path.h"
+#include "base/files/file_util.h"
+#include "base/strings/string_util.h"
+#include "blimp/common/get_client_token.h"
+#include "blimp/engine/app/switches.h"
Kevin M 2016/05/10 18:06:35 Consider promote shared switches to something unde
CJ 2016/05/10 20:58:06 Done.
+
+namespace blimp {
+
+std::string GetClientToken(const base::CommandLine& cmd_line) {
Kevin M 2016/05/10 18:06:35 Existing test code already manipulates the current
CJ 2016/05/10 20:58:06 Although I agree, would this have any impact on th
+ std::string file_contents;
+ const base::FilePath path = cmd_line.GetSwitchValuePath(
+ engine::kClientTokenPath);
+ if (!base::ReadFileToString(path, &file_contents)) {
+ LOG(ERROR) << "Could not read client token file at "
+ << (path.empty() ? "(not provided)" : path.AsUTF8Unsafe());
+ }
+ return base::CollapseWhitespaceASCII(file_contents, true);
+}
+
+} // namespace blimp

Powered by Google App Engine
This is Rietveld 408576698