| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "remoting/host/setup/win/start_host_window.h" | 5 #include "remoting/host/setup/win/start_host_window.h" |
| 6 | 6 |
| 7 #include <atlbase.h> | 7 #include <atlbase.h> |
| 8 #include <atlwin.h> | 8 #include <atlwin.h> |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 | 10 |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "remoting/host/setup/oauth_helper.h" |
| 14 #include "remoting/host/setup/pin_validator.h" | 15 #include "remoting/host/setup/pin_validator.h" |
| 15 #include "remoting/host/setup/win/load_string_from_resource.h" | 16 #include "remoting/host/setup/win/load_string_from_resource.h" |
| 16 | 17 |
| 17 namespace remoting { | 18 namespace remoting { |
| 18 | 19 |
| 19 StartHostWindow::StartHostWindow( | 20 StartHostWindow::StartHostWindow( |
| 20 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter) | 21 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter) |
| 21 : host_starter_(remoting::HostStarter::Create(url_request_context_getter)), | 22 : host_starter_(remoting::HostStarter::Create(url_request_context_getter)), |
| 22 consent_to_collect_data_(true), | 23 consent_to_collect_data_(true), |
| 23 mem_mgr_(GetProcessHeap()), | 24 mem_mgr_(GetProcessHeap()), |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 } | 67 } |
| 67 MessageBox(LoadStringFromResource(IDS_USE_BROWSER), | 68 MessageBox(LoadStringFromResource(IDS_USE_BROWSER), |
| 68 LoadStringFromResource(IDS_TITLE), MB_OK); | 69 LoadStringFromResource(IDS_TITLE), MB_OK); |
| 69 auth_code_getter_.GetAuthCode( | 70 auth_code_getter_.GetAuthCode( |
| 70 base::Bind(&StartHostWindow::OnAuthCode, weak_ptr_)); | 71 base::Bind(&StartHostWindow::OnAuthCode, weak_ptr_)); |
| 71 } | 72 } |
| 72 | 73 |
| 73 void StartHostWindow::OnAuthCode(const std::string& auth_code) { | 74 void StartHostWindow::OnAuthCode(const std::string& auth_code) { |
| 74 host_starter_->StartHost( | 75 host_starter_->StartHost( |
| 75 host_name_, pin_, consent_to_collect_data_, auth_code, | 76 host_name_, pin_, consent_to_collect_data_, auth_code, |
| 77 GetDefaultOauthRedirectUrl(), |
| 76 base::Bind(&StartHostWindow::OnHostStarted, weak_ptr_)); | 78 base::Bind(&StartHostWindow::OnHostStarted, weak_ptr_)); |
| 77 } | 79 } |
| 78 | 80 |
| 79 void StartHostWindow::OnHostStarted(remoting::HostStarter::Result result) { | 81 void StartHostWindow::OnHostStarted(remoting::HostStarter::Result result) { |
| 80 if (result == remoting::HostStarter::START_COMPLETE) { | 82 if (result == remoting::HostStarter::START_COMPLETE) { |
| 81 MessageBox(LoadStringFromResource(IDS_HOST_START_SUCCEEDED), | 83 MessageBox(LoadStringFromResource(IDS_HOST_START_SUCCEEDED), |
| 82 LoadStringFromResource(IDS_TITLE), MB_OK); | 84 LoadStringFromResource(IDS_TITLE), MB_OK); |
| 83 EndDialog(IDOK); | 85 EndDialog(IDOK); |
| 84 } else { | 86 } else { |
| 85 MessageBox(LoadStringFromResource(IDS_HOST_START_FAILED), | 87 MessageBox(LoadStringFromResource(IDS_HOST_START_FAILED), |
| 86 LoadStringFromResource(IDS_TITLE), MB_ICONEXCLAMATION | MB_OK); | 88 LoadStringFromResource(IDS_TITLE), MB_ICONEXCLAMATION | MB_OK); |
| 87 } | 89 } |
| 88 } | 90 } |
| 89 | 91 |
| 90 std::string StartHostWindow::GetDlgItemString(int id) { | 92 std::string StartHostWindow::GetDlgItemString(int id) { |
| 91 CSimpleString str(L"", &string_mgr_); | 93 CSimpleString str(L"", &string_mgr_); |
| 92 GetDlgItemText(id, str); | 94 GetDlgItemText(id, str); |
| 93 return UTF16ToUTF8(str.GetString()); | 95 return UTF16ToUTF8(str.GetString()); |
| 94 } | 96 } |
| 95 | 97 |
| 96 } // namespace remoting | 98 } // namespace remoting |
| OLD | NEW |