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