| 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/extensions/tab_helper.h" | 5 #include "chrome/browser/extensions/tab_helper.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/extensions/activity_log/activity_log.h" | 8 #include "chrome/browser/extensions/activity_log/activity_log.h" |
| 9 #include "chrome/browser/extensions/api/declarative/rules_registry_service.h" | 9 #include "chrome/browser/extensions/api/declarative/rules_registry_service.h" |
| 10 #include "chrome/browser/extensions/api/declarative_content/content_rules_regist
ry.h" | 10 #include "chrome/browser/extensions/api/declarative_content/content_rules_regist
ry.h" |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 | 304 |
| 305 void TabHelper::OnGetAppInstallState(const GURL& requestor_url, | 305 void TabHelper::OnGetAppInstallState(const GURL& requestor_url, |
| 306 int return_route_id, | 306 int return_route_id, |
| 307 int callback_id) { | 307 int callback_id) { |
| 308 Profile* profile = | 308 Profile* profile = |
| 309 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 309 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
| 310 ExtensionService* extension_service = profile->GetExtensionService(); | 310 ExtensionService* extension_service = profile->GetExtensionService(); |
| 311 const ExtensionSet* extensions = extension_service->extensions(); | 311 const ExtensionSet* extensions = extension_service->extensions(); |
| 312 const ExtensionSet* disabled = extension_service->disabled_extensions(); | 312 const ExtensionSet* disabled = extension_service->disabled_extensions(); |
| 313 | 313 |
| 314 ExtensionURLInfo url(requestor_url); | |
| 315 std::string state; | 314 std::string state; |
| 316 if (extensions->GetHostedAppByURL(url)) | 315 if (extensions->GetHostedAppByURL(requestor_url)) |
| 317 state = extension_misc::kAppStateInstalled; | 316 state = extension_misc::kAppStateInstalled; |
| 318 else if (disabled->GetHostedAppByURL(url)) | 317 else if (disabled->GetHostedAppByURL(requestor_url)) |
| 319 state = extension_misc::kAppStateDisabled; | 318 state = extension_misc::kAppStateDisabled; |
| 320 else | 319 else |
| 321 state = extension_misc::kAppStateNotInstalled; | 320 state = extension_misc::kAppStateNotInstalled; |
| 322 | 321 |
| 323 Send(new ExtensionMsg_GetAppInstallStateResponse( | 322 Send(new ExtensionMsg_GetAppInstallStateResponse( |
| 324 return_route_id, state, callback_id)); | 323 return_route_id, state, callback_id)); |
| 325 } | 324 } |
| 326 | 325 |
| 327 void TabHelper::OnRequest(const ExtensionHostMsg_Request_Params& request) { | 326 void TabHelper::OnRequest(const ExtensionHostMsg_Request_Params& request) { |
| 328 extension_function_dispatcher_.Dispatch(request, | 327 extension_function_dispatcher_.Dispatch(request, |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 } | 453 } |
| 455 } | 454 } |
| 456 | 455 |
| 457 void TabHelper::SetTabId(RenderViewHost* render_view_host) { | 456 void TabHelper::SetTabId(RenderViewHost* render_view_host) { |
| 458 render_view_host->Send( | 457 render_view_host->Send( |
| 459 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(), | 458 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(), |
| 460 SessionID::IdForTab(web_contents()))); | 459 SessionID::IdForTab(web_contents()))); |
| 461 } | 460 } |
| 462 | 461 |
| 463 } // namespace extensions | 462 } // namespace extensions |
| OLD | NEW |