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

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 6 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 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1869 ExtensionService* ext_service) { 1872 ExtensionService* ext_service) {
1870 std::vector<DictionaryValue*>* apps_list = 1873 std::vector<DictionaryValue*>* apps_list =
1871 new std::vector<DictionaryValue*>(); 1874 new std::vector<DictionaryValue*>();
1872 for (ExtensionSet::const_iterator ext = extensions->begin(); 1875 for (ExtensionSet::const_iterator ext = extensions->begin();
1873 ext != extensions->end(); ++ext) { 1876 ext != extensions->end(); ++ext) {
1874 // Only return information about extensions that are actually apps. 1877 // Only return information about extensions that are actually apps.
1875 if ((*ext)->is_app()) { 1878 if ((*ext)->is_app()) {
1876 DictionaryValue* app_info = new DictionaryValue(); 1879 DictionaryValue* app_info = new DictionaryValue();
1877 AppLauncherHandler::CreateAppInfo(*ext, NULL, ext_service, app_info); 1880 AppLauncherHandler::CreateAppInfo(*ext, NULL, ext_service, app_info);
1878 app_info->SetBoolean("is_component_extension", 1881 app_info->SetBoolean("is_component_extension",
1879 (*ext)->location() == Extension::COMPONENT); 1882 (*ext)->location() == extensions::Extension::COMPONENT);
1880 1883
1881 // Convert the launch_type integer into a more descriptive string. 1884 // Convert the launch_type integer into a more descriptive string.
1882 int launch_type; 1885 int launch_type;
1883 const char* kLaunchType = "launch_type"; 1886 const char* kLaunchType = "launch_type";
1884 if (!app_info->GetInteger(kLaunchType, &launch_type)) { 1887 if (!app_info->GetInteger(kLaunchType, &launch_type)) {
1885 NOTREACHED() << "Can't get integer from key " << kLaunchType; 1888 NOTREACHED() << "Can't get integer from key " << kLaunchType;
1886 continue; 1889 continue;
1887 } 1890 }
1888 if (launch_type == ExtensionPrefs::LAUNCH_PINNED) { 1891 if (launch_type == ExtensionPrefs::LAUNCH_PINNED) {
1889 app_info->SetString(kLaunchType, "pinned"); 1892 app_info->SetString(kLaunchType, "pinned");
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
2947 } 2950 }
2948 2951
2949 ExtensionHost* host = content::Details<ExtensionHost>(details).ptr(); 2952 ExtensionHost* host = content::Details<ExtensionHost>(details).ptr();
2950 if (host->extension_id() == extension_id_ && 2953 if (host->extension_id() == extension_id_ &&
2951 host->extension_host_type() == chrome::VIEW_TYPE_EXTENSION_POPUP) { 2954 host->extension_host_type() == chrome::VIEW_TYPE_EXTENSION_POPUP) {
2952 AutomationJSONReply(automation_, reply_message_.release()) 2955 AutomationJSONReply(automation_, reply_message_.release())
2953 .SendSuccess(NULL); 2956 .SendSuccess(NULL);
2954 delete this; 2957 delete this;
2955 } 2958 }
2956 } 2959 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_provider_observers.h ('k') | chrome/browser/automation/automation_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698