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

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

Issue 102103005: Move c/c/e/extension_set to top-level extensions/ (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Move ExtensionSet to extensions namespace Created 7 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
OLDNEW
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/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 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after
1741 content::DownloadManager* manager) { 1741 content::DownloadManager* manager) {
1742 delete this; 1742 delete this;
1743 } 1743 }
1744 1744
1745 namespace { 1745 namespace {
1746 1746
1747 // Returns a vector of dictionaries containing information about installed apps, 1747 // Returns a vector of dictionaries containing information about installed apps,
1748 // as identified from a given list of extensions. The caller takes ownership 1748 // as identified from a given list of extensions. The caller takes ownership
1749 // of the created vector. 1749 // of the created vector.
1750 std::vector<DictionaryValue*>* GetAppInfoFromExtensions( 1750 std::vector<DictionaryValue*>* GetAppInfoFromExtensions(
1751 const ExtensionSet* extensions, 1751 const extensions::ExtensionSet* extensions,
1752 ExtensionService* ext_service) { 1752 ExtensionService* ext_service) {
1753 std::vector<DictionaryValue*>* apps_list = 1753 std::vector<DictionaryValue*>* apps_list =
1754 new std::vector<DictionaryValue*>(); 1754 new std::vector<DictionaryValue*>();
1755 for (ExtensionSet::const_iterator ext = extensions->begin(); 1755 for (extensions::ExtensionSet::const_iterator ext = extensions->begin();
1756 ext != extensions->end(); ++ext) { 1756 ext != extensions->end(); ++ext) {
1757 // Only return information about extensions that are actually apps. 1757 // Only return information about extensions that are actually apps.
1758 if ((*ext)->is_app()) { 1758 if ((*ext)->is_app()) {
1759 DictionaryValue* app_info = new DictionaryValue(); 1759 DictionaryValue* app_info = new DictionaryValue();
1760 AppLauncherHandler::CreateAppInfo(ext->get(), ext_service, app_info); 1760 AppLauncherHandler::CreateAppInfo(ext->get(), ext_service, app_info);
1761 app_info->SetBoolean( 1761 app_info->SetBoolean(
1762 "is_component_extension", 1762 "is_component_extension",
1763 (*ext)->location() == extensions::Manifest::COMPONENT); 1763 (*ext)->location() == extensions::Manifest::COMPONENT);
1764 1764
1765 // Convert the launch_type integer into a more descriptive string. 1765 // Convert the launch_type integer into a more descriptive string.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1812 // Collect information about the apps in the new tab page. 1812 // Collect information about the apps in the new tab page.
1813 ExtensionService* ext_service = extensions::ExtensionSystem::Get( 1813 ExtensionService* ext_service = extensions::ExtensionSystem::Get(
1814 automation_->profile())->extension_service(); 1814 automation_->profile())->extension_service();
1815 if (!ext_service) { 1815 if (!ext_service) {
1816 AutomationJSONReply(automation_.get(), reply_message_.release()) 1816 AutomationJSONReply(automation_.get(), reply_message_.release())
1817 .SendError("No ExtensionService."); 1817 .SendError("No ExtensionService.");
1818 return; 1818 return;
1819 } 1819 }
1820 // Process enabled extensions. 1820 // Process enabled extensions.
1821 ListValue* apps_list = new ListValue(); 1821 ListValue* apps_list = new ListValue();
1822 const ExtensionSet* extensions = ext_service->extensions(); 1822 const extensions::ExtensionSet* extensions = ext_service->extensions();
1823 std::vector<DictionaryValue*>* enabled_apps = GetAppInfoFromExtensions( 1823 std::vector<DictionaryValue*>* enabled_apps = GetAppInfoFromExtensions(
1824 extensions, ext_service); 1824 extensions, ext_service);
1825 for (std::vector<DictionaryValue*>::const_iterator app = 1825 for (std::vector<DictionaryValue*>::const_iterator app =
1826 enabled_apps->begin(); app != enabled_apps->end(); ++app) { 1826 enabled_apps->begin(); app != enabled_apps->end(); ++app) {
1827 (*app)->SetBoolean("is_disabled", false); 1827 (*app)->SetBoolean("is_disabled", false);
1828 apps_list->Append(*app); 1828 apps_list->Append(*app);
1829 } 1829 }
1830 delete enabled_apps; 1830 delete enabled_apps;
1831 // Process disabled extensions. 1831 // Process disabled extensions.
1832 const ExtensionSet* disabled_extensions = ext_service->disabled_extensions(); 1832 const extensions::ExtensionSet* disabled_extensions =
1833 ext_service->disabled_extensions();
1833 std::vector<DictionaryValue*>* disabled_apps = GetAppInfoFromExtensions( 1834 std::vector<DictionaryValue*>* disabled_apps = GetAppInfoFromExtensions(
1834 disabled_extensions, ext_service); 1835 disabled_extensions, ext_service);
1835 for (std::vector<DictionaryValue*>::const_iterator app = 1836 for (std::vector<DictionaryValue*>::const_iterator app =
1836 disabled_apps->begin(); app != disabled_apps->end(); ++app) { 1837 disabled_apps->begin(); app != disabled_apps->end(); ++app) {
1837 (*app)->SetBoolean("is_disabled", true); 1838 (*app)->SetBoolean("is_disabled", true);
1838 apps_list->Append(*app); 1839 apps_list->Append(*app);
1839 } 1840 }
1840 delete disabled_apps; 1841 delete disabled_apps;
1841 // Process terminated extensions. 1842 // Process terminated extensions.
1842 const ExtensionSet* terminated_extensions = 1843 const extensions::ExtensionSet* terminated_extensions =
1843 ext_service->terminated_extensions(); 1844 ext_service->terminated_extensions();
1844 std::vector<DictionaryValue*>* terminated_apps = GetAppInfoFromExtensions( 1845 std::vector<DictionaryValue*>* terminated_apps = GetAppInfoFromExtensions(
1845 terminated_extensions, ext_service); 1846 terminated_extensions, ext_service);
1846 for (std::vector<DictionaryValue*>::const_iterator app = 1847 for (std::vector<DictionaryValue*>::const_iterator app =
1847 terminated_apps->begin(); app != terminated_apps->end(); ++app) { 1848 terminated_apps->begin(); app != terminated_apps->end(); ++app) {
1848 (*app)->SetBoolean("is_disabled", true); 1849 (*app)->SetBoolean("is_disabled", true);
1849 apps_list->Append(*app); 1850 apps_list->Append(*app);
1850 } 1851 }
1851 delete terminated_apps; 1852 delete terminated_apps;
1852 ntp_info_->Set("apps", apps_list); 1853 ntp_info_->Set("apps", apps_list);
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
2645 if (automation_.get()) { 2646 if (automation_.get()) {
2646 AutomationJSONReply(automation_.get(), reply_message_.release()) 2647 AutomationJSONReply(automation_.get(), reply_message_.release())
2647 .SendSuccess(NULL); 2648 .SendSuccess(NULL);
2648 } 2649 }
2649 delete this; 2650 delete this;
2650 } 2651 }
2651 } else { 2652 } else {
2652 NOTREACHED(); 2653 NOTREACHED();
2653 } 2654 }
2654 } 2655 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698