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

Unified Diff: blimp/client/core/resources/blimp_strings.cc

Issue 2431653004: Setup Blimp internal string resources. (Closed)
Patch Set: Added some recent blimp java xml file. Created 4 years, 1 month 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/client/core/resources/blimp_strings.cc
diff --git a/blimp/client/core/resources/blimp_strings.cc b/blimp/client/core/resources/blimp_strings.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e9a809cf1ad1d0578f7b53ade784225d3c505268
--- /dev/null
+++ b/blimp/client/core/resources/blimp_strings.cc
@@ -0,0 +1,80 @@
+// 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 "blimp/client/public/resources/blimp_strings.h"
+
+#include "blimp/client/core/resources/grit/blimp_strings.h"
+#include "blimp/common/proto/protocol_control.pb.h"
+#include "ui/base/l10n/l10n_util.h"
+
+namespace blimp {
+namespace string {
+
+base::string16 AssignmentResultErrorToString(
+ client::AssignmentRequestResult result) {
+ DCHECK(result != client::ASSIGNMENT_REQUEST_RESULT_OK);
+
+ int string_id = IDS_ASSIGNMENT_SUCCESS;
+ switch (result) {
+ case client::ASSIGNMENT_REQUEST_RESULT_BAD_REQUEST:
+ string_id = IDS_ASSIGNMENT_FAILURE_BAD_REQUEST;
+ break;
+ case client::ASSIGNMENT_REQUEST_RESULT_BAD_RESPONSE:
+ string_id = IDS_ASSIGNMENT_FAILURE_BAD_RESPONSE;
+ break;
+ case client::ASSIGNMENT_REQUEST_RESULT_INVALID_PROTOCOL_VERSION:
+ string_id = IDS_ASSIGNMENT_FAILURE_BAD_VERSION;
+ break;
+ case client::ASSIGNMENT_REQUEST_RESULT_EXPIRED_ACCESS_TOKEN:
+ string_id = IDS_ASSIGNMENT_FAILURE_EXPIRED_TOKEN;
+ break;
+ case client::ASSIGNMENT_REQUEST_RESULT_USER_INVALID:
+ string_id = IDS_ASSIGNMENT_FAILURE_USER_INVALID;
+ break;
+ case client::ASSIGNMENT_REQUEST_RESULT_OUT_OF_VMS:
+ string_id = IDS_ASSIGNMENT_FAILURE_OUT_OF_VMS;
+ break;
+ case client::ASSIGNMENT_REQUEST_RESULT_SERVER_ERROR:
+ string_id = IDS_ASSIGNMENT_FAILURE_SERVER_ERROR;
+ break;
+ case client::ASSIGNMENT_REQUEST_RESULT_SERVER_INTERRUPTED:
+ string_id = IDS_ASSIGNMENT_FAILURE_SERVER_INTERRUPTED;
+ break;
+ case client::ASSIGNMENT_REQUEST_RESULT_NETWORK_FAILURE:
+ string_id = IDS_ASSIGNMENT_FAILURE_NETWORK;
+ break;
+ case client::ASSIGNMENT_REQUEST_RESULT_INVALID_CERT:
+ string_id = IDS_ASSIGNMENT_INVALID_CERT;
+ break;
+ case client::ASSIGNMENT_REQUEST_RESULT_UNKNOWN:
+ string_id = IDS_ASSIGNMENT_FAILURE_UNKNOWN;
+ break;
+ case client::ASSIGNMENT_REQUEST_RESULT_OK:
+ NOTIMPLEMENTED();
+ }
+
+ return l10n_util::GetStringUTF16(string_id);
+}
+
+base::string16 EndConnectionMessageToString(int reason) {
+ int string_id = IDS_BLIMP_ENDCONNECTION_UNKNOWN;
+ EndConnectionMessage::Reason end_connection_reason =
+ static_cast<EndConnectionMessage::Reason>(reason);
+ switch (end_connection_reason) {
+ case EndConnectionMessage::AUTHENTICATION_FAILED:
+ string_id = IDS_BLIMP_ENDCONNECTION_AUTH_FAIL;
+ break;
+ case EndConnectionMessage::PROTOCOL_MISMATCH:
+ string_id = IDS_BLIMP_ENDCONNECTION_PROTOCOL_MISMATCH;
+ break;
+ case EndConnectionMessage::UNKNOWN:
+ string_id = IDS_BLIMP_ENDCONNECTION_UNKNOWN;
+ break;
+ }
+
+ return l10n_util::GetStringUTF16(string_id);
+}
+
+} // namespace string
+} // namespace blimp
« no previous file with comments | « blimp/client/core/resources/android/java/res/xml/blimp_preferences.xml ('k') | blimp/client/core/resources/blimp_strings.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698