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

Unified Diff: chrome/browser/extensions/extension_tab_helper.cc

Issue 10174001: Add an API for hosted apps to check their install and running states. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/extension_tab_helper.h ('k') | chrome/common/extensions/api/app.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_tab_helper.cc
diff --git a/chrome/browser/extensions/extension_tab_helper.cc b/chrome/browser/extensions/extension_tab_helper.cc
index b45b0adf2dcbf365ec09edfd265de710a529dbd7..ab65db373730be47ac21dff7e8ce770f590c19b0 100644
--- a/chrome/browser/extensions/extension_tab_helper.cc
+++ b/chrome/browser/extensions/extension_tab_helper.cc
@@ -137,6 +137,8 @@ bool ExtensionTabHelper::OnMessageReceived(const IPC::Message& message) {
OnInlineWebstoreInstall)
IPC_MESSAGE_HANDLER(ExtensionHostMsg_GetAppNotifyChannel,
OnGetAppNotifyChannel)
+ IPC_MESSAGE_HANDLER(ExtensionHostMsg_GetAppInstallState,
+ OnGetAppInstallState);
IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -223,6 +225,28 @@ void ExtensionTabHelper::OnGetAppNotifyChannel(
// We'll get called back in AppNotifyChannelSetupComplete.
}
+void ExtensionTabHelper::OnGetAppInstallState(const GURL& requestor_url,
+ int return_route_id,
+ int callback_id) {
+ Profile* profile =
+ Profile::FromBrowserContext(web_contents()->GetBrowserContext());
+ ExtensionService* extension_service = profile->GetExtensionService();
+ const ExtensionSet* extensions = extension_service->extensions();
+ const ExtensionSet* disabled = extension_service->disabled_extensions();
+
+ ExtensionURLInfo url(requestor_url);
+ std::string state;
+ if (extensions->GetHostedAppByURL(url))
+ state = extension_misc::kAppStateInstalled;
+ else if (disabled->GetHostedAppByURL(url))
+ state = extension_misc::kAppStateDisabled;
+ else
+ state = extension_misc::kAppStateNotInstalled;
+
+ Send(new ExtensionMsg_GetAppInstallStateResponse(
+ return_route_id, state, callback_id));
+}
+
void ExtensionTabHelper::AppNotifyChannelSetupComplete(
const std::string& channel_id,
const std::string& error,
« no previous file with comments | « chrome/browser/extensions/extension_tab_helper.h ('k') | chrome/common/extensions/api/app.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698