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

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: 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 #include "chrome/common/extensions/extension_constants.h" 71 #include "chrome/common/extensions/extension_constants.h"
72 #include "content/public/browser/dom_operation_notification_details.h" 72 #include "content/public/browser/dom_operation_notification_details.h"
73 #include "content/public/browser/navigation_controller.h" 73 #include "content/public/browser/navigation_controller.h"
74 #include "content/public/browser/notification_service.h" 74 #include "content/public/browser/notification_service.h"
75 #include "content/public/browser/render_process_host.h" 75 #include "content/public/browser/render_process_host.h"
76 #include "content/public/browser/render_view_host.h" 76 #include "content/public/browser/render_view_host.h"
77 #include "content/public/browser/web_contents.h" 77 #include "content/public/browser/web_contents.h"
78 #include "content/public/common/process_type.h" 78 #include "content/public/common/process_type.h"
79 #include "extensions/browser/process_manager.h" 79 #include "extensions/browser/process_manager.h"
80 #include "extensions/common/extension.h" 80 #include "extensions/common/extension.h"
81 #include "extensions/common/extension_set.h"
81 #include "extensions/common/manifest.h" 82 #include "extensions/common/manifest.h"
82 #include "extensions/common/view_type.h" 83 #include "extensions/common/view_type.h"
83 #include "ui/gfx/codec/png_codec.h" 84 #include "ui/gfx/codec/png_codec.h"
84 #include "ui/gfx/rect.h" 85 #include "ui/gfx/rect.h"
85 #include "url/gurl.h" 86 #include "url/gurl.h"
86 87
87 using content::BrowserThread; 88 using content::BrowserThread;
88 using content::DomOperationNotificationDetails; 89 using content::DomOperationNotificationDetails;
89 using content::DownloadItem; 90 using content::DownloadItem;
90 using content::DownloadManager; 91 using content::DownloadManager;
(...skipping 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after
1741 content::DownloadManager* manager) { 1742 content::DownloadManager* manager) {
1742 delete this; 1743 delete this;
1743 } 1744 }
1744 1745
1745 namespace { 1746 namespace {
1746 1747
1747 // Returns a vector of dictionaries containing information about installed apps, 1748 // Returns a vector of dictionaries containing information about installed apps,
1748 // as identified from a given list of extensions. The caller takes ownership 1749 // as identified from a given list of extensions. The caller takes ownership
1749 // of the created vector. 1750 // of the created vector.
1750 std::vector<DictionaryValue*>* GetAppInfoFromExtensions( 1751 std::vector<DictionaryValue*>* GetAppInfoFromExtensions(
1751 const ExtensionSet* extensions, 1752 const extensions::ExtensionSet* extensions,
1752 ExtensionService* ext_service) { 1753 ExtensionService* ext_service) {
1753 std::vector<DictionaryValue*>* apps_list = 1754 std::vector<DictionaryValue*>* apps_list =
1754 new std::vector<DictionaryValue*>(); 1755 new std::vector<DictionaryValue*>();
1755 for (ExtensionSet::const_iterator ext = extensions->begin(); 1756 for (extensions::ExtensionSet::const_iterator ext = extensions->begin();
1756 ext != extensions->end(); ++ext) { 1757 ext != extensions->end(); ++ext) {
1757 // Only return information about extensions that are actually apps. 1758 // Only return information about extensions that are actually apps.
1758 if ((*ext)->is_app()) { 1759 if ((*ext)->is_app()) {
1759 DictionaryValue* app_info = new DictionaryValue(); 1760 DictionaryValue* app_info = new DictionaryValue();
1760 AppLauncherHandler::CreateAppInfo(ext->get(), ext_service, app_info); 1761 AppLauncherHandler::CreateAppInfo(ext->get(), ext_service, app_info);
1761 app_info->SetBoolean( 1762 app_info->SetBoolean(
1762 "is_component_extension", 1763 "is_component_extension",
1763 (*ext)->location() == extensions::Manifest::COMPONENT); 1764 (*ext)->location() == extensions::Manifest::COMPONENT);
1764 1765
1765 // Convert the launch_type integer into a more descriptive string. 1766 // 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. 1813 // Collect information about the apps in the new tab page.
1813 ExtensionService* ext_service = extensions::ExtensionSystem::Get( 1814 ExtensionService* ext_service = extensions::ExtensionSystem::Get(
1814 automation_->profile())->extension_service(); 1815 automation_->profile())->extension_service();
1815 if (!ext_service) { 1816 if (!ext_service) {
1816 AutomationJSONReply(automation_.get(), reply_message_.release()) 1817 AutomationJSONReply(automation_.get(), reply_message_.release())
1817 .SendError("No ExtensionService."); 1818 .SendError("No ExtensionService.");
1818 return; 1819 return;
1819 } 1820 }
1820 // Process enabled extensions. 1821 // Process enabled extensions.
1821 ListValue* apps_list = new ListValue(); 1822 ListValue* apps_list = new ListValue();
1822 const ExtensionSet* extensions = ext_service->extensions(); 1823 const extensions::ExtensionSet* extensions = ext_service->extensions();
1823 std::vector<DictionaryValue*>* enabled_apps = GetAppInfoFromExtensions( 1824 std::vector<DictionaryValue*>* enabled_apps = GetAppInfoFromExtensions(
1824 extensions, ext_service); 1825 extensions, ext_service);
1825 for (std::vector<DictionaryValue*>::const_iterator app = 1826 for (std::vector<DictionaryValue*>::const_iterator app =
1826 enabled_apps->begin(); app != enabled_apps->end(); ++app) { 1827 enabled_apps->begin(); app != enabled_apps->end(); ++app) {
1827 (*app)->SetBoolean("is_disabled", false); 1828 (*app)->SetBoolean("is_disabled", false);
1828 apps_list->Append(*app); 1829 apps_list->Append(*app);
1829 } 1830 }
1830 delete enabled_apps; 1831 delete enabled_apps;
1831 // Process disabled extensions. 1832 // Process disabled extensions.
1832 const ExtensionSet* disabled_extensions = ext_service->disabled_extensions(); 1833 const extensions::ExtensionSet* disabled_extensions =
1834 ext_service->disabled_extensions();
1833 std::vector<DictionaryValue*>* disabled_apps = GetAppInfoFromExtensions( 1835 std::vector<DictionaryValue*>* disabled_apps = GetAppInfoFromExtensions(
1834 disabled_extensions, ext_service); 1836 disabled_extensions, ext_service);
1835 for (std::vector<DictionaryValue*>::const_iterator app = 1837 for (std::vector<DictionaryValue*>::const_iterator app =
1836 disabled_apps->begin(); app != disabled_apps->end(); ++app) { 1838 disabled_apps->begin(); app != disabled_apps->end(); ++app) {
1837 (*app)->SetBoolean("is_disabled", true); 1839 (*app)->SetBoolean("is_disabled", true);
1838 apps_list->Append(*app); 1840 apps_list->Append(*app);
1839 } 1841 }
1840 delete disabled_apps; 1842 delete disabled_apps;
1841 // Process terminated extensions. 1843 // Process terminated extensions.
1842 const ExtensionSet* terminated_extensions = 1844 const extensions::ExtensionSet* terminated_extensions =
1843 ext_service->terminated_extensions(); 1845 ext_service->terminated_extensions();
1844 std::vector<DictionaryValue*>* terminated_apps = GetAppInfoFromExtensions( 1846 std::vector<DictionaryValue*>* terminated_apps = GetAppInfoFromExtensions(
1845 terminated_extensions, ext_service); 1847 terminated_extensions, ext_service);
1846 for (std::vector<DictionaryValue*>::const_iterator app = 1848 for (std::vector<DictionaryValue*>::const_iterator app =
1847 terminated_apps->begin(); app != terminated_apps->end(); ++app) { 1849 terminated_apps->begin(); app != terminated_apps->end(); ++app) {
1848 (*app)->SetBoolean("is_disabled", true); 1850 (*app)->SetBoolean("is_disabled", true);
1849 apps_list->Append(*app); 1851 apps_list->Append(*app);
1850 } 1852 }
1851 delete terminated_apps; 1853 delete terminated_apps;
1852 ntp_info_->Set("apps", apps_list); 1854 ntp_info_->Set("apps", apps_list);
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
2645 if (automation_.get()) { 2647 if (automation_.get()) {
2646 AutomationJSONReply(automation_.get(), reply_message_.release()) 2648 AutomationJSONReply(automation_.get(), reply_message_.release())
2647 .SendSuccess(NULL); 2649 .SendSuccess(NULL);
2648 } 2650 }
2649 delete this; 2651 delete this;
2650 } 2652 }
2651 } else { 2653 } else {
2652 NOTREACHED(); 2654 NOTREACHED();
2653 } 2655 }
2654 } 2656 }
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