| 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/extensions/extensions_ui.h" | 5 #include "chrome/browser/extensions/extensions_ui.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 return; | 619 return; |
| 620 } | 620 } |
| 621 | 621 |
| 622 pack_job_ = new PackExtensionJob(this, root_directory, key_file); | 622 pack_job_ = new PackExtensionJob(this, root_directory, key_file); |
| 623 pack_job_->Start(); | 623 pack_job_->Start(); |
| 624 } | 624 } |
| 625 | 625 |
| 626 void ExtensionsDOMHandler::OnPackSuccess(const FilePath& crx_file, | 626 void ExtensionsDOMHandler::OnPackSuccess(const FilePath& crx_file, |
| 627 const FilePath& pem_file) { | 627 const FilePath& pem_file) { |
| 628 std::string message; | 628 std::string message; |
| 629 // TODO we probably shouldn't use ToWStringHack() -- what's the right thing to |
| 630 // do? |
| 629 if (!pem_file.empty()) { | 631 if (!pem_file.empty()) { |
| 630 message = WideToUTF8(l10n_util::GetStringF( | 632 message = WideToUTF8(l10n_util::GetStringF( |
| 631 IDS_EXTENSION_PACK_DIALOG_SUCCESS_BODY_NEW, | 633 IDS_EXTENSION_PACK_DIALOG_SUCCESS_BODY_NEW, |
| 632 crx_file.ToWStringHack(), | 634 crx_file.ToWStringHack(), |
| 633 pem_file.ToWStringHack())); | 635 pem_file.ToWStringHack())); |
| 634 } else { | 636 } else { |
| 635 message = WideToUTF8(l10n_util::GetStringF( | 637 message = WideToUTF8(l10n_util::GetStringF( |
| 636 IDS_EXTENSION_PACK_DIALOG_SUCCESS_BODY_UPDATE, | 638 IDS_EXTENSION_PACK_DIALOG_SUCCESS_BODY_UPDATE, |
| 637 crx_file.ToWStringHack())); | 639 crx_file.ToWStringHack())); |
| 638 } | 640 } |
| 639 ShowAlert(message); | 641 ShowAlert(message); |
| 640 | 642 |
| 641 ListValue results; | 643 ListValue results; |
| 642 dom_ui_->CallJavascriptFunction(L"hidePackDialog", results); | 644 dom_ui_->CallJavascriptFunction(L"hidePackDialog", results); |
| 643 } | 645 } |
| 644 | 646 |
| 645 void ExtensionsDOMHandler::OnPackFailure(const std::wstring& error) { | 647 void ExtensionsDOMHandler::OnPackFailure(const std::string& error) { |
| 646 ShowAlert(WideToUTF8(error)); | 648 ShowAlert(error); |
| 647 } | 649 } |
| 648 | 650 |
| 649 void ExtensionsDOMHandler::HandleAutoUpdateMessage(const Value* value) { | 651 void ExtensionsDOMHandler::HandleAutoUpdateMessage(const Value* value) { |
| 650 ExtensionUpdater* updater = extensions_service_->updater(); | 652 ExtensionUpdater* updater = extensions_service_->updater(); |
| 651 if (updater) { | 653 if (updater) { |
| 652 updater->CheckNow(); | 654 updater->CheckNow(); |
| 653 } | 655 } |
| 654 } | 656 } |
| 655 | 657 |
| 656 void ExtensionsDOMHandler::HandleSelectFilePathMessage(const Value* value) { | 658 void ExtensionsDOMHandler::HandleSelectFilePathMessage(const Value* value) { |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 // static | 945 // static |
| 944 RefCountedMemory* ExtensionsUI::GetFaviconResourceBytes() { | 946 RefCountedMemory* ExtensionsUI::GetFaviconResourceBytes() { |
| 945 return ResourceBundle::GetSharedInstance(). | 947 return ResourceBundle::GetSharedInstance(). |
| 946 LoadDataResourceBytes(IDR_PLUGIN); | 948 LoadDataResourceBytes(IDR_PLUGIN); |
| 947 } | 949 } |
| 948 | 950 |
| 949 // static | 951 // static |
| 950 void ExtensionsUI::RegisterUserPrefs(PrefService* prefs) { | 952 void ExtensionsUI::RegisterUserPrefs(PrefService* prefs) { |
| 951 prefs->RegisterBooleanPref(prefs::kExtensionsUIDeveloperMode, false); | 953 prefs->RegisterBooleanPref(prefs::kExtensionsUIDeveloperMode, false); |
| 952 } | 954 } |
| OLD | NEW |