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

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

Issue 131743021: app_shell: Extract extension runtime data from ExtensionService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, RuntimeDataTest tweak, win warning Created 6 years, 11 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 | Annotate | Revision Log
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 #include "chrome/common/extensions/extension_constants.h" 66 #include "chrome/common/extensions/extension_constants.h"
67 #include "content/public/browser/dom_operation_notification_details.h" 67 #include "content/public/browser/dom_operation_notification_details.h"
68 #include "content/public/browser/navigation_controller.h" 68 #include "content/public/browser/navigation_controller.h"
69 #include "content/public/browser/notification_service.h" 69 #include "content/public/browser/notification_service.h"
70 #include "content/public/browser/render_process_host.h" 70 #include "content/public/browser/render_process_host.h"
71 #include "content/public/browser/render_view_host.h" 71 #include "content/public/browser/render_view_host.h"
72 #include "content/public/browser/web_contents.h" 72 #include "content/public/browser/web_contents.h"
73 #include "content/public/common/process_type.h" 73 #include "content/public/common/process_type.h"
74 #include "extensions/browser/extension_registry.h" 74 #include "extensions/browser/extension_registry.h"
75 #include "extensions/browser/process_manager.h" 75 #include "extensions/browser/process_manager.h"
76 #include "extensions/browser/runtime_data.h"
76 #include "extensions/common/extension.h" 77 #include "extensions/common/extension.h"
77 #include "extensions/common/extension_set.h" 78 #include "extensions/common/extension_set.h"
78 #include "extensions/common/manifest.h" 79 #include "extensions/common/manifest.h"
79 #include "extensions/common/view_type.h" 80 #include "extensions/common/view_type.h"
80 #include "ui/gfx/codec/png_codec.h" 81 #include "ui/gfx/codec/png_codec.h"
81 #include "ui/gfx/rect.h" 82 #include "ui/gfx/rect.h"
82 #include "url/gurl.h" 83 #include "url/gurl.h"
83 84
84 #if !defined(OS_CHROMEOS) 85 #if !defined(OS_CHROMEOS)
85 #include "chrome/browser/notifications/balloon_notification_ui_manager.h" 86 #include "chrome/browser/notifications/balloon_notification_ui_manager.h"
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 } 565 }
565 break; 566 break;
566 } 567 }
567 568
568 default: 569 default:
569 NOTREACHED(); 570 NOTREACHED();
570 } 571 }
571 } 572 }
572 573
573 ExtensionReadyNotificationObserver::ExtensionReadyNotificationObserver( 574 ExtensionReadyNotificationObserver::ExtensionReadyNotificationObserver(
574 extensions::ProcessManager* manager, ExtensionService* service, 575 extensions::ExtensionSystem* extension_system,
575 AutomationProvider* automation, IPC::Message* reply_message) 576 AutomationProvider* automation,
576 : manager_(manager), 577 IPC::Message* reply_message)
577 service_(service), 578 : extension_system_(extension_system),
578 automation_(automation->AsWeakPtr()), 579 automation_(automation->AsWeakPtr()),
579 reply_message_(reply_message), 580 reply_message_(reply_message),
580 extension_(NULL) { 581 extension_(NULL) {
581 Init(); 582 Init();
582 } 583 }
583 584
584 ExtensionReadyNotificationObserver::~ExtensionReadyNotificationObserver() { 585 ExtensionReadyNotificationObserver::~ExtensionReadyNotificationObserver() {
585 } 586 }
586 587
587 void ExtensionReadyNotificationObserver::Init() { 588 void ExtensionReadyNotificationObserver::Init() {
(...skipping 14 matching lines...) Expand all
602 const content::NotificationDetails& details) { 603 const content::NotificationDetails& details) {
603 if (!automation_.get()) { 604 if (!automation_.get()) {
604 delete this; 605 delete this;
605 return; 606 return;
606 } 607 }
607 608
608 switch (type) { 609 switch (type) {
609 case content::NOTIFICATION_LOAD_STOP: 610 case content::NOTIFICATION_LOAD_STOP:
610 // Only continue on with this method if our extension has been loaded 611 // Only continue on with this method if our extension has been loaded
611 // and all the extension views have stopped loading. 612 // and all the extension views have stopped loading.
612 if (!extension_ || !DidExtensionViewsStopLoading(manager_)) 613 if (!extension_ ||
614 !DidExtensionViewsStopLoading(extension_system_->process_manager()))
613 return; 615 return;
614 break; 616 break;
615 case chrome::NOTIFICATION_EXTENSION_LOADED: { 617 case chrome::NOTIFICATION_EXTENSION_LOADED: {
616 const extensions::Extension* loaded_extension = 618 const extensions::Extension* loaded_extension =
617 content::Details<const extensions::Extension>(details).ptr(); 619 content::Details<const extensions::Extension>(details).ptr();
618 // Only track an internal or unpacked extension load. 620 // Only track an internal or unpacked extension load.
619 extensions::Manifest::Location location = loaded_extension->location(); 621 extensions::Manifest::Location location = loaded_extension->location();
620 if (location != extensions::Manifest::INTERNAL && 622 if (location != extensions::Manifest::INTERNAL &&
621 !extensions::Manifest::IsUnpackedLocation(location)) 623 !extensions::Manifest::IsUnpackedLocation(location))
622 return; 624 return;
623 extension_ = loaded_extension; 625 extension_ = loaded_extension;
624 if (!DidExtensionViewsStopLoading(manager_)) 626 if (!DidExtensionViewsStopLoading(extension_system_->process_manager()))
625 return; 627 return;
626 // For some reason, the background extension view is not yet 628 // For some reason, the background extension view is not yet
627 // created at this point so just checking whether all extension views 629 // created at this point so just checking whether all extension views
628 // are loaded is not sufficient. If background page is not ready, 630 // are loaded is not sufficient. If background page is not ready,
629 // we wait for NOTIFICATION_LOAD_STOP. 631 // we wait for NOTIFICATION_LOAD_STOP.
630 if (!service_->IsBackgroundPageReady(extension_)) 632 if (!extension_system_->runtime_data()->IsBackgroundPageReady(extension_))
631 return; 633 return;
632 break; 634 break;
633 } 635 }
634 case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR: 636 case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR:
635 case chrome::NOTIFICATION_EXTENSION_LOAD_ERROR: 637 case chrome::NOTIFICATION_EXTENSION_LOAD_ERROR:
636 case chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED: 638 case chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED:
637 break; 639 break;
638 default: 640 default:
639 NOTREACHED(); 641 NOTREACHED();
640 break; 642 break;
(...skipping 1837 matching lines...) Expand 10 before | Expand all | Expand 10 after
2478 if (automation_.get()) { 2480 if (automation_.get()) {
2479 AutomationJSONReply(automation_.get(), reply_message_.release()) 2481 AutomationJSONReply(automation_.get(), reply_message_.release())
2480 .SendSuccess(NULL); 2482 .SendSuccess(NULL);
2481 } 2483 }
2482 delete this; 2484 delete this;
2483 } 2485 }
2484 } else { 2486 } else {
2485 NOTREACHED(); 2487 NOTREACHED();
2486 } 2488 }
2487 } 2489 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_provider_observers.h ('k') | chrome/browser/automation/testing_automation_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698