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