| 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" |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 return; | 378 return; |
| 379 } | 379 } |
| 380 // Inform the Webstore API that an inline install is happening, in case the | 380 // Inform the Webstore API that an inline install is happening, in case the |
| 381 // page requested status updates. | 381 // page requested status updates. |
| 382 Profile* profile = | 382 Profile* profile = |
| 383 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 383 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
| 384 WebstoreAPI::Get(profile)->OnInlineInstallStart( | 384 WebstoreAPI::Get(profile)->OnInlineInstallStart( |
| 385 return_route_id, this, webstore_item_id, listeners_mask); | 385 return_route_id, this, webstore_item_id, listeners_mask); |
| 386 | 386 |
| 387 WebstoreStandaloneInstaller::Callback callback = | 387 WebstoreStandaloneInstaller::Callback callback = |
| 388 base::Bind(&TabHelper::OnInlineInstallComplete, base::Unretained(this), | 388 base::Bind(&TabHelper::OnInlineInstallComplete, |
| 389 install_id, return_route_id); | 389 base::Unretained(this), |
| 390 install_id, |
| 391 return_route_id); |
| 390 scoped_refptr<WebstoreInlineInstaller> installer( | 392 scoped_refptr<WebstoreInlineInstaller> installer( |
| 391 webstore_inline_installer_factory_->CreateInstaller( | 393 webstore_inline_installer_factory_->CreateInstaller( |
| 392 web_contents(), | 394 web_contents(), |
| 393 webstore_item_id, | 395 webstore_item_id, |
| 394 requestor_url, | 396 requestor_url, |
| 395 callback)); | 397 callback)); |
| 396 installer->BeginInstall(); | 398 installer->BeginInstall(); |
| 397 } | 399 } |
| 398 | 400 |
| 399 void TabHelper::OnGetAppInstallState(const GURL& requestor_url, | 401 void TabHelper::OnGetAppInstallState(const GURL& requestor_url, |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 } | 511 } |
| 510 } | 512 } |
| 511 | 513 |
| 512 WindowController* TabHelper::GetExtensionWindowController() const { | 514 WindowController* TabHelper::GetExtensionWindowController() const { |
| 513 return ExtensionTabUtil::GetWindowControllerOfTab(web_contents()); | 515 return ExtensionTabUtil::GetWindowControllerOfTab(web_contents()); |
| 514 } | 516 } |
| 515 | 517 |
| 516 void TabHelper::OnInlineInstallComplete(int install_id, | 518 void TabHelper::OnInlineInstallComplete(int install_id, |
| 517 int return_route_id, | 519 int return_route_id, |
| 518 bool success, | 520 bool success, |
| 519 const std::string& error) { | 521 const std::string& error, |
| 522 webstore_install::Result result) { |
| 520 Send(new ExtensionMsg_InlineWebstoreInstallResponse( | 523 Send(new ExtensionMsg_InlineWebstoreInstallResponse( |
| 521 return_route_id, install_id, success, success ? std::string() : error)); | 524 return_route_id, |
| 525 install_id, |
| 526 success, |
| 527 success ? std::string() : error, |
| 528 result)); |
| 522 } | 529 } |
| 523 | 530 |
| 524 WebContents* TabHelper::GetAssociatedWebContents() const { | 531 WebContents* TabHelper::GetAssociatedWebContents() const { |
| 525 return web_contents(); | 532 return web_contents(); |
| 526 } | 533 } |
| 527 | 534 |
| 528 void TabHelper::GetApplicationInfo(WebAppAction action) { | 535 void TabHelper::GetApplicationInfo(WebAppAction action) { |
| 529 NavigationEntry* entry = | 536 NavigationEntry* entry = |
| 530 web_contents()->GetController().GetLastCommittedEntry(); | 537 web_contents()->GetController().GetLastCommittedEntry(); |
| 531 if (!entry) | 538 if (!entry) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 556 } | 563 } |
| 557 } | 564 } |
| 558 | 565 |
| 559 void TabHelper::SetTabId(RenderViewHost* render_view_host) { | 566 void TabHelper::SetTabId(RenderViewHost* render_view_host) { |
| 560 render_view_host->Send( | 567 render_view_host->Send( |
| 561 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(), | 568 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(), |
| 562 SessionID::IdForTab(web_contents()))); | 569 SessionID::IdForTab(web_contents()))); |
| 563 } | 570 } |
| 564 | 571 |
| 565 } // namespace extensions | 572 } // namespace extensions |
| OLD | NEW |