| 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/extension_settings_handler.h" | 5 #include "chrome/browser/ui/webui/extensions/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" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "chrome/browser/extensions/extension_warning_set.h" | 24 #include "chrome/browser/extensions/extension_warning_set.h" |
| 25 #include "chrome/browser/extensions/lazy_background_task_queue.h" | 25 #include "chrome/browser/extensions/lazy_background_task_queue.h" |
| 26 #include "chrome/browser/extensions/unpacked_installer.h" | 26 #include "chrome/browser/extensions/unpacked_installer.h" |
| 27 #include "chrome/browser/extensions/updater/extension_updater.h" | 27 #include "chrome/browser/extensions/updater/extension_updater.h" |
| 28 #include "chrome/browser/google/google_util.h" | 28 #include "chrome/browser/google/google_util.h" |
| 29 #include "chrome/browser/managed_mode.h" | 29 #include "chrome/browser/managed_mode.h" |
| 30 #include "chrome/browser/prefs/pref_service.h" | 30 #include "chrome/browser/prefs/pref_service.h" |
| 31 #include "chrome/browser/profiles/profile.h" | 31 #include "chrome/browser/profiles/profile.h" |
| 32 #include "chrome/browser/tab_contents/background_contents.h" | 32 #include "chrome/browser/tab_contents/background_contents.h" |
| 33 #include "chrome/browser/ui/browser_finder.h" | 33 #include "chrome/browser/ui/browser_finder.h" |
| 34 #include "chrome/browser/ui/chrome_select_file_policy.h" | |
| 35 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 34 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| 36 #include "chrome/browser/view_type_utils.h" | 35 #include "chrome/browser/view_type_utils.h" |
| 37 #include "chrome/common/chrome_notification_types.h" | 36 #include "chrome/common/chrome_notification_types.h" |
| 38 #include "chrome/common/chrome_switches.h" | 37 #include "chrome/common/chrome_switches.h" |
| 39 #include "chrome/common/extensions/extension.h" | 38 #include "chrome/common/extensions/extension.h" |
| 40 #include "chrome/common/extensions/extension_icon_set.h" | 39 #include "chrome/common/extensions/extension_icon_set.h" |
| 41 #include "chrome/common/extensions/extension_set.h" | 40 #include "chrome/common/extensions/extension_set.h" |
| 42 #include "chrome/common/pref_names.h" | 41 #include "chrome/common/pref_names.h" |
| 43 #include "chrome/common/url_constants.h" | 42 #include "chrome/common/url_constants.h" |
| 44 #include "content/public/browser/notification_service.h" | 43 #include "content/public/browser/notification_service.h" |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 | 723 |
| 725 void ExtensionSettingsHandler::HandleLoadUnpackedExtensionMessage( | 724 void ExtensionSettingsHandler::HandleLoadUnpackedExtensionMessage( |
| 726 const ListValue* args) { | 725 const ListValue* args) { |
| 727 DCHECK(args->empty()); | 726 DCHECK(args->empty()); |
| 728 | 727 |
| 729 string16 select_title = | 728 string16 select_title = |
| 730 l10n_util::GetStringUTF16(IDS_EXTENSION_LOAD_FROM_DIRECTORY); | 729 l10n_util::GetStringUTF16(IDS_EXTENSION_LOAD_FROM_DIRECTORY); |
| 731 | 730 |
| 732 const int kFileTypeIndex = 0; // No file type information to index. | 731 const int kFileTypeIndex = 0; // No file type information to index. |
| 733 const SelectFileDialog::Type kSelectType = SelectFileDialog::SELECT_FOLDER; | 732 const SelectFileDialog::Type kSelectType = SelectFileDialog::SELECT_FOLDER; |
| 734 load_extension_dialog_ = SelectFileDialog::Create( | 733 load_extension_dialog_ = SelectFileDialog::Create(this); |
| 735 this, new ChromeSelectFilePolicy(web_ui()->GetWebContents())); | |
| 736 load_extension_dialog_->SelectFile( | 734 load_extension_dialog_->SelectFile( |
| 737 kSelectType, select_title, last_unpacked_directory_, NULL, | 735 kSelectType, select_title, last_unpacked_directory_, NULL, |
| 738 kFileTypeIndex, FILE_PATH_LITERAL(""), | 736 kFileTypeIndex, FILE_PATH_LITERAL(""), web_ui()->GetWebContents(), |
| 739 web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), NULL); | 737 web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), NULL); |
| 740 } | 738 } |
| 741 | 739 |
| 742 void ExtensionSettingsHandler::ShowAlert(const std::string& message) { | 740 void ExtensionSettingsHandler::ShowAlert(const std::string& message) { |
| 743 ListValue arguments; | 741 ListValue arguments; |
| 744 arguments.Append(Value::CreateStringValue(message)); | 742 arguments.Append(Value::CreateStringValue(message)); |
| 745 web_ui()->CallJavascriptFunction("alert", arguments); | 743 web_ui()->CallJavascriptFunction("alert", arguments); |
| 746 } | 744 } |
| 747 | 745 |
| 748 const Extension* ExtensionSettingsHandler::GetActiveExtension( | 746 const Extension* ExtensionSettingsHandler::GetActiveExtension( |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 return extension_uninstall_dialog_.get(); | 871 return extension_uninstall_dialog_.get(); |
| 874 #else | 872 #else |
| 875 return NULL; | 873 return NULL; |
| 876 #endif // !defined(OS_ANDROID) | 874 #endif // !defined(OS_ANDROID) |
| 877 } | 875 } |
| 878 | 876 |
| 879 void ExtensionSettingsHandler::InspectExtensionHost(ExtensionHost* host) { | 877 void ExtensionSettingsHandler::InspectExtensionHost(ExtensionHost* host) { |
| 880 if (host) | 878 if (host) |
| 881 DevToolsWindow::OpenDevToolsWindow(host->render_view_host()); | 879 DevToolsWindow::OpenDevToolsWindow(host->render_view_host()); |
| 882 } | 880 } |
| OLD | NEW |