| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/options/extension_settings_handler.h" | 5 #include "chrome/browser/ui/webui/options/extension_settings_handler.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/base64.h" | 8 #include "base/base64.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
| 14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "base/version.h" | 16 #include "base/version.h" |
| 17 #include "chrome/browser/debugger/devtools_window.h" | 17 #include "chrome/browser/debugger/devtools_window.h" |
| 18 #include "chrome/browser/extensions/crx_installer.h" | 18 #include "chrome/browser/extensions/crx_installer.h" |
| 19 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h" | 19 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h" |
| 20 #include "chrome/browser/extensions/extension_service.h" | 20 #include "chrome/browser/extensions/extension_service.h" |
| 21 #include "chrome/browser/extensions/extension_updater.h" | 21 #include "chrome/browser/extensions/extension_updater.h" |
| 22 #include "chrome/browser/extensions/extension_warning_set.h" | 22 #include "chrome/browser/extensions/extension_warning_set.h" |
| 23 #include "chrome/browser/extensions/unpacked_installer.h" |
| 23 #include "chrome/browser/google/google_util.h" | 24 #include "chrome/browser/google/google_util.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/tab_contents/background_contents.h" | 26 #include "chrome/browser/tab_contents/background_contents.h" |
| 26 #include "chrome/browser/ui/webui/extension_icon_source.h" | 27 #include "chrome/browser/ui/webui/extension_icon_source.h" |
| 27 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
| 28 #include "chrome/common/chrome_view_types.h" | 29 #include "chrome/common/chrome_view_types.h" |
| 29 #include "chrome/common/extensions/extension.h" | 30 #include "chrome/common/extensions/extension.h" |
| 30 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
| 31 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
| 32 #include "content/browser/browsing_instance.h" | 33 #include "content/browser/browsing_instance.h" |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 | 421 |
| 421 void ExtensionSettingsHandler::HandleShowButtonMessage(const ListValue* args) { | 422 void ExtensionSettingsHandler::HandleShowButtonMessage(const ListValue* args) { |
| 422 const Extension* extension = GetExtension(args); | 423 const Extension* extension = GetExtension(args); |
| 423 extension_service_->SetBrowserActionVisibility(extension, true); | 424 extension_service_->SetBrowserActionVisibility(extension, true); |
| 424 } | 425 } |
| 425 | 426 |
| 426 void ExtensionSettingsHandler::HandleLoadMessage(const ListValue* args) { | 427 void ExtensionSettingsHandler::HandleLoadMessage(const ListValue* args) { |
| 427 FilePath::StringType string_path; | 428 FilePath::StringType string_path; |
| 428 CHECK_EQ(1U, args->GetSize()) << args->GetSize(); | 429 CHECK_EQ(1U, args->GetSize()) << args->GetSize(); |
| 429 CHECK(args->GetString(0, &string_path)); | 430 CHECK(args->GetString(0, &string_path)); |
| 430 extension_service_->LoadExtension(FilePath(string_path)); | 431 extensions::UnpackedInstaller::Create(extension_service_)-> |
| 432 Load(FilePath(string_path)); |
| 431 } | 433 } |
| 432 | 434 |
| 433 void ExtensionSettingsHandler::ShowAlert(const std::string& message) { | 435 void ExtensionSettingsHandler::ShowAlert(const std::string& message) { |
| 434 ListValue arguments; | 436 ListValue arguments; |
| 435 arguments.Append(Value::CreateStringValue(message)); | 437 arguments.Append(Value::CreateStringValue(message)); |
| 436 web_ui_->CallJavascriptFunction("alert", arguments); | 438 web_ui_->CallJavascriptFunction("alert", arguments); |
| 437 } | 439 } |
| 438 | 440 |
| 439 void ExtensionSettingsHandler::HandleAutoUpdateMessage(const ListValue* args) { | 441 void ExtensionSettingsHandler::HandleAutoUpdateMessage(const ListValue* args) { |
| 440 ExtensionUpdater* updater = extension_service_->updater(); | 442 ExtensionUpdater* updater = extension_service_->updater(); |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 chrome::VIEW_TYPE_EXTENSION_DIALOG == host_type) | 776 chrome::VIEW_TYPE_EXTENSION_DIALOG == host_type) |
| 775 continue; | 777 continue; |
| 776 | 778 |
| 777 GURL url = host->delegate()->GetURL(); | 779 GURL url = host->delegate()->GetURL(); |
| 778 RenderProcessHost* process = host->process(); | 780 RenderProcessHost* process = host->process(); |
| 779 result->push_back( | 781 result->push_back( |
| 780 ExtensionPage(url, process->id(), host->routing_id(), | 782 ExtensionPage(url, process->id(), host->routing_id(), |
| 781 process->browser_context()->IsOffTheRecord())); | 783 process->browser_context()->IsOffTheRecord())); |
| 782 } | 784 } |
| 783 } | 785 } |
| OLD | NEW |