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

Side by Side Diff: chrome/browser/extensions/extension_service.cc

Issue 136453005: app_shell: Make renderer run background page JavaScript (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup (load_background_page) 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/extensions/extension_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <set> 9 #include <set>
10 10
(...skipping 2482 matching lines...) Expand 10 before | Expand all | Expand 10 after
2493 // access to the Extension and ExtensionHost. 2493 // access to the Extension and ExtensionHost.
2494 base::MessageLoop::current()->PostTask( 2494 base::MessageLoop::current()->PostTask(
2495 FROM_HERE, 2495 FROM_HERE,
2496 base::Bind( 2496 base::Bind(
2497 &ExtensionService::TrackTerminatedExtension, 2497 &ExtensionService::TrackTerminatedExtension,
2498 AsWeakPtr(), 2498 AsWeakPtr(),
2499 host->extension())); 2499 host->extension()));
2500 break; 2500 break;
2501 } 2501 }
2502 case content::NOTIFICATION_RENDERER_PROCESS_CREATED: { 2502 case content::NOTIFICATION_RENDERER_PROCESS_CREATED: {
2503 // TODO(jamescook): Extract this block of code to src/extensions so it
2504 // can be shared with app_shell.
2503 content::RenderProcessHost* process = 2505 content::RenderProcessHost* process =
2504 content::Source<content::RenderProcessHost>(source).ptr(); 2506 content::Source<content::RenderProcessHost>(source).ptr();
2505 Profile* host_profile = 2507 Profile* host_profile =
2506 Profile::FromBrowserContext(process->GetBrowserContext()); 2508 Profile::FromBrowserContext(process->GetBrowserContext());
2507 if (!profile_->IsSameProfile(host_profile->GetOriginalProfile())) 2509 if (!profile_->IsSameProfile(host_profile->GetOriginalProfile()))
2508 break; 2510 break;
2509 2511
2510 // Extensions need to know the channel for API restrictions. 2512 // Extensions need to know the channel for API restrictions.
2511 process->Send(new ExtensionMsg_SetChannel( 2513 process->Send(new ExtensionMsg_SetChannel(
2512 extensions::GetCurrentChannel())); 2514 extensions::GetCurrentChannel()));
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
2614 return true; 2616 return true;
2615 ExtensionRuntimeDataMap::const_iterator it = 2617 ExtensionRuntimeDataMap::const_iterator it =
2616 extension_runtime_data_.find(extension->id()); 2618 extension_runtime_data_.find(extension->id());
2617 return it == extension_runtime_data_.end() ? false : 2619 return it == extension_runtime_data_.end() ? false :
2618 it->second.background_page_ready; 2620 it->second.background_page_ready;
2619 } 2621 }
2620 2622
2621 void ExtensionService::SetBackgroundPageReady(const Extension* extension) { 2623 void ExtensionService::SetBackgroundPageReady(const Extension* extension) {
2622 DCHECK(extensions::BackgroundInfo::HasBackgroundPage(extension)); 2624 DCHECK(extensions::BackgroundInfo::HasBackgroundPage(extension));
2623 extension_runtime_data_[extension->id()].background_page_ready = true; 2625 extension_runtime_data_[extension->id()].background_page_ready = true;
2624 content::NotificationService::current()->Notify(
2625 chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY,
2626 content::Source<const Extension>(extension),
2627 content::NotificationService::NoDetails());
2628 } 2626 }
2629 2627
2630 bool ExtensionService::IsBeingUpgraded(const Extension* extension) const { 2628 bool ExtensionService::IsBeingUpgraded(const Extension* extension) const {
2631 ExtensionRuntimeDataMap::const_iterator it = 2629 ExtensionRuntimeDataMap::const_iterator it =
2632 extension_runtime_data_.find(extension->id()); 2630 extension_runtime_data_.find(extension->id());
2633 return it == extension_runtime_data_.end() ? false : 2631 return it == extension_runtime_data_.end() ? false :
2634 it->second.being_upgraded; 2632 it->second.being_upgraded;
2635 } 2633 }
2636 2634
2637 void ExtensionService::SetBeingUpgraded(const Extension* extension, 2635 void ExtensionService::SetBeingUpgraded(const Extension* extension,
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
2815 void ExtensionService::UnloadAllExtensionsInternal() { 2813 void ExtensionService::UnloadAllExtensionsInternal() {
2816 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions(); 2814 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions();
2817 2815
2818 registry_->ClearAll(); 2816 registry_->ClearAll();
2819 extension_runtime_data_.clear(); 2817 extension_runtime_data_.clear();
2820 2818
2821 // TODO(erikkay) should there be a notification for this? We can't use 2819 // TODO(erikkay) should there be a notification for this? We can't use
2822 // EXTENSION_UNLOADED since that implies that the extension has been disabled 2820 // EXTENSION_UNLOADED since that implies that the extension has been disabled
2823 // or uninstalled. 2821 // or uninstalled.
2824 } 2822 }
OLDNEW
« chrome/browser/extensions/extension_host.cc ('K') | « chrome/browser/extensions/extension_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698