| 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/ui/intents/web_intent_picker_controller.h" | 5 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 } | 301 } |
| 302 | 302 |
| 303 void WebIntentPickerController::OnInlineDispositionWebContentsCreated( | 303 void WebIntentPickerController::OnInlineDispositionWebContentsCreated( |
| 304 content::WebContents* web_contents) { | 304 content::WebContents* web_contents) { |
| 305 if (web_contents) | 305 if (web_contents) |
| 306 intents_dispatcher_->DispatchIntent(web_contents); | 306 intents_dispatcher_->DispatchIntent(web_contents); |
| 307 } | 307 } |
| 308 | 308 |
| 309 void WebIntentPickerController::OnExtensionInstallRequested( | 309 void WebIntentPickerController::OnExtensionInstallRequested( |
| 310 const std::string& id) { | 310 const std::string& id) { |
| 311 scoped_ptr<WebstoreInstaller::Approval> approval( |
| 312 WebstoreInstaller::Approval::CreateWithInstallPrompt( |
| 313 wrapper_->profile())); |
| 314 |
| 311 scoped_refptr<WebstoreInstaller> installer = new WebstoreInstaller( | 315 scoped_refptr<WebstoreInstaller> installer = new WebstoreInstaller( |
| 312 wrapper_->profile(), this, &wrapper_->web_contents()->GetController(), id, | 316 wrapper_->profile(), this, &wrapper_->web_contents()->GetController(), id, |
| 313 scoped_ptr<WebstoreInstaller::Approval>(NULL), | 317 approval.Pass(), WebstoreInstaller::FLAG_INLINE_INSTALL); |
| 314 WebstoreInstaller::FLAG_INLINE_INSTALL); | |
| 315 | 318 |
| 316 pending_async_count_++; | 319 pending_async_count_++; |
| 317 installer->Start(); | 320 installer->Start(); |
| 318 } | 321 } |
| 319 | 322 |
| 320 void WebIntentPickerController::OnExtensionLinkClicked(const std::string& id) { | 323 void WebIntentPickerController::OnExtensionLinkClicked(const std::string& id) { |
| 321 // Navigate from source tab. | 324 // Navigate from source tab. |
| 322 Browser* browser = | 325 Browser* browser = |
| 323 browser::FindBrowserWithWebContents(wrapper_->web_contents()); | 326 browser::FindBrowserWithWebContents(wrapper_->web_contents()); |
| 324 GURL extension_url(extension_urls::GetWebstoreItemDetailURLPrefix() + id); | 327 GURL extension_url(extension_urls::GetWebstoreItemDetailURLPrefix() + id); |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 // If picker is non-NULL, it was set by a test. | 688 // If picker is non-NULL, it was set by a test. |
| 686 if (picker_ == NULL) | 689 if (picker_ == NULL) |
| 687 picker_ = WebIntentPicker::Create(wrapper_, this, picker_model_.get()); | 690 picker_ = WebIntentPicker::Create(wrapper_, this, picker_model_.get()); |
| 688 picker_shown_ = true; | 691 picker_shown_ = true; |
| 689 } | 692 } |
| 690 | 693 |
| 691 void WebIntentPickerController::ClosePicker() { | 694 void WebIntentPickerController::ClosePicker() { |
| 692 if (picker_) | 695 if (picker_) |
| 693 picker_->Close(); | 696 picker_->Close(); |
| 694 } | 697 } |
| OLD | NEW |