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

Side by Side Diff: chrome/browser/automation/automation_provider_observers.cc

Issue 8733004: Make ExtensionService use ExtensionSet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: + Created 9 years 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/automation/automation_provider_observers.h" 5 #include "chrome/browser/automation/automation_provider_observers.h"
6 6
7 #include <deque> 7 #include <deque>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1999 matching lines...) Expand 10 before | Expand all | Expand 10 after
2010 } 2010 }
2011 delete this; 2011 delete this;
2012 } 2012 }
2013 2013
2014 namespace { 2014 namespace {
2015 2015
2016 // Returns a vector of dictionaries containing information about installed apps, 2016 // Returns a vector of dictionaries containing information about installed apps,
2017 // as identified from a given list of extensions. The caller takes ownership 2017 // as identified from a given list of extensions. The caller takes ownership
2018 // of the created vector. 2018 // of the created vector.
2019 std::vector<DictionaryValue*>* GetAppInfoFromExtensions( 2019 std::vector<DictionaryValue*>* GetAppInfoFromExtensions(
2020 const ExtensionList* extensions, 2020 const ExtensionSet* extensions,
2021 ExtensionService* ext_service) { 2021 ExtensionService* ext_service) {
2022 std::vector<DictionaryValue*>* apps_list = 2022 std::vector<DictionaryValue*>* apps_list =
2023 new std::vector<DictionaryValue*>(); 2023 new std::vector<DictionaryValue*>();
2024 for (ExtensionList::const_iterator ext = extensions->begin(); 2024 for (ExtensionSet::const_iterator ext = extensions->begin();
2025 ext != extensions->end(); ++ext) { 2025 ext != extensions->end(); ++ext) {
2026 // Only return information about extensions that are actually apps. 2026 // Only return information about extensions that are actually apps.
2027 if ((*ext)->is_app()) { 2027 if ((*ext)->is_app()) {
2028 DictionaryValue* app_info = new DictionaryValue(); 2028 DictionaryValue* app_info = new DictionaryValue();
2029 AppLauncherHandler::CreateAppInfo(*ext, NULL, ext_service, app_info); 2029 AppLauncherHandler::CreateAppInfo(*ext, NULL, ext_service, app_info);
2030 app_info->SetBoolean("is_component_extension", 2030 app_info->SetBoolean("is_component_extension",
2031 (*ext)->location() == Extension::COMPONENT); 2031 (*ext)->location() == Extension::COMPONENT);
2032 2032
2033 // Convert the launch_type integer into a more descriptive string. 2033 // Convert the launch_type integer into a more descriptive string.
2034 int launch_type; 2034 int launch_type;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2082 2082
2083 // Collect information about the apps in the new tab page. 2083 // Collect information about the apps in the new tab page.
2084 ExtensionService* ext_service = automation_->profile()->GetExtensionService(); 2084 ExtensionService* ext_service = automation_->profile()->GetExtensionService();
2085 if (!ext_service) { 2085 if (!ext_service) {
2086 AutomationJSONReply(automation_, reply_message_.release()) 2086 AutomationJSONReply(automation_, reply_message_.release())
2087 .SendError("No ExtensionService."); 2087 .SendError("No ExtensionService.");
2088 return; 2088 return;
2089 } 2089 }
2090 // Process enabled extensions. 2090 // Process enabled extensions.
2091 ListValue* apps_list = new ListValue(); 2091 ListValue* apps_list = new ListValue();
2092 const ExtensionList* extensions = ext_service->extensions(); 2092 const ExtensionSet* extensions = ext_service->extensions();
2093 std::vector<DictionaryValue*>* enabled_apps = GetAppInfoFromExtensions( 2093 std::vector<DictionaryValue*>* enabled_apps = GetAppInfoFromExtensions(
2094 extensions, ext_service); 2094 extensions, ext_service);
2095 for (std::vector<DictionaryValue*>::const_iterator app = 2095 for (std::vector<DictionaryValue*>::const_iterator app =
2096 enabled_apps->begin(); app != enabled_apps->end(); ++app) { 2096 enabled_apps->begin(); app != enabled_apps->end(); ++app) {
2097 (*app)->SetBoolean("is_disabled", false); 2097 (*app)->SetBoolean("is_disabled", false);
2098 apps_list->Append(*app); 2098 apps_list->Append(*app);
2099 } 2099 }
2100 delete enabled_apps; 2100 delete enabled_apps;
2101 // Process disabled extensions. 2101 // Process disabled extensions.
2102 const ExtensionList* disabled_extensions = ext_service->disabled_extensions(); 2102 const ExtensionSet* disabled_extensions = ext_service->disabled_extensions();
2103 std::vector<DictionaryValue*>* disabled_apps = GetAppInfoFromExtensions( 2103 std::vector<DictionaryValue*>* disabled_apps = GetAppInfoFromExtensions(
2104 disabled_extensions, ext_service); 2104 disabled_extensions, ext_service);
2105 for (std::vector<DictionaryValue*>::const_iterator app = 2105 for (std::vector<DictionaryValue*>::const_iterator app =
2106 disabled_apps->begin(); app != disabled_apps->end(); ++app) { 2106 disabled_apps->begin(); app != disabled_apps->end(); ++app) {
2107 (*app)->SetBoolean("is_disabled", true); 2107 (*app)->SetBoolean("is_disabled", true);
2108 apps_list->Append(*app); 2108 apps_list->Append(*app);
2109 } 2109 }
2110 delete disabled_apps; 2110 delete disabled_apps;
2111 // Process terminated extensions. 2111 // Process terminated extensions.
2112 const ExtensionList* terminated_extensions = 2112 const ExtensionSet* terminated_extensions =
2113 ext_service->terminated_extensions(); 2113 ext_service->terminated_extensions();
2114 std::vector<DictionaryValue*>* terminated_apps = GetAppInfoFromExtensions( 2114 std::vector<DictionaryValue*>* terminated_apps = GetAppInfoFromExtensions(
2115 terminated_extensions, ext_service); 2115 terminated_extensions, ext_service);
2116 for (std::vector<DictionaryValue*>::const_iterator app = 2116 for (std::vector<DictionaryValue*>::const_iterator app =
2117 terminated_apps->begin(); app != terminated_apps->end(); ++app) { 2117 terminated_apps->begin(); app != terminated_apps->end(); ++app) {
2118 (*app)->SetBoolean("is_disabled", true); 2118 (*app)->SetBoolean("is_disabled", true);
2119 apps_list->Append(*app); 2119 apps_list->Append(*app);
2120 } 2120 }
2121 delete terminated_apps; 2121 delete terminated_apps;
2122 ntp_info_->Set("apps", apps_list); 2122 ntp_info_->Set("apps", apps_list);
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after
3047 } 3047 }
3048 } 3048 }
3049 3049
3050 // static 3050 // static
3051 void PolicyUpdatesObserver::PostTask(content::BrowserThread::ID id, 3051 void PolicyUpdatesObserver::PostTask(content::BrowserThread::ID id,
3052 const base::Closure& callback) { 3052 const base::Closure& callback) {
3053 content::BrowserThread::PostTask(id, FROM_HERE, callback); 3053 content::BrowserThread::PostTask(id, FROM_HERE, callback);
3054 } 3054 }
3055 3055
3056 #endif // defined(ENABLE_CONFIGURATION_POLICY) 3056 #endif // defined(ENABLE_CONFIGURATION_POLICY)
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/extension_app_provider.cc ('k') | chrome/browser/automation/testing_automation_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698