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

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

Issue 10375021: Move Extension into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Take 2 Created 8 years, 7 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
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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 return_value->SetBoolean("success", true); 548 return_value->SetBoolean("success", true);
549 AutomationJSONReply(automation_, reply_message_.release()) 549 AutomationJSONReply(automation_, reply_message_.release())
550 .SendSuccess(return_value.get()); 550 .SendSuccess(return_value.get());
551 delete this; 551 delete this;
552 return; 552 return;
553 } 553 }
554 break; 554 break;
555 } 555 }
556 556
557 case chrome::NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED: { 557 case chrome::NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED: {
558 const Extension* extension = content::Details<Extension>(details).ptr(); 558 const extensions::Extension* extension =
559 content::Details<extensions::Extension>(details).ptr();
559 if (id_ == extension->id()) { 560 if (id_ == extension->id()) {
560 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); 561 scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
561 return_value->SetBoolean("success", false); 562 return_value->SetBoolean("success", false);
562 AutomationJSONReply(automation_, reply_message_.release()) 563 AutomationJSONReply(automation_, reply_message_.release())
563 .SendSuccess(return_value.get()); 564 .SendSuccess(return_value.get());
564 delete this; 565 delete this;
565 return; 566 return;
566 } 567 }
567 break; 568 break;
568 } 569 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 } 609 }
609 610
610 switch (type) { 611 switch (type) {
611 case content::NOTIFICATION_LOAD_STOP: 612 case content::NOTIFICATION_LOAD_STOP:
612 // Only continue on with this method if our extension has been loaded 613 // Only continue on with this method if our extension has been loaded
613 // and all the extension views have stopped loading. 614 // and all the extension views have stopped loading.
614 if (!extension_ || !DidExtensionViewsStopLoading(manager_)) 615 if (!extension_ || !DidExtensionViewsStopLoading(manager_))
615 return; 616 return;
616 break; 617 break;
617 case chrome::NOTIFICATION_EXTENSION_LOADED: { 618 case chrome::NOTIFICATION_EXTENSION_LOADED: {
618 const Extension* loaded_extension = 619 const extensions::Extension* loaded_extension =
619 content::Details<const Extension>(details).ptr(); 620 content::Details<const extensions::Extension>(details).ptr();
620 // Only track an internal or unpacked extension load. 621 // Only track an internal or unpacked extension load.
621 Extension::Location location = loaded_extension->location(); 622 extensions::Extension::Location location = loaded_extension->location();
622 if (location != Extension::INTERNAL && location != Extension::LOAD) 623 if (location != extensions::Extension::INTERNAL &&
624 location != extensions::Extension::LOAD)
623 return; 625 return;
624 extension_ = loaded_extension; 626 extension_ = loaded_extension;
625 if (!DidExtensionViewsStopLoading(manager_)) 627 if (!DidExtensionViewsStopLoading(manager_))
626 return; 628 return;
627 // For some reason, the background extension view is not yet 629 // For some reason, the background extension view is not yet
628 // created at this point so just checking whether all extension views 630 // created at this point so just checking whether all extension views
629 // are loaded is not sufficient. If background page is not ready, 631 // are loaded is not sufficient. If background page is not ready,
630 // we wait for NOTIFICATION_LOAD_STOP. 632 // we wait for NOTIFICATION_LOAD_STOP.
631 if (!service_->IsBackgroundPageReady(extension_)) 633 if (!service_->IsBackgroundPageReady(extension_))
632 return; 634 return;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 // themselves. 726 // themselves.
725 updater_finished_ = true; 727 updater_finished_ = true;
726 break; 728 break;
727 729
728 case chrome::NOTIFICATION_EXTENSION_LOADED: 730 case chrome::NOTIFICATION_EXTENSION_LOADED:
729 case chrome::NOTIFICATION_EXTENSION_INSTALL_NOT_ALLOWED: 731 case chrome::NOTIFICATION_EXTENSION_INSTALL_NOT_ALLOWED:
730 case chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED: { 732 case chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED: {
731 // An extension has either completed update installation and is now 733 // An extension has either completed update installation and is now
732 // loaded, or else the install has been skipped because it is 734 // loaded, or else the install has been skipped because it is
733 // either not allowed or else has been disabled. 735 // either not allowed or else has been disabled.
734 const Extension* extension = content::Details<Extension>(details).ptr(); 736 const extensions::Extension* extension =
737 content::Details<extensions::Extension>(details).ptr();
735 in_progress_updates_.erase(extension->id()); 738 in_progress_updates_.erase(extension->id());
736 break; 739 break;
737 } 740 }
738 741
739 case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR: { 742 case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR: {
740 // An extension had an error on update installation. 743 // An extension had an error on update installation.
741 CrxInstaller* installer = content::Source<CrxInstaller>(source).ptr(); 744 CrxInstaller* installer = content::Source<CrxInstaller>(source).ptr();
742 in_progress_updates_.erase(installer->expected_id()); 745 in_progress_updates_.erase(installer->expected_id());
743 break; 746 break;
744 } 747 }
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1893 ExtensionService* ext_service) { 1896 ExtensionService* ext_service) {
1894 std::vector<DictionaryValue*>* apps_list = 1897 std::vector<DictionaryValue*>* apps_list =
1895 new std::vector<DictionaryValue*>(); 1898 new std::vector<DictionaryValue*>();
1896 for (ExtensionSet::const_iterator ext = extensions->begin(); 1899 for (ExtensionSet::const_iterator ext = extensions->begin();
1897 ext != extensions->end(); ++ext) { 1900 ext != extensions->end(); ++ext) {
1898 // Only return information about extensions that are actually apps. 1901 // Only return information about extensions that are actually apps.
1899 if ((*ext)->is_app()) { 1902 if ((*ext)->is_app()) {
1900 DictionaryValue* app_info = new DictionaryValue(); 1903 DictionaryValue* app_info = new DictionaryValue();
1901 AppLauncherHandler::CreateAppInfo(*ext, NULL, ext_service, app_info); 1904 AppLauncherHandler::CreateAppInfo(*ext, NULL, ext_service, app_info);
1902 app_info->SetBoolean("is_component_extension", 1905 app_info->SetBoolean("is_component_extension",
1903 (*ext)->location() == Extension::COMPONENT); 1906 (*ext)->location() == extensions::Extension::COMPONENT);
1904 1907
1905 // Convert the launch_type integer into a more descriptive string. 1908 // Convert the launch_type integer into a more descriptive string.
1906 int launch_type; 1909 int launch_type;
1907 const char* kLaunchType = "launch_type"; 1910 const char* kLaunchType = "launch_type";
1908 if (!app_info->GetInteger(kLaunchType, &launch_type)) { 1911 if (!app_info->GetInteger(kLaunchType, &launch_type)) {
1909 NOTREACHED() << "Can't get integer from key " << kLaunchType; 1912 NOTREACHED() << "Can't get integer from key " << kLaunchType;
1910 continue; 1913 continue;
1911 } 1914 }
1912 if (launch_type == ExtensionPrefs::LAUNCH_PINNED) { 1915 if (launch_type == ExtensionPrefs::LAUNCH_PINNED) {
1913 app_info->SetString(kLaunchType, "pinned"); 1916 app_info->SetString(kLaunchType, "pinned");
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
2971 } 2974 }
2972 2975
2973 ExtensionHost* host = content::Details<ExtensionHost>(details).ptr(); 2976 ExtensionHost* host = content::Details<ExtensionHost>(details).ptr();
2974 if (host->extension_id() == extension_id_ && 2977 if (host->extension_id() == extension_id_ &&
2975 host->extension_host_type() == chrome::VIEW_TYPE_EXTENSION_POPUP) { 2978 host->extension_host_type() == chrome::VIEW_TYPE_EXTENSION_POPUP) {
2976 AutomationJSONReply(automation_, reply_message_.release()) 2979 AutomationJSONReply(automation_, reply_message_.release())
2977 .SendSuccess(NULL); 2980 .SendSuccess(NULL);
2978 delete this; 2981 delete this;
2979 } 2982 }
2980 } 2983 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698