OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/browser_init.h" | 5 #include "chrome/browser/browser_init.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include "app/win_util.h" | 10 #include "app/win_util.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "base/path_service.h" | 21 #include "base/path_service.h" |
22 #include "base/string_util.h" | 22 #include "base/string_util.h" |
23 #include "base/sys_info.h" | 23 #include "base/sys_info.h" |
24 #include "chrome/browser/autocomplete/autocomplete.h" | 24 #include "chrome/browser/autocomplete/autocomplete.h" |
25 #include "chrome/browser/automation/automation_provider.h" | 25 #include "chrome/browser/automation/automation_provider.h" |
26 #include "chrome/browser/automation/automation_provider_list.h" | 26 #include "chrome/browser/automation/automation_provider_list.h" |
27 #include "chrome/browser/browser_list.h" | 27 #include "chrome/browser/browser_list.h" |
28 #include "chrome/browser/browser_process.h" | 28 #include "chrome/browser/browser_process.h" |
29 #include "chrome/browser/browser_window.h" | 29 #include "chrome/browser/browser_window.h" |
30 #include "chrome/browser/defaults.h" | 30 #include "chrome/browser/defaults.h" |
31 #if defined(OS_WIN) // TODO(port) | |
32 #include "chrome/browser/extensions/extension_creator.h" | 31 #include "chrome/browser/extensions/extension_creator.h" |
33 #endif | |
34 #include "chrome/browser/extensions/extensions_service.h" | 32 #include "chrome/browser/extensions/extensions_service.h" |
35 #include "chrome/browser/extensions/user_script_master.h" | 33 #include "chrome/browser/extensions/user_script_master.h" |
36 #include "chrome/browser/first_run.h" | 34 #include "chrome/browser/first_run.h" |
37 #include "chrome/browser/net/dns_global.h" | 35 #include "chrome/browser/net/dns_global.h" |
38 #include "chrome/browser/profile.h" | 36 #include "chrome/browser/profile.h" |
39 #include "chrome/browser/renderer_host/render_process_host.h" | 37 #include "chrome/browser/renderer_host/render_process_host.h" |
40 #include "chrome/browser/search_engines/template_url_model.h" | 38 #include "chrome/browser/search_engines/template_url_model.h" |
41 #include "chrome/browser/session_startup_pref.h" | 39 #include "chrome/browser/session_startup_pref.h" |
42 #include "chrome/browser/sessions/session_restore.h" | 40 #include "chrome/browser/sessions/session_restore.h" |
43 #include "chrome/browser/shell_integration.h" | 41 #include "chrome/browser/shell_integration.h" |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 } | 358 } |
361 #endif | 359 #endif |
362 return true; | 360 return true; |
363 } | 361 } |
364 | 362 |
365 GURL GetWelcomePageURL() { | 363 GURL GetWelcomePageURL() { |
366 std::string welcome_url = l10n_util::GetStringUTF8(IDS_WELCOME_PAGE_URL); | 364 std::string welcome_url = l10n_util::GetStringUTF8(IDS_WELCOME_PAGE_URL); |
367 return GURL(welcome_url); | 365 return GURL(welcome_url); |
368 } | 366 } |
369 | 367 |
| 368 void ShowPackExtensionMessage(const std::wstring caption, |
| 369 const std::wstring message) { |
| 370 #if defined(OS_WIN) |
| 371 win_util::MessageBox(NULL, message, caption, MB_OK | MB_SETFOREGROUND); |
| 372 #else |
| 373 // Just send caption & text to stdout on mac & linux. |
| 374 std::string out_text = WideToASCII(caption); |
| 375 out_text.append("\n\n"); |
| 376 out_text.append(WideToASCII(message)); |
| 377 out_text.append("\n"); |
| 378 printf(out_text.c_str()); |
| 379 #endif |
| 380 } |
| 381 |
370 } // namespace | 382 } // namespace |
371 | 383 |
372 // static | 384 // static |
373 bool BrowserInit::InProcessStartup() { | 385 bool BrowserInit::InProcessStartup() { |
374 return in_startup; | 386 return in_startup; |
375 } | 387 } |
376 | 388 |
377 // LaunchWithProfile ---------------------------------------------------------- | 389 // LaunchWithProfile ---------------------------------------------------------- |
378 | 390 |
379 BrowserInit::LaunchWithProfile::LaunchWithProfile( | 391 BrowserInit::LaunchWithProfile::LaunchWithProfile( |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 if (private_key_path.empty()) { | 756 if (private_key_path.empty()) { |
745 output_private_key_path = FilePath(output); | 757 output_private_key_path = FilePath(output); |
746 output_private_key_path = | 758 output_private_key_path = |
747 output_private_key_path.ReplaceExtension(FILE_PATH_LITERAL("pem")); | 759 output_private_key_path.ReplaceExtension(FILE_PATH_LITERAL("pem")); |
748 } | 760 } |
749 | 761 |
750 // TODO(port): Creation & running is removed from mac & linux because | 762 // TODO(port): Creation & running is removed from mac & linux because |
751 // ExtensionCreator depends on base/crypto/rsa_private_key and | 763 // ExtensionCreator depends on base/crypto/rsa_private_key and |
752 // base/crypto/signature_creator, both of which only have windows | 764 // base/crypto/signature_creator, both of which only have windows |
753 // implementations. | 765 // implementations. |
754 #if defined(OS_WIN) | |
755 scoped_ptr<ExtensionCreator> creator(new ExtensionCreator()); | 766 scoped_ptr<ExtensionCreator> creator(new ExtensionCreator()); |
756 if (creator->Run(src_dir, crx_path, private_key_path, | 767 if (creator->Run(src_dir, crx_path, private_key_path, |
757 output_private_key_path)) { | 768 output_private_key_path)) { |
758 std::wstring message; | 769 std::wstring message; |
759 if (private_key_path.value().empty()) { | 770 if (private_key_path.value().empty()) { |
760 message = StringPrintf( | 771 message = StringPrintf( |
761 L"Created the following files:\n\n" | 772 L"Created the following files:\n\n" |
762 L"Extension: %ls\n" | 773 L"Extension: %ls\n" |
763 L"Key File: %ls\n\n" | 774 L"Key File: %ls\n\n" |
764 L"Keep your key file in a safe place. You will need it to create " | 775 L"Keep your key file in a safe place. You will need it to create " |
765 L"new versions of your extension.", | 776 L"new versions of your extension.", |
766 crx_path.ToWStringHack().c_str(), | 777 crx_path.ToWStringHack().c_str(), |
767 output_private_key_path.ToWStringHack().c_str()); | 778 output_private_key_path.ToWStringHack().c_str()); |
768 } else { | 779 } else { |
769 message = StringPrintf(L"Created the extension:\n\n%ls", | 780 message = StringPrintf(L"Created the extension:\n\n%ls", |
770 crx_path.ToWStringHack().c_str()); | 781 crx_path.ToWStringHack().c_str()); |
771 } | 782 } |
772 win_util::MessageBox(NULL, message, L"Extension Packaging Success", | 783 ShowPackExtensionMessage(L"Extension Packaging Success", message); |
773 MB_OK | MB_SETFOREGROUND); | |
774 } else { | 784 } else { |
775 win_util::MessageBox(NULL, UTF8ToWide(creator->error_message()), | 785 ShowPackExtensionMessage(L"Extension Packaging Error", |
776 L"Extension Packaging Error", MB_OK | MB_SETFOREGROUND); | 786 UTF8ToWide(creator->error_message())); |
777 return false; | 787 return false; |
778 } | 788 } |
779 #else | |
780 NOTIMPLEMENTED() << " extension creation not implemented on POSIX."; | |
781 #endif // defined(OS_WIN) | |
782 return false; | 789 return false; |
783 } | 790 } |
784 } | 791 } |
785 | 792 |
786 // Allow the command line to override the persisted setting of home page. | 793 // Allow the command line to override the persisted setting of home page. |
787 SetOverrideHomePage(command_line, profile->GetPrefs()); | 794 SetOverrideHomePage(command_line, profile->GetPrefs()); |
788 | 795 |
789 bool silent_launch = false; | 796 bool silent_launch = false; |
790 if (command_line.HasSwitch(switches::kAutomationClientChannelID)) { | 797 if (command_line.HasSwitch(switches::kAutomationClientChannelID)) { |
791 std::string automation_channel_id = WideToASCII( | 798 std::string automation_channel_id = WideToASCII( |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 scoped_refptr<AutomationProviderClass> automation = | 830 scoped_refptr<AutomationProviderClass> automation = |
824 new AutomationProviderClass(profile); | 831 new AutomationProviderClass(profile); |
825 automation->ConnectToChannel(channel_id); | 832 automation->ConnectToChannel(channel_id); |
826 automation->SetExpectedTabCount(expected_tabs); | 833 automation->SetExpectedTabCount(expected_tabs); |
827 | 834 |
828 AutomationProviderList* list = | 835 AutomationProviderList* list = |
829 g_browser_process->InitAutomationProviderList(); | 836 g_browser_process->InitAutomationProviderList(); |
830 DCHECK(list); | 837 DCHECK(list); |
831 list->AddProvider(automation); | 838 list->AddProvider(automation); |
832 } | 839 } |
OLD | NEW |