OLD | NEW |
---|---|
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 Loading... | |
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/extension_registry.h" | 79 #include "extensions/browser/extension_registry.h" |
80 #include "extensions/browser/process_manager.h" | 80 #include "extensions/browser/process_manager.h" |
81 #include "extensions/browser/runtime_data.h" | |
81 #include "extensions/common/extension.h" | 82 #include "extensions/common/extension.h" |
82 #include "extensions/common/extension_set.h" | 83 #include "extensions/common/extension_set.h" |
83 #include "extensions/common/manifest.h" | 84 #include "extensions/common/manifest.h" |
84 #include "extensions/common/view_type.h" | 85 #include "extensions/common/view_type.h" |
85 #include "ui/gfx/codec/png_codec.h" | 86 #include "ui/gfx/codec/png_codec.h" |
86 #include "ui/gfx/rect.h" | 87 #include "ui/gfx/rect.h" |
87 #include "url/gurl.h" | 88 #include "url/gurl.h" |
88 | 89 |
89 using content::BrowserThread; | 90 using content::BrowserThread; |
90 using content::DomOperationNotificationDetails; | 91 using content::DomOperationNotificationDetails; |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
565 } | 566 } |
566 break; | 567 break; |
567 } | 568 } |
568 | 569 |
569 default: | 570 default: |
570 NOTREACHED(); | 571 NOTREACHED(); |
571 } | 572 } |
572 } | 573 } |
573 | 574 |
574 ExtensionReadyNotificationObserver::ExtensionReadyNotificationObserver( | 575 ExtensionReadyNotificationObserver::ExtensionReadyNotificationObserver( |
575 extensions::ProcessManager* manager, ExtensionService* service, | 576 extensions::ExtensionSystem* system, |
not at google - send to devlin
2014/01/18 01:09:04
given this file isn't extensions related I'd expec
James Cook
2014/01/18 02:01:18
No worries. Done.
| |
576 AutomationProvider* automation, IPC::Message* reply_message) | 577 AutomationProvider* automation, |
577 : manager_(manager), | 578 IPC::Message* reply_message) |
578 service_(service), | 579 : system_(system), |
579 automation_(automation->AsWeakPtr()), | 580 automation_(automation->AsWeakPtr()), |
580 reply_message_(reply_message), | 581 reply_message_(reply_message), |
581 extension_(NULL) { | 582 extension_(NULL) { |
582 Init(); | 583 Init(); |
583 } | 584 } |
584 | 585 |
585 ExtensionReadyNotificationObserver::~ExtensionReadyNotificationObserver() { | 586 ExtensionReadyNotificationObserver::~ExtensionReadyNotificationObserver() { |
586 } | 587 } |
587 | 588 |
588 void ExtensionReadyNotificationObserver::Init() { | 589 void ExtensionReadyNotificationObserver::Init() { |
(...skipping 14 matching lines...) Expand all Loading... | |
603 const content::NotificationDetails& details) { | 604 const content::NotificationDetails& details) { |
604 if (!automation_.get()) { | 605 if (!automation_.get()) { |
605 delete this; | 606 delete this; |
606 return; | 607 return; |
607 } | 608 } |
608 | 609 |
609 switch (type) { | 610 switch (type) { |
610 case content::NOTIFICATION_LOAD_STOP: | 611 case content::NOTIFICATION_LOAD_STOP: |
611 // Only continue on with this method if our extension has been loaded | 612 // Only continue on with this method if our extension has been loaded |
612 // and all the extension views have stopped loading. | 613 // and all the extension views have stopped loading. |
613 if (!extension_ || !DidExtensionViewsStopLoading(manager_)) | 614 if (!extension_ || |
615 !DidExtensionViewsStopLoading(system_->process_manager())) | |
614 return; | 616 return; |
615 break; | 617 break; |
616 case chrome::NOTIFICATION_EXTENSION_LOADED: { | 618 case chrome::NOTIFICATION_EXTENSION_LOADED: { |
617 const extensions::Extension* loaded_extension = | 619 const extensions::Extension* loaded_extension = |
618 content::Details<const extensions::Extension>(details).ptr(); | 620 content::Details<const extensions::Extension>(details).ptr(); |
619 // Only track an internal or unpacked extension load. | 621 // Only track an internal or unpacked extension load. |
620 extensions::Manifest::Location location = loaded_extension->location(); | 622 extensions::Manifest::Location location = loaded_extension->location(); |
621 if (location != extensions::Manifest::INTERNAL && | 623 if (location != extensions::Manifest::INTERNAL && |
622 !extensions::Manifest::IsUnpackedLocation(location)) | 624 !extensions::Manifest::IsUnpackedLocation(location)) |
623 return; | 625 return; |
624 extension_ = loaded_extension; | 626 extension_ = loaded_extension; |
625 if (!DidExtensionViewsStopLoading(manager_)) | 627 if (!DidExtensionViewsStopLoading(system_->process_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 (!system_->runtime_data()->IsBackgroundPageReady(extension_)) |
632 return; | 634 return; |
633 break; | 635 break; |
634 } | 636 } |
635 case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR: | 637 case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR: |
636 case chrome::NOTIFICATION_EXTENSION_LOAD_ERROR: | 638 case chrome::NOTIFICATION_EXTENSION_LOAD_ERROR: |
637 case chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED: | 639 case chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED: |
638 break; | 640 break; |
639 default: | 641 default: |
640 NOTREACHED(); | 642 NOTREACHED(); |
641 break; | 643 break; |
(...skipping 1990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2632 if (automation_.get()) { | 2634 if (automation_.get()) { |
2633 AutomationJSONReply(automation_.get(), reply_message_.release()) | 2635 AutomationJSONReply(automation_.get(), reply_message_.release()) |
2634 .SendSuccess(NULL); | 2636 .SendSuccess(NULL); |
2635 } | 2637 } |
2636 delete this; | 2638 delete this; |
2637 } | 2639 } |
2638 } else { | 2640 } else { |
2639 NOTREACHED(); | 2641 NOTREACHED(); |
2640 } | 2642 } |
2641 } | 2643 } |
OLD | NEW |