Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: chrome/browser/ui/webui/options/extension_settings_handler.cc

Issue 6772022: Make <all_urls> and file:///* in permissions trigger "Allow file access" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ExtensionModuleApiTest.(In)CognitoNoFile. Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/extensions/extensions_ui.h" 5 #include "chrome/browser/extensions/extensions_ui.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 url_patterns.begin(); 798 url_patterns.begin();
799 url_pattern != url_patterns.end(); ++url_pattern) { 799 url_pattern != url_patterns.end(); ++url_pattern) {
800 url_pattern_list->Append(new StringValue(url_pattern->GetAsString())); 800 url_pattern_list->Append(new StringValue(url_pattern->GetAsString()));
801 } 801 }
802 802
803 script_data->Set("matches", url_pattern_list); 803 script_data->Set("matches", url_pattern_list);
804 804
805 return script_data; 805 return script_data;
806 } 806 }
807 807
808 static bool ExtensionWantsFileAccess(const Extension* extension) {
809 for (UserScriptList::const_iterator it = extension->content_scripts().begin();
810 it != extension->content_scripts().end(); ++it) {
811 for (UserScript::PatternList::const_iterator pattern =
812 it->url_patterns().begin();
813 pattern != it->url_patterns().end(); ++pattern) {
814 if (pattern->MatchesScheme(chrome::kFileScheme))
815 return true;
816 }
817 }
818
819 return false;
820 }
821
822 // Static 808 // Static
823 DictionaryValue* ExtensionsDOMHandler::CreateExtensionDetailValue( 809 DictionaryValue* ExtensionsDOMHandler::CreateExtensionDetailValue(
824 ExtensionService* service, const Extension* extension, 810 ExtensionService* service, const Extension* extension,
825 const std::vector<ExtensionPage>& pages, bool enabled, bool terminated) { 811 const std::vector<ExtensionPage>& pages, bool enabled, bool terminated) {
826 DictionaryValue* extension_data = new DictionaryValue(); 812 DictionaryValue* extension_data = new DictionaryValue();
827 813
828 extension_data->SetString("id", extension->id()); 814 extension_data->SetString("id", extension->id());
829 extension_data->SetString("name", extension->name()); 815 extension_data->SetString("name", extension->name());
830 extension_data->SetString("description", extension->description()); 816 extension_data->SetString("description", extension->description());
831 extension_data->SetString("version", extension->version()->GetString()); 817 extension_data->SetString("version", extension->version()->GetString());
832 extension_data->SetBoolean("enabled", enabled); 818 extension_data->SetBoolean("enabled", enabled);
833 extension_data->SetBoolean("terminated", terminated); 819 extension_data->SetBoolean("terminated", terminated);
834 extension_data->SetBoolean("enabledIncognito", 820 extension_data->SetBoolean("enabledIncognito",
835 service ? service->IsIncognitoEnabled(extension) : false); 821 service ? service->IsIncognitoEnabled(extension) : false);
836 extension_data->SetBoolean("wantsFileAccess", 822 extension_data->SetBoolean("wantsFileAccess", extension->wants_file_access());
837 ExtensionWantsFileAccess(extension));
838 extension_data->SetBoolean("allowFileAccess", 823 extension_data->SetBoolean("allowFileAccess",
839 service ? service->AllowFileAccess(extension) : false); 824 service ? service->AllowFileAccess(extension) : false);
840 extension_data->SetBoolean("allow_reload", 825 extension_data->SetBoolean("allow_reload",
841 extension->location() == Extension::LOAD); 826 extension->location() == Extension::LOAD);
842 extension_data->SetBoolean("is_hosted_app", extension->is_hosted_app()); 827 extension_data->SetBoolean("is_hosted_app", extension->is_hosted_app());
843 828
844 // Determine the sort order: Extensions loaded through --load-extensions show 829 // Determine the sort order: Extensions loaded through --load-extensions show
845 // up at the top. Disabled extensions show up at the bottom. 830 // up at the top. Disabled extensions show up at the bottom.
846 if (extension->location() == Extension::LOAD) 831 if (extension->location() == Extension::LOAD)
847 extension_data->SetInteger("order", 1); 832 extension_data->SetInteger("order", 1);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 // static 973 // static
989 RefCountedMemory* ExtensionsUI::GetFaviconResourceBytes() { 974 RefCountedMemory* ExtensionsUI::GetFaviconResourceBytes() {
990 return ResourceBundle::GetSharedInstance(). 975 return ResourceBundle::GetSharedInstance().
991 LoadDataResourceBytes(IDR_PLUGIN); 976 LoadDataResourceBytes(IDR_PLUGIN);
992 } 977 }
993 978
994 // static 979 // static
995 void ExtensionsUI::RegisterUserPrefs(PrefService* prefs) { 980 void ExtensionsUI::RegisterUserPrefs(PrefService* prefs) {
996 prefs->RegisterBooleanPref(prefs::kExtensionsUIDeveloperMode, false); 981 prefs->RegisterBooleanPref(prefs::kExtensionsUIDeveloperMode, false);
997 } 982 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698