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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 break; | 558 break; |
558 } | 559 } |
559 | 560 |
560 // The hosted app action will be cleared once the installation completes or | 561 // The hosted app action will be cleared once the installation completes or |
561 // fails. | 562 // fails. |
562 if (pending_web_app_action_ != CREATE_HOSTED_APP) | 563 if (pending_web_app_action_ != CREATE_HOSTED_APP) |
563 pending_web_app_action_ = NONE; | 564 pending_web_app_action_ = NONE; |
564 #endif | 565 #endif |
565 } | 566 } |
566 | 567 |
567 void TabHelper::OnInlineWebstoreInstall( | 568 void TabHelper::OnInlineWebstoreInstall(int install_id, |
568 int install_id, | 569 int return_route_id, |
569 int return_route_id, | 570 const std::string& webstore_item_id, |
570 const std::string& webstore_item_id, | 571 const GURL& requestor_url, |
571 const GURL& requestor_url) { | 572 int listeners_mask) { |
| 573 // Inform the Webstore API that an inline install is happening, in case the |
| 574 // page requested status updates. |
| 575 Profile* profile = |
| 576 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
| 577 WebstoreAPI::Get(profile)->OnInlineInstallStart( |
| 578 return_route_id, this, webstore_item_id, listeners_mask); |
| 579 |
572 WebstoreStandaloneInstaller::Callback callback = | 580 WebstoreStandaloneInstaller::Callback callback = |
573 base::Bind(&TabHelper::OnInlineInstallComplete, base::Unretained(this), | 581 base::Bind(&TabHelper::OnInlineInstallComplete, base::Unretained(this), |
574 install_id, return_route_id); | 582 install_id, return_route_id); |
575 scoped_refptr<WebstoreInlineInstaller> installer( | 583 scoped_refptr<WebstoreInlineInstaller> installer( |
576 webstore_inline_installer_factory_->CreateInstaller( | 584 webstore_inline_installer_factory_->CreateInstaller( |
577 web_contents(), | 585 web_contents(), |
578 webstore_item_id, | 586 webstore_item_id, |
579 requestor_url, | 587 requestor_url, |
580 callback)); | 588 callback)); |
581 installer->BeginInstall(); | 589 installer->BeginInstall(); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 } | 788 } |
781 } | 789 } |
782 | 790 |
783 void TabHelper::SetTabId(RenderViewHost* render_view_host) { | 791 void TabHelper::SetTabId(RenderViewHost* render_view_host) { |
784 render_view_host->Send( | 792 render_view_host->Send( |
785 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(), | 793 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(), |
786 SessionID::IdForTab(web_contents()))); | 794 SessionID::IdForTab(web_contents()))); |
787 } | 795 } |
788 | 796 |
789 } // namespace extensions | 797 } // namespace extensions |
OLD | NEW |