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

Side by Side Diff: chrome/browser/extensions/tab_helper.cc

Issue 175263003: Add chrome.webstore API methods to allow sites to see progress of installation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test Created 6 years, 9 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 unified diff | Download patch
OLDNEW
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
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)
jln (very slow on Chromium) 2014/03/10 23:35:41 Could you check that listeners_mask is something t
Devlin 2014/03/11 17:22:06 Checked. But (unless my bitwise-logic is wrong, w
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 #endif
580
571 WebstoreStandaloneInstaller::Callback callback = 581 WebstoreStandaloneInstaller::Callback callback =
572 base::Bind(&TabHelper::OnInlineInstallComplete, base::Unretained(this), 582 base::Bind(&TabHelper::OnInlineInstallComplete, base::Unretained(this),
573 install_id, return_route_id); 583 install_id, return_route_id);
574 scoped_refptr<WebstoreInlineInstaller> installer( 584 scoped_refptr<WebstoreInlineInstaller> installer(
575 webstore_inline_installer_factory_->CreateInstaller( 585 webstore_inline_installer_factory_->CreateInstaller(
576 web_contents(), 586 web_contents(),
577 webstore_item_id, 587 webstore_item_id,
578 requestor_url, 588 requestor_url,
579 callback)); 589 callback));
580 installer->BeginInstall(); 590 installer->BeginInstall();
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 } 789 }
780 } 790 }
781 791
782 void TabHelper::SetTabId(RenderViewHost* render_view_host) { 792 void TabHelper::SetTabId(RenderViewHost* render_view_host) {
783 render_view_host->Send( 793 render_view_host->Send(
784 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(), 794 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(),
785 SessionID::IdForTab(web_contents()))); 795 SessionID::IdForTab(web_contents())));
786 } 796 }
787 797
788 } // namespace extensions 798 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698