| 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 "base/memory/ptr_util.h" | 5 #include "base/memory/ptr_util.h" |
| 6 #include "blimp/client/app/linux/blimp_client_context_delegate_linux.h" | 6 #include "blimp/client/app/linux/blimp_client_context_delegate_linux.h" |
| 7 #include "blimp/client/public/resources/blimp_strings.h" |
| 7 #include "blimp/client/support/session/blimp_default_identity_provider.h" | 8 #include "blimp/client/support/session/blimp_default_identity_provider.h" |
| 8 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
| 9 | 10 |
| 10 namespace blimp { | 11 namespace blimp { |
| 11 namespace client { | 12 namespace client { |
| 12 | 13 |
| 13 BlimpClientContextDelegateLinux::BlimpClientContextDelegateLinux() = default; | 14 BlimpClientContextDelegateLinux::BlimpClientContextDelegateLinux() = default; |
| 14 | 15 |
| 15 BlimpClientContextDelegateLinux::~BlimpClientContextDelegateLinux() = default; | 16 BlimpClientContextDelegateLinux::~BlimpClientContextDelegateLinux() = default; |
| 16 | 17 |
| 17 void BlimpClientContextDelegateLinux::AttachBlimpContentsHelpers( | 18 void BlimpClientContextDelegateLinux::AttachBlimpContentsHelpers( |
| 18 BlimpContents* blimp_contents) {} | 19 BlimpContents* blimp_contents) {} |
| 19 | 20 |
| 20 void BlimpClientContextDelegateLinux::OnAssignmentConnectionAttempted( | 21 void BlimpClientContextDelegateLinux::OnAssignmentConnectionAttempted( |
| 21 AssignmentRequestResult result, | 22 AssignmentRequestResult result, |
| 22 const Assignment& assignment) { | 23 const Assignment& assignment) { |
| 23 // TODO(xingliu): Update this to use the new error strings and logging helper | 24 if (result == ASSIGNMENT_REQUEST_RESULT_OK) |
| 24 // methods, and access the string from grd files. https://crbug.com/630687 | 25 return; |
| 25 switch (result) { | 26 |
| 26 case AssignmentRequestResult::ASSIGNMENT_REQUEST_RESULT_OK: | 27 LOG(WARNING) << string::AssignmentResultErrorToString(result); |
| 27 VLOG(0) << "Assignment request success"; | |
| 28 break; | |
| 29 case AssignmentRequestResult::ASSIGNMENT_REQUEST_RESULT_UNKNOWN: | |
| 30 LOG(WARNING) << "Assignment request result unknown"; | |
| 31 break; | |
| 32 case AssignmentRequestResult::ASSIGNMENT_REQUEST_RESULT_BAD_REQUEST: | |
| 33 LOG(WARNING) << "Assignment request error: Bad request"; | |
| 34 break; | |
| 35 case AssignmentRequestResult::ASSIGNMENT_REQUEST_RESULT_BAD_RESPONSE: | |
| 36 LOG(WARNING) << "Assignment request error: Bad response"; | |
| 37 break; | |
| 38 case AssignmentRequestResult:: | |
| 39 ASSIGNMENT_REQUEST_RESULT_INVALID_PROTOCOL_VERSION: | |
| 40 LOG(WARNING) << "Assignment request error: Invalid protocol version"; | |
| 41 break; | |
| 42 case AssignmentRequestResult:: | |
| 43 ASSIGNMENT_REQUEST_RESULT_EXPIRED_ACCESS_TOKEN: | |
| 44 LOG(WARNING) << "Assignment request error: Expired access token"; | |
| 45 break; | |
| 46 case AssignmentRequestResult::ASSIGNMENT_REQUEST_RESULT_USER_INVALID: | |
| 47 LOG(WARNING) << "Assignment request error: User invalid"; | |
| 48 break; | |
| 49 case AssignmentRequestResult::ASSIGNMENT_REQUEST_RESULT_OUT_OF_VMS: | |
| 50 LOG(WARNING) << "Assignment request error: Out of VMs"; | |
| 51 break; | |
| 52 case AssignmentRequestResult::ASSIGNMENT_REQUEST_RESULT_SERVER_ERROR: | |
| 53 LOG(WARNING) << "Assignment request error: Server error"; | |
| 54 break; | |
| 55 case AssignmentRequestResult::ASSIGNMENT_REQUEST_RESULT_SERVER_INTERRUPTED: | |
| 56 LOG(WARNING) << "Assignment request error: Server interrupted"; | |
| 57 break; | |
| 58 case AssignmentRequestResult::ASSIGNMENT_REQUEST_RESULT_NETWORK_FAILURE: | |
| 59 LOG(WARNING) << "Assignment request error: Network failure"; | |
| 60 break; | |
| 61 case AssignmentRequestResult::ASSIGNMENT_REQUEST_RESULT_INVALID_CERT: | |
| 62 LOG(WARNING) << "Assignment request error: Invalid cert"; | |
| 63 break; | |
| 64 } | |
| 65 } | 28 } |
| 66 | 29 |
| 67 std::unique_ptr<IdentityProvider> | 30 std::unique_ptr<IdentityProvider> |
| 68 BlimpClientContextDelegateLinux::CreateIdentityProvider() { | 31 BlimpClientContextDelegateLinux::CreateIdentityProvider() { |
| 69 return base::MakeUnique<BlimpDefaultIdentityProvider>(); | 32 return base::MakeUnique<BlimpDefaultIdentityProvider>(); |
| 70 } | 33 } |
| 71 | 34 |
| 72 void BlimpClientContextDelegateLinux::OnAuthenticationError( | 35 void BlimpClientContextDelegateLinux::OnAuthenticationError( |
| 73 const GoogleServiceAuthError& error) { | 36 const GoogleServiceAuthError& error) { |
| 74 LOG(WARNING) << "GoogleAuth error : " << error.ToString(); | 37 LOG(WARNING) << "GoogleAuth error : " << error.ToString(); |
| 75 } | 38 } |
| 76 | 39 |
| 77 void BlimpClientContextDelegateLinux::OnConnected() { | 40 void BlimpClientContextDelegateLinux::OnConnected() { |
| 78 VLOG(1) << "Connected."; | 41 VLOG(1) << "Connected."; |
| 79 } | 42 } |
| 80 | 43 |
| 81 void BlimpClientContextDelegateLinux::OnEngineDisconnected(int result) { | 44 void BlimpClientContextDelegateLinux::OnEngineDisconnected(int result) { |
| 82 LOG(WARNING) << "Disconnected from the engine, reason: " << result; | 45 LOG(WARNING) << "Disconnected from the engine, reason: " |
| 46 << string::EndConnectionMessageToString(result); |
| 83 } | 47 } |
| 84 | 48 |
| 85 void BlimpClientContextDelegateLinux::OnNetworkDisconnected(int result) { | 49 void BlimpClientContextDelegateLinux::OnNetworkDisconnected(int result) { |
| 86 LOG(WARNING) << "Disconnected, reason: " << net::ErrorToShortString(result); | 50 LOG(WARNING) << "Disconnected, reason: " << net::ErrorToShortString(result); |
| 87 } | 51 } |
| 88 | 52 |
| 89 } // namespace client | 53 } // namespace client |
| 90 } // namespace blimp | 54 } // namespace blimp |
| OLD | NEW |