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