| 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) | 31 #if !defined(OS_MACOSX) // TODO(port) |
| 32 #include "chrome/browser/extensions/extension_creator.h" | 32 #include "chrome/browser/extensions/extension_creator.h" |
| 33 #endif | 33 #endif |
| 34 #include "chrome/browser/extensions/extensions_service.h" | 34 #include "chrome/browser/extensions/extensions_service.h" |
| 35 #include "chrome/browser/extensions/user_script_master.h" | 35 #include "chrome/browser/extensions/user_script_master.h" |
| 36 #include "chrome/browser/first_run.h" | 36 #include "chrome/browser/first_run.h" |
| 37 #include "chrome/browser/net/dns_global.h" | 37 #include "chrome/browser/net/dns_global.h" |
| 38 #include "chrome/browser/profile.h" | 38 #include "chrome/browser/profile.h" |
| 39 #include "chrome/browser/renderer_host/render_process_host.h" | 39 #include "chrome/browser/renderer_host/render_process_host.h" |
| 40 #include "chrome/browser/search_engines/template_url_model.h" | 40 #include "chrome/browser/search_engines/template_url_model.h" |
| 41 #include "chrome/browser/session_startup_pref.h" | 41 #include "chrome/browser/session_startup_pref.h" |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 FilePath output(src_dir.DirName().Append(src_dir.BaseName().value())); | 740 FilePath output(src_dir.DirName().Append(src_dir.BaseName().value())); |
| 741 FilePath crx_path(output); | 741 FilePath crx_path(output); |
| 742 crx_path = crx_path.ReplaceExtension(chrome::kExtensionFileExtension); | 742 crx_path = crx_path.ReplaceExtension(chrome::kExtensionFileExtension); |
| 743 FilePath output_private_key_path; | 743 FilePath output_private_key_path; |
| 744 if (private_key_path.empty()) { | 744 if (private_key_path.empty()) { |
| 745 output_private_key_path = FilePath(output); | 745 output_private_key_path = FilePath(output); |
| 746 output_private_key_path = | 746 output_private_key_path = |
| 747 output_private_key_path.ReplaceExtension(FILE_PATH_LITERAL("pem")); | 747 output_private_key_path.ReplaceExtension(FILE_PATH_LITERAL("pem")); |
| 748 } | 748 } |
| 749 | 749 |
| 750 // TODO(port): Creation & running is removed from mac & linux because | 750 // TODO(port): Creation & running is removed from Mac because |
| 751 // ExtensionCreator depends on base/crypto/rsa_private_key and | 751 // ExtensionCreator depends on base/crypto/signature_creator |
| 752 // base/crypto/signature_creator, both of which only have windows | 752 #if !defined(OS_MACOSX) |
| 753 // implementations. | |
| 754 #if defined(OS_WIN) | |
| 755 scoped_ptr<ExtensionCreator> creator(new ExtensionCreator()); | 753 scoped_ptr<ExtensionCreator> creator(new ExtensionCreator()); |
| 756 if (creator->Run(src_dir, crx_path, private_key_path, | 754 if (creator->Run(src_dir, crx_path, private_key_path, |
| 757 output_private_key_path)) { | 755 output_private_key_path)) { |
| 758 std::wstring message; | 756 std::wstring message; |
| 759 if (private_key_path.value().empty()) { | 757 if (private_key_path.value().empty()) { |
| 760 message = StringPrintf( | 758 message = StringPrintf( |
| 761 L"Created the following files:\n\n" | 759 L"Created the following files:\n\n" |
| 762 L"Extension: %ls\n" | 760 L"Extension: %ls\n" |
| 763 L"Key File: %ls\n\n" | 761 L"Key File: %ls\n\n" |
| 764 L"Keep your key file in a safe place. You will need it to create " | 762 L"Keep your key file in a safe place. You will need it to create " |
| 765 L"new versions of your extension.", | 763 L"new versions of your extension.", |
| 766 crx_path.ToWStringHack().c_str(), | 764 crx_path.ToWStringHack().c_str(), |
| 767 output_private_key_path.ToWStringHack().c_str()); | 765 output_private_key_path.ToWStringHack().c_str()); |
| 768 } else { | 766 } else { |
| 769 message = StringPrintf(L"Created the extension:\n\n%ls", | 767 message = StringPrintf(L"Created the extension:\n\n%ls", |
| 770 crx_path.ToWStringHack().c_str()); | 768 crx_path.ToWStringHack().c_str()); |
| 771 } | 769 } |
| 770 #if defined(OS_WIN) |
| 772 win_util::MessageBox(NULL, message, L"Extension Packaging Success", | 771 win_util::MessageBox(NULL, message, L"Extension Packaging Success", |
| 773 MB_OK | MB_SETFOREGROUND); | 772 MB_OK | MB_SETFOREGROUND); |
| 773 #else |
| 774 fprintf(stderr, "Extension Packaging Success"); |
| 775 #endif |
| 774 } else { | 776 } else { |
| 777 #if defined(OS_WIN) |
| 775 win_util::MessageBox(NULL, UTF8ToWide(creator->error_message()), | 778 win_util::MessageBox(NULL, UTF8ToWide(creator->error_message()), |
| 776 L"Extension Packaging Error", MB_OK | MB_SETFOREGROUND); | 779 L"Extension Packaging Error", MB_OK | MB_SETFOREGROUND); |
| 780 #else |
| 781 fprintf(stderr, "Extension Packaging Error: %s", creator->error_message(
).c_str()); |
| 782 #endif |
| 777 return false; | 783 return false; |
| 778 } | 784 } |
| 779 #else | 785 #else |
| 780 NOTIMPLEMENTED() << " extension creation not implemented on POSIX."; | 786 NOTIMPLEMENTED() << " extension creation not implemented on Mac."; |
| 781 #endif // defined(OS_WIN) | 787 #endif // !defined(OS_MACOSX) |
| 782 return false; | 788 return false; |
| 783 } | 789 } |
| 784 } | 790 } |
| 785 | 791 |
| 786 // Allow the command line to override the persisted setting of home page. | 792 // Allow the command line to override the persisted setting of home page. |
| 787 SetOverrideHomePage(command_line, profile->GetPrefs()); | 793 SetOverrideHomePage(command_line, profile->GetPrefs()); |
| 788 | 794 |
| 789 bool silent_launch = false; | 795 bool silent_launch = false; |
| 790 if (command_line.HasSwitch(switches::kAutomationClientChannelID)) { | 796 if (command_line.HasSwitch(switches::kAutomationClientChannelID)) { |
| 791 std::string automation_channel_id = WideToASCII( | 797 std::string automation_channel_id = WideToASCII( |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 scoped_refptr<AutomationProviderClass> automation = | 829 scoped_refptr<AutomationProviderClass> automation = |
| 824 new AutomationProviderClass(profile); | 830 new AutomationProviderClass(profile); |
| 825 automation->ConnectToChannel(channel_id); | 831 automation->ConnectToChannel(channel_id); |
| 826 automation->SetExpectedTabCount(expected_tabs); | 832 automation->SetExpectedTabCount(expected_tabs); |
| 827 | 833 |
| 828 AutomationProviderList* list = | 834 AutomationProviderList* list = |
| 829 g_browser_process->InitAutomationProviderList(); | 835 g_browser_process->InitAutomationProviderList(); |
| 830 DCHECK(list); | 836 DCHECK(list); |
| 831 list->AddProvider(automation); | 837 list->AddProvider(automation); |
| 832 } | 838 } |
| OLD | NEW |