OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/extensions/extensions_ui.h" | 5 #include "chrome/browser/extensions/extensions_ui.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 // Determine the sort order: Extensions loaded through --load-extensions show | 745 // Determine the sort order: Extensions loaded through --load-extensions show |
746 // up at the top. Disabled extensions show up at the bottom. | 746 // up at the top. Disabled extensions show up at the bottom. |
747 if (extension->location() == Extension::LOAD) | 747 if (extension->location() == Extension::LOAD) |
748 extension_data->SetInteger(L"order", 1); | 748 extension_data->SetInteger(L"order", 1); |
749 else | 749 else |
750 extension_data->SetInteger(L"order", 2); | 750 extension_data->SetInteger(L"order", 2); |
751 | 751 |
752 if (!extension->options_url().is_empty()) | 752 if (!extension->options_url().is_empty()) |
753 extension_data->SetString(L"options_url", extension->options_url().spec()); | 753 extension_data->SetString(L"options_url", extension->options_url().spec()); |
754 | 754 |
755 // Add list of content_script detail DictionaryValues | 755 // Add list of content_script detail DictionaryValues. |
756 ListValue *content_script_list = new ListValue(); | 756 ListValue *content_script_list = new ListValue(); |
757 UserScriptList content_scripts = extension->content_scripts(); | 757 UserScriptList content_scripts = extension->content_scripts(); |
758 for (UserScriptList::const_iterator script = content_scripts.begin(); | 758 for (UserScriptList::const_iterator script = content_scripts.begin(); |
759 script != content_scripts.end(); ++script) { | 759 script != content_scripts.end(); ++script) { |
760 content_script_list->Append( | 760 content_script_list->Append( |
761 CreateContentScriptDetailValue(*script, extension->path())); | 761 CreateContentScriptDetailValue(*script, extension->path())); |
762 } | 762 } |
763 extension_data->Set(L"content_scripts", content_script_list); | 763 extension_data->Set(L"content_scripts", content_script_list); |
764 | 764 |
765 // Add permissions | 765 // Add permissions. |
766 ListValue *permission_list = new ListValue; | 766 ListValue *permission_list = new ListValue; |
767 std::vector<URLPattern> permissions = extension->host_permissions(); | 767 std::vector<URLPattern> permissions = extension->host_permissions(); |
768 for (std::vector<URLPattern>::iterator permission = permissions.begin(); | 768 for (std::vector<URLPattern>::iterator permission = permissions.begin(); |
769 permission != permissions.end(); ++permission) { | 769 permission != permissions.end(); ++permission) { |
770 permission_list->Append(Value::CreateStringValue( | 770 permission_list->Append(Value::CreateStringValue( |
771 permission->GetAsString())); | 771 permission->GetAsString())); |
772 } | 772 } |
773 extension_data->Set(L"permissions", permission_list); | 773 extension_data->Set(L"permissions", permission_list); |
774 | 774 |
775 // Add views | 775 // Add views |
776 ListValue* views = new ListValue; | 776 ListValue* views = new ListValue; |
777 for (std::vector<ExtensionPage>::const_iterator iter = pages.begin(); | 777 for (std::vector<ExtensionPage>::const_iterator iter = pages.begin(); |
778 iter != pages.end(); ++iter) { | 778 iter != pages.end(); ++iter) { |
779 DictionaryValue* view_value = new DictionaryValue; | 779 DictionaryValue* view_value = new DictionaryValue; |
780 view_value->SetString(L"path", | 780 view_value->SetString(L"path", |
781 iter->url.path().substr(1, std::string::npos)); // no leading slash | 781 iter->url.path().substr(1, std::string::npos)); // No leading slash. |
782 view_value->SetInteger(L"renderViewId", iter->render_view_id); | 782 view_value->SetInteger(L"renderViewId", iter->render_view_id); |
783 view_value->SetInteger(L"renderProcessId", iter->render_process_id); | 783 view_value->SetInteger(L"renderProcessId", iter->render_process_id); |
784 views->Append(view_value); | 784 views->Append(view_value); |
785 } | 785 } |
786 extension_data->Set(L"views", views); | 786 extension_data->Set(L"views", views); |
787 extension_data->SetBoolean(L"hasPopupAction", | 787 extension_data->SetBoolean(L"hasPopupAction", |
788 extension->browser_action() || extension->page_action()); | 788 extension->browser_action() || extension->page_action()); |
| 789 extension_data->SetString(L"galleryUrl", extension->GalleryUrl().spec()); |
789 | 790 |
790 return extension_data; | 791 return extension_data; |
791 } | 792 } |
792 | 793 |
793 std::vector<ExtensionPage> ExtensionsDOMHandler::GetActivePagesForExtension( | 794 std::vector<ExtensionPage> ExtensionsDOMHandler::GetActivePagesForExtension( |
794 const std::string& extension_id) { | 795 const std::string& extension_id) { |
795 std::vector<ExtensionPage> result; | 796 std::vector<ExtensionPage> result; |
796 std::set<ExtensionFunctionDispatcher*>* all_instances = | 797 std::set<ExtensionFunctionDispatcher*>* all_instances = |
797 ExtensionFunctionDispatcher::all_instances(); | 798 ExtensionFunctionDispatcher::all_instances(); |
798 | 799 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 // static | 851 // static |
851 RefCountedMemory* ExtensionsUI::GetFaviconResourceBytes() { | 852 RefCountedMemory* ExtensionsUI::GetFaviconResourceBytes() { |
852 return ResourceBundle::GetSharedInstance(). | 853 return ResourceBundle::GetSharedInstance(). |
853 LoadDataResourceBytes(IDR_PLUGIN); | 854 LoadDataResourceBytes(IDR_PLUGIN); |
854 } | 855 } |
855 | 856 |
856 // static | 857 // static |
857 void ExtensionsUI::RegisterUserPrefs(PrefService* prefs) { | 858 void ExtensionsUI::RegisterUserPrefs(PrefService* prefs) { |
858 prefs->RegisterBooleanPref(prefs::kExtensionsUIDeveloperMode, false); | 859 prefs->RegisterBooleanPref(prefs::kExtensionsUIDeveloperMode, false); |
859 } | 860 } |
OLD | NEW |