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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
12 #include "chrome/browser/extensions/activity_log/activity_log.h" | 12 #include "chrome/browser/extensions/activity_log/activity_log.h" |
13 #include "chrome/browser/extensions/api/declarative/rules_registry_service.h" | 13 #include "chrome/browser/extensions/api/declarative/rules_registry_service.h" |
14 #include "chrome/browser/extensions/api/declarative_content/content_rules_regist
ry.h" | 14 #include "chrome/browser/extensions/api/declarative_content/content_rules_regist
ry.h" |
| 15 #include "chrome/browser/extensions/api/webstore/webstore_api.h" |
15 #include "chrome/browser/extensions/crx_installer.h" | 16 #include "chrome/browser/extensions/crx_installer.h" |
16 #include "chrome/browser/extensions/error_console/error_console.h" | 17 #include "chrome/browser/extensions/error_console/error_console.h" |
17 #include "chrome/browser/extensions/extension_action.h" | 18 #include "chrome/browser/extensions/extension_action.h" |
18 #include "chrome/browser/extensions/extension_action_manager.h" | 19 #include "chrome/browser/extensions/extension_action_manager.h" |
19 #include "chrome/browser/extensions/extension_service.h" | 20 #include "chrome/browser/extensions/extension_service.h" |
20 #include "chrome/browser/extensions/extension_tab_util.h" | 21 #include "chrome/browser/extensions/extension_tab_util.h" |
21 #include "chrome/browser/extensions/favicon_downloader.h" | 22 #include "chrome/browser/extensions/favicon_downloader.h" |
22 #include "chrome/browser/extensions/image_loader.h" | 23 #include "chrome/browser/extensions/image_loader.h" |
23 #include "chrome/browser/extensions/page_action_controller.h" | 24 #include "chrome/browser/extensions/page_action_controller.h" |
24 #include "chrome/browser/extensions/script_executor.h" | 25 #include "chrome/browser/extensions/script_executor.h" |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 break; | 557 break; |
557 } | 558 } |
558 | 559 |
559 // The hosted app action will be cleared once the installation completes or | 560 // The hosted app action will be cleared once the installation completes or |
560 // fails. | 561 // fails. |
561 if (pending_web_app_action_ != CREATE_HOSTED_APP) | 562 if (pending_web_app_action_ != CREATE_HOSTED_APP) |
562 pending_web_app_action_ = NONE; | 563 pending_web_app_action_ = NONE; |
563 #endif | 564 #endif |
564 } | 565 } |
565 | 566 |
566 void TabHelper::OnInlineWebstoreInstall( | 567 void TabHelper::OnInlineWebstoreInstall(int install_id, |
567 int install_id, | 568 int return_route_id, |
568 int return_route_id, | 569 const std::string& webstore_item_id, |
569 const std::string& webstore_item_id, | 570 const GURL& requestor_url, |
570 const GURL& requestor_url) { | 571 int listeners_mask) { |
| 572 // Inform the Webstore API that an inline install is happening, in case the |
| 573 // page requested status updates. |
| 574 Profile* profile = |
| 575 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
| 576 WebstoreAPI::Get(profile)->OnInlineInstallStart( |
| 577 return_route_id, this, webstore_item_id, listeners_mask); |
| 578 |
571 WebstoreStandaloneInstaller::Callback callback = | 579 WebstoreStandaloneInstaller::Callback callback = |
572 base::Bind(&TabHelper::OnInlineInstallComplete, base::Unretained(this), | 580 base::Bind(&TabHelper::OnInlineInstallComplete, base::Unretained(this), |
573 install_id, return_route_id); | 581 install_id, return_route_id); |
574 scoped_refptr<WebstoreInlineInstaller> installer( | 582 scoped_refptr<WebstoreInlineInstaller> installer( |
575 webstore_inline_installer_factory_->CreateInstaller( | 583 webstore_inline_installer_factory_->CreateInstaller( |
576 web_contents(), | 584 web_contents(), |
577 webstore_item_id, | 585 webstore_item_id, |
578 requestor_url, | 586 requestor_url, |
579 callback)); | 587 callback)); |
580 installer->BeginInstall(); | 588 installer->BeginInstall(); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 } | 787 } |
780 } | 788 } |
781 | 789 |
782 void TabHelper::SetTabId(RenderViewHost* render_view_host) { | 790 void TabHelper::SetTabId(RenderViewHost* render_view_host) { |
783 render_view_host->Send( | 791 render_view_host->Send( |
784 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(), | 792 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(), |
785 SessionID::IdForTab(web_contents()))); | 793 SessionID::IdForTab(web_contents()))); |
786 } | 794 } |
787 | 795 |
788 } // namespace extensions | 796 } // namespace extensions |
OLD | NEW |