OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/remoting/setup_flow_register_step.h" | 5 #include "chrome/browser/remoting/setup_flow_register_step.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/remoting/setup_flow_login_step.h" | 9 #include "chrome/browser/remoting/setup_flow_login_step.h" |
10 #include "chrome/browser/remoting/setup_flow_start_host_step.h" | 10 #include "chrome/browser/remoting/setup_flow_start_host_step.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 NewCallback(this, &SetupFlowRegisterStep::OnRequestDone)); | 34 NewCallback(this, &SetupFlowRegisterStep::OnRequestDone)); |
35 } | 35 } |
36 | 36 |
37 void SetupFlowRegisterStep::OnRequestDone(DirectoryAddRequest::Result result, | 37 void SetupFlowRegisterStep::OnRequestDone(DirectoryAddRequest::Result result, |
38 const std::string& error_message) { | 38 const std::string& error_message) { |
39 switch (result) { | 39 switch (result) { |
40 case DirectoryAddRequest::SUCCESS: | 40 case DirectoryAddRequest::SUCCESS: |
41 FinishStep(new SetupFlowStartHostStep()); | 41 FinishStep(new SetupFlowStartHostStep()); |
42 break; | 42 break; |
43 case DirectoryAddRequest::ERROR_EXISTS: | 43 case DirectoryAddRequest::ERROR_EXISTS: |
44 LOG(INFO) << "Chromoting host is already reagistered."; | 44 LOG(INFO) << "Chromoting host is already registered."; |
45 FinishStep(new SetupFlowStartHostStep()); | 45 FinishStep(new SetupFlowStartHostStep()); |
46 break; | 46 break; |
47 case DirectoryAddRequest::ERROR_AUTH: | 47 case DirectoryAddRequest::ERROR_AUTH: |
48 LOG(ERROR) << "Chromoting Directory didn't accept auth token."; | 48 LOG(ERROR) << "Access denied by Chromoting Directory."; |
49 FinishStep(new SetupFlowLoginStep()); | 49 FinishStep(new SetupFlowLoginStep(l10n_util::GetStringUTF16( |
| 50 IDS_REMOTING_REGISTRATION_ACCESS_DENIED))); |
50 break; | 51 break; |
51 default: | 52 default: |
52 LOG(ERROR) << "Chromoting Host registration failed: " | 53 LOG(ERROR) << "Chromoting Host registration failed: " |
53 << error_message << " (" << result << ")"; | 54 << error_message << " (" << result << ")"; |
54 FinishStep(new SetupFlowRegisterErrorStep()); | 55 FinishStep(new SetupFlowRegisterErrorStep()); |
55 break; | 56 break; |
56 } | 57 } |
57 } | 58 } |
58 | 59 |
59 SetupFlowRegisterErrorStep::SetupFlowRegisterErrorStep() { } | 60 SetupFlowRegisterErrorStep::SetupFlowRegisterErrorStep() { } |
60 SetupFlowRegisterErrorStep::~SetupFlowRegisterErrorStep() { } | 61 SetupFlowRegisterErrorStep::~SetupFlowRegisterErrorStep() { } |
61 | 62 |
62 string16 SetupFlowRegisterErrorStep::GetErrorMessage() { | 63 string16 SetupFlowRegisterErrorStep::GetErrorMessage() { |
63 return l10n_util::GetStringUTF16(IDS_REMOTING_REGISTRATION_FAILED_MESSAGE); | 64 return l10n_util::GetStringUTF16(IDS_REMOTING_REGISTRATION_FAILED_MESSAGE); |
64 } | 65 } |
65 | 66 |
66 void SetupFlowRegisterErrorStep::Retry() { | 67 void SetupFlowRegisterErrorStep::Retry() { |
67 // When retrying we retry from the GetStatus step because it may be | 68 // When retrying we retry from the GetStatus step because it may be |
68 // necessary to start service process. | 69 // necessary to start service process. |
69 FinishStep(new SetupFlowRegisterStep()); | 70 FinishStep(new SetupFlowRegisterStep()); |
70 } | 71 } |
71 | 72 |
72 } // namespace remoting | 73 } // namespace remoting |
OLD | NEW |