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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 extension->GetHomepageURL().is_valid()); | 125 extension->GetHomepageURL().is_valid()); |
126 | 126 |
127 // Determine the sort order: Extensions loaded through --load-extensions show | 127 // Determine the sort order: Extensions loaded through --load-extensions show |
128 // up at the top. Disabled extensions show up at the bottom. | 128 // up at the top. Disabled extensions show up at the bottom. |
129 if (extension->location() == Extension::LOAD) | 129 if (extension->location() == Extension::LOAD) |
130 extension_data->SetInteger("order", 1); | 130 extension_data->SetInteger("order", 1); |
131 else | 131 else |
132 extension_data->SetInteger("order", 2); | 132 extension_data->SetInteger("order", 2); |
133 | 133 |
134 if (extension_service_ && | 134 if (extension_service_ && |
135 !extension_service_->GetBrowserActionVisibility(extension)) { | 135 !extension_service_->extension_prefs()-> |
| 136 GetBrowserActionVisibility(extension)) { |
136 extension_data->SetBoolean("enable_show_button", true); | 137 extension_data->SetBoolean("enable_show_button", true); |
137 } | 138 } |
138 | 139 |
139 // Add views | 140 // Add views |
140 ListValue* views = new ListValue; | 141 ListValue* views = new ListValue; |
141 for (std::vector<ExtensionPage>::const_iterator iter = pages.begin(); | 142 for (std::vector<ExtensionPage>::const_iterator iter = pages.begin(); |
142 iter != pages.end(); ++iter) { | 143 iter != pages.end(); ++iter) { |
143 DictionaryValue* view_value = new DictionaryValue; | 144 DictionaryValue* view_value = new DictionaryValue; |
144 if (iter->url.scheme() == chrome::kExtensionScheme) { | 145 if (iter->url.scheme() == chrome::kExtensionScheme) { |
145 // No leading slash. | 146 // No leading slash. |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 if (!extension || extension->options_url().is_empty()) | 660 if (!extension || extension->options_url().is_empty()) |
660 return; | 661 return; |
661 Profile::FromWebUI(web_ui())->GetExtensionProcessManager()->OpenOptionsPage( | 662 Profile::FromWebUI(web_ui())->GetExtensionProcessManager()->OpenOptionsPage( |
662 extension, NULL); | 663 extension, NULL); |
663 } | 664 } |
664 | 665 |
665 void ExtensionSettingsHandler::HandleShowButtonMessage(const ListValue* args) { | 666 void ExtensionSettingsHandler::HandleShowButtonMessage(const ListValue* args) { |
666 const Extension* extension = GetActiveExtension(args); | 667 const Extension* extension = GetActiveExtension(args); |
667 if (!extension) | 668 if (!extension) |
668 return; | 669 return; |
669 extension_service_->SetBrowserActionVisibility(extension, true); | 670 extension_service_->extension_prefs()-> |
| 671 SetBrowserActionVisibility(extension, true); |
670 } | 672 } |
671 | 673 |
672 void ExtensionSettingsHandler::HandleAutoUpdateMessage(const ListValue* args) { | 674 void ExtensionSettingsHandler::HandleAutoUpdateMessage(const ListValue* args) { |
673 ExtensionUpdater* updater = extension_service_->updater(); | 675 ExtensionUpdater* updater = extension_service_->updater(); |
674 if (updater) | 676 if (updater) |
675 updater->CheckNow(); | 677 updater->CheckNow(); |
676 } | 678 } |
677 | 679 |
678 void ExtensionSettingsHandler::HandleLoadUnpackedExtensionMessage( | 680 void ExtensionSettingsHandler::HandleLoadUnpackedExtensionMessage( |
679 const ListValue* args) { | 681 const ListValue* args) { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 return extension_uninstall_dialog_.get(); | 822 return extension_uninstall_dialog_.get(); |
821 #else | 823 #else |
822 return NULL; | 824 return NULL; |
823 #endif // !defined(OS_ANDROID) | 825 #endif // !defined(OS_ANDROID) |
824 } | 826 } |
825 | 827 |
826 void ExtensionSettingsHandler::InspectExtensionHost(ExtensionHost* host) { | 828 void ExtensionSettingsHandler::InspectExtensionHost(ExtensionHost* host) { |
827 if (host) | 829 if (host) |
828 DevToolsWindow::OpenDevToolsWindow(host->render_view_host()); | 830 DevToolsWindow::OpenDevToolsWindow(host->render_view_host()); |
829 } | 831 } |
OLD | NEW |