| 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 "chrome/browser/ui/webui/extensions/install_extension_handler.h" | 5 #include "chrome/browser/ui/webui/extensions/install_extension_handler.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 } | 31 } |
| 32 | 32 |
| 33 InstallExtensionHandler::~InstallExtensionHandler() { | 33 InstallExtensionHandler::~InstallExtensionHandler() { |
| 34 } | 34 } |
| 35 | 35 |
| 36 void InstallExtensionHandler::GetLocalizedValues( | 36 void InstallExtensionHandler::GetLocalizedValues( |
| 37 content::WebUIDataSource* source) { | 37 content::WebUIDataSource* source) { |
| 38 source->AddString( | 38 source->AddString( |
| 39 "extensionSettingsInstallDropTarget", | 39 "extensionSettingsInstallDropTarget", |
| 40 l10n_util::GetStringUTF16(IDS_EXTENSIONS_INSTALL_DROP_TARGET)); | 40 l10n_util::GetStringUTF16(IDS_EXTENSIONS_INSTALL_DROP_TARGET)); |
| 41 source->AddBoolean( | |
| 42 "offStoreInstallEnabled", | |
| 43 FeatureSwitch::easy_off_store_install()->IsEnabled()); | |
| 44 } | 41 } |
| 45 | 42 |
| 46 void InstallExtensionHandler::RegisterMessages() { | 43 void InstallExtensionHandler::RegisterMessages() { |
| 47 web_ui()->RegisterMessageCallback( | 44 web_ui()->RegisterMessageCallback( |
| 48 "startDrag", | 45 "startDrag", |
| 49 base::Bind(&InstallExtensionHandler::HandleStartDragMessage, | 46 base::Bind(&InstallExtensionHandler::HandleStartDragMessage, |
| 50 base::Unretained(this))); | 47 base::Unretained(this))); |
| 51 web_ui()->RegisterMessageCallback( | 48 web_ui()->RegisterMessageCallback( |
| 52 "stopDrag", | 49 "stopDrag", |
| 53 base::Bind(&InstallExtensionHandler::HandleStopDragMessage, | 50 base::Bind(&InstallExtensionHandler::HandleStopDragMessage, |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 void InstallExtensionHandler::HandleInstallDirectoryMessage( | 128 void InstallExtensionHandler::HandleInstallDirectoryMessage( |
| 132 const base::ListValue* args) { | 129 const base::ListValue* args) { |
| 133 Profile* profile = Profile::FromBrowserContext( | 130 Profile* profile = Profile::FromBrowserContext( |
| 134 web_ui()->GetWebContents()->GetBrowserContext()); | 131 web_ui()->GetWebContents()->GetBrowserContext()); |
| 135 UnpackedInstaller::Create( | 132 UnpackedInstaller::Create( |
| 136 ExtensionSystem::Get(profile)-> | 133 ExtensionSystem::Get(profile)-> |
| 137 extension_service())->Load(file_to_install_); | 134 extension_service())->Load(file_to_install_); |
| 138 } | 135 } |
| 139 | 136 |
| 140 } // namespace extensions | 137 } // namespace extensions |
| OLD | NEW |