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 #if defined(ENABLE_EXTENSIONS) | |
573 // Check that the listener is reasonable. We should never get anything other | |
574 // than an install stage listener, a download listener, or both. | |
575 DCHECK_EQ(0, listeners_mask & ~(api::webstore::INSTALL_STAGE_LISTENER | | |
576 api::webstore::DOWNLOAD_PROGRESS_LISTENER)); | |
jln (very slow on Chromium)
2014/03/20 00:05:40
This is required for security reasons. So we canno
Devlin
2014/03/20 16:54:37
Amended.
| |
577 // Inform the Webstore API that an inline install is happening, in case the | |
578 // page requested status updates. | |
579 Profile* profile = | |
580 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | |
581 WebstoreAPI::Get(profile)->OnInlineInstallStart( | |
582 return_route_id, this, webstore_item_id, listeners_mask); | |
583 #endif | |
584 | |
571 WebstoreStandaloneInstaller::Callback callback = | 585 WebstoreStandaloneInstaller::Callback callback = |
572 base::Bind(&TabHelper::OnInlineInstallComplete, base::Unretained(this), | 586 base::Bind(&TabHelper::OnInlineInstallComplete, base::Unretained(this), |
573 install_id, return_route_id); | 587 install_id, return_route_id); |
574 scoped_refptr<WebstoreInlineInstaller> installer( | 588 scoped_refptr<WebstoreInlineInstaller> installer( |
575 webstore_inline_installer_factory_->CreateInstaller( | 589 webstore_inline_installer_factory_->CreateInstaller( |
576 web_contents(), | 590 web_contents(), |
577 webstore_item_id, | 591 webstore_item_id, |
578 requestor_url, | 592 requestor_url, |
579 callback)); | 593 callback)); |
580 installer->BeginInstall(); | 594 installer->BeginInstall(); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
779 } | 793 } |
780 } | 794 } |
781 | 795 |
782 void TabHelper::SetTabId(RenderViewHost* render_view_host) { | 796 void TabHelper::SetTabId(RenderViewHost* render_view_host) { |
783 render_view_host->Send( | 797 render_view_host->Send( |
784 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(), | 798 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(), |
785 SessionID::IdForTab(web_contents()))); | 799 SessionID::IdForTab(web_contents()))); |
786 } | 800 } |
787 | 801 |
788 } // namespace extensions | 802 } // namespace extensions |
OLD | NEW |