Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <atlbase.h> | 5 #include <atlbase.h> |
| 6 #include <atlapp.h> // NOLINT | 6 #include <atlapp.h> // NOLINT |
| 7 | 7 |
| 8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/string16.h" | 13 #include "base/string16.h" |
| 14 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
| 15 #include "chrome/common/chrome_constants.h" | 15 #include "chrome/common/chrome_constants.h" |
| 16 #include "cloud_print/common/win/cloud_print_utils.h" | 16 #include "cloud_print/common/win/cloud_print_utils.h" |
| 17 #include "cloud_print/resources.h" | 17 #include "cloud_print/resources.h" |
| 18 #include "cloud_print/service/service_state.h" | 18 #include "cloud_print/service/service_state.h" |
| 19 #include "cloud_print/service/win/chrome_launcher.h" | 19 #include "cloud_print/service/win/chrome_launcher.h" |
| 20 #include "cloud_print/service/win/installer.h" | |
| 20 #include "cloud_print/service/win/service_controller.h" | 21 #include "cloud_print/service/win/service_controller.h" |
| 21 #include "cloud_print/service/win/service_utils.h" | 22 #include "cloud_print/service/win/service_utils.h" |
| 22 #include "cloud_print/service/win/setup_listener.h" | 23 #include "cloud_print/service/win/setup_listener.h" |
| 23 | 24 |
| 24 using cloud_print::LoadLocalString; | 25 using cloud_print::LoadLocalString; |
| 25 using cloud_print::GetErrorMessage; | 26 using cloud_print::GetErrorMessage; |
| 26 | 27 |
| 27 class SetupDialog : public base::RefCounted<SetupDialog>, | 28 class SetupDialog : public base::RefCounted<SetupDialog>, |
| 28 public ATL::CDialogImpl<SetupDialog> { | 29 public ATL::CDialogImpl<SetupDialog> { |
| 29 public: | 30 public: |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 GetDlgItem(IDC_PASSWORD).EnableWindow(TRUE); | 195 GetDlgItem(IDC_PASSWORD).EnableWindow(TRUE); |
| 195 GetDlgItem(IDC_LOGGING).EnableWindow(TRUE); | 196 GetDlgItem(IDC_LOGGING).EnableWindow(TRUE); |
| 196 } | 197 } |
| 197 } | 198 } |
| 198 | 199 |
| 199 LRESULT SetupDialog::OnInitDialog(UINT message, WPARAM wparam, LPARAM lparam, | 200 LRESULT SetupDialog::OnInitDialog(UINT message, WPARAM wparam, LPARAM lparam, |
| 200 BOOL& handled) { | 201 BOOL& handled) { |
| 201 ATLVERIFY(CenterWindow()); | 202 ATLVERIFY(CenterWindow()); |
| 202 | 203 |
| 203 WTL::CIcon icon; | 204 WTL::CIcon icon; |
| 204 if (icon.LoadIcon(MAKEINTRESOURCE(IDI_ICON), GetSystemMetrics(SM_CXSMICON), | 205 if (icon.LoadIcon(MAKEINTRESOURCE(IDI_ICON))) { |
| 205 GetSystemMetrics(SM_CYSMICON), 0)) { | |
| 206 SetIcon(icon); | 206 SetIcon(icon); |
| 207 } | 207 } |
| 208 | 208 |
| 209 SetWindowText(LoadLocalString(IDS_SETUP_PROGRAM_NAME).c_str()); | 209 SetWindowText(LoadLocalString(IDS_SETUP_PROGRAM_NAME).c_str()); |
| 210 SetDlgItemText(IDC_STATE_LABEL, LoadLocalString(IDS_STATE_LABEL).c_str()); | 210 SetDlgItemText(IDC_STATE_LABEL, LoadLocalString(IDS_STATE_LABEL).c_str()); |
| 211 SetDlgItemText(IDC_USER_LABEL, LoadLocalString(IDS_USER_LABEL).c_str()); | 211 SetDlgItemText(IDC_USER_LABEL, LoadLocalString(IDS_USER_LABEL).c_str()); |
| 212 SetDlgItemText(IDC_PASSWORD_LABEL, | 212 SetDlgItemText(IDC_PASSWORD_LABEL, |
| 213 LoadLocalString(IDS_PASSWORD_LABEL).c_str()); | 213 LoadLocalString(IDS_PASSWORD_LABEL).c_str()); |
| 214 SetDlgItemText(IDC_LOGGING, LoadLocalString(IDS_LOGGING_LABEL).c_str()); | 214 SetDlgItemText(IDC_LOGGING, LoadLocalString(IDS_LOGGING_LABEL).c_str()); |
| 215 SetDlgItemText(IDCANCEL, LoadLocalString(IDS_CLOSE).c_str()); | 215 SetDlgItemText(IDCANCEL, LoadLocalString(IDS_CLOSE).c_str()); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 421 | 421 |
| 422 CloudPrintServiceSetupModule _AtlModule; | 422 CloudPrintServiceSetupModule _AtlModule; |
| 423 | 423 |
| 424 int WINAPI WinMain(__in HINSTANCE hInstance, | 424 int WINAPI WinMain(__in HINSTANCE hInstance, |
| 425 __in HINSTANCE hPrevInstance, | 425 __in HINSTANCE hPrevInstance, |
| 426 __in LPSTR lpCmdLine, | 426 __in LPSTR lpCmdLine, |
| 427 __in int nCmdShow) { | 427 __in int nCmdShow) { |
| 428 base::AtExitManager at_exit; | 428 base::AtExitManager at_exit; |
| 429 CommandLine::Init(0, NULL); | 429 CommandLine::Init(0, NULL); |
| 430 | 430 |
| 431 HRESULT result = ProcessInstallerSwitches(); | |
| 432 if (result != S_FALSE) | |
|
gene
2013/04/23 01:13:59
???
Vitaly Buka (NO REVIEWS)
2013/04/23 04:58:51
Done.
| |
| 433 return result; | |
| 434 | |
| 431 MessageLoopForUI loop; | 435 MessageLoopForUI loop; |
| 432 scoped_refptr<SetupDialog> dialog(new SetupDialog()); | 436 scoped_refptr<SetupDialog> dialog(new SetupDialog()); |
| 433 dialog->Create(NULL); | 437 dialog->Create(NULL); |
| 434 dialog->ShowWindow(SW_SHOW); | 438 dialog->ShowWindow(SW_SHOW); |
| 435 scoped_ptr<SetupDialog::MessageFilter> filter( | 439 scoped_ptr<SetupDialog::MessageFilter> filter( |
| 436 new SetupDialog::MessageFilter(dialog)); | 440 new SetupDialog::MessageFilter(dialog)); |
| 437 loop.SetMessageFilter(filter.Pass()); | 441 loop.SetMessageFilter(filter.Pass()); |
| 438 | 442 |
| 439 loop.Run(); | 443 loop.Run(); |
| 440 return 0; | 444 return 0; |
| 441 } | 445 } |
| OLD | NEW |