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

Side by Side Diff: chrome/browser/ui/intents/web_intent_picker_controller.cc

Issue 11035017: Mac Web Intents Part 15: Inline extension install prompt (model) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
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/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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 454
455 void WebIntentPickerController::OnExtensionInstallRequested( 455 void WebIntentPickerController::OnExtensionInstallRequested(
456 const std::string& id) { 456 const std::string& id) {
457 picker_model_->SetPendingInstallExtensionId(id); 457 picker_model_->SetPendingInstallExtensionId(id);
458 458
459 scoped_ptr<WebstoreInstaller::Approval> approval( 459 scoped_ptr<WebstoreInstaller::Approval> approval(
460 WebstoreInstaller::Approval::CreateWithInstallPrompt(profile_)); 460 WebstoreInstaller::Approval::CreateWithInstallPrompt(profile_));
461 // Don't show a bubble pointing to the extension or any other post 461 // Don't show a bubble pointing to the extension or any other post
462 // installation UI. 462 // installation UI.
463 approval->skip_post_install_ui = true; 463 approval->skip_post_install_ui = true;
464 approval->custom_install_dialog_callback = base::Bind(
465 &WebIntentPickerController::OnShowExtensionInstallDialog,
466 weak_ptr_factory_.GetWeakPtr());
464 467
465 scoped_refptr<WebstoreInstaller> installer = new WebstoreInstaller( 468 scoped_refptr<WebstoreInstaller> installer = new WebstoreInstaller(
466 profile_, this, 469 profile_, this,
467 &web_contents_->GetController(), id, 470 &web_contents_->GetController(), id,
468 approval.Pass(), WebstoreInstaller::FLAG_INLINE_INSTALL); 471 approval.Pass(), WebstoreInstaller::FLAG_INLINE_INSTALL);
469 472
470 pending_async_count_++; 473 pending_async_count_++;
471 installer->Start(); 474 installer->Start();
472 } 475 }
473 476
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 const gfx::Image& icon_image) { 873 const gfx::Image& icon_image) {
871 picker_model_->SetSuggestedExtensionIconWithId(extension_id, icon_image); 874 picker_model_->SetSuggestedExtensionIconWithId(extension_id, icon_image);
872 AsyncOperationFinished(); 875 AsyncOperationFinished();
873 } 876 }
874 877
875 void WebIntentPickerController::OnExtensionIconUnavailable( 878 void WebIntentPickerController::OnExtensionIconUnavailable(
876 const std::string& extension_id) { 879 const std::string& extension_id) {
877 AsyncOperationFinished(); 880 AsyncOperationFinished();
878 } 881 }
879 882
883 void WebIntentPickerController::OnShowExtensionInstallDialog(
884 gfx::NativeWindow parent,
885 content::PageNavigator* navigator,
886 ExtensionInstallPrompt::Delegate* delegate,
887 const ExtensionInstallPrompt::Prompt& prompt) {
888 picker_model_->SetPendingInstallDelegate(delegate);
889 picker_model_->SetPendingInstallPrompt(prompt);
890 if (picker_)
891 picker_->OnShowExtensionInstallDialog(parent, navigator, delegate, prompt);
892 }
893
880 void WebIntentPickerController::SetWindowDispositionSource( 894 void WebIntentPickerController::SetWindowDispositionSource(
881 content::WebContents* source, 895 content::WebContents* source,
882 content::WebIntentsDispatcher* dispatcher) { 896 content::WebIntentsDispatcher* dispatcher) {
883 DCHECK(source); 897 DCHECK(source);
884 DCHECK(dispatcher); 898 DCHECK(dispatcher);
885 window_disposition_source_ = source; 899 window_disposition_source_ = source;
886 if (window_disposition_source_) { 900 if (window_disposition_source_) {
887 // This object is self-deleting when the source WebContents is destroyed. 901 // This object is self-deleting when the source WebContents is destroyed.
888 new SourceWindowObserver(window_disposition_source_, 902 new SourceWindowObserver(window_disposition_source_,
889 weak_ptr_factory_.GetWeakPtr()); 903 weak_ptr_factory_.GetWeakPtr());
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 content::DownloadManager* download_manager = 1111 content::DownloadManager* download_manager =
1098 content::BrowserContext::GetDownloadManager(profile); 1112 content::BrowserContext::GetDownloadManager(profile);
1099 if (!download_manager) 1113 if (!download_manager)
1100 return; 1114 return;
1101 content::DownloadItem* item = 1115 content::DownloadItem* item =
1102 download_manager->GetDownload(download_id_.local()); 1116 download_manager->GetDownload(download_id_.local());
1103 if (item) 1117 if (item)
1104 item->Cancel(true); 1118 item->Cancel(true);
1105 download_id_ = content::DownloadId(); 1119 download_id_ = content::DownloadId();
1106 } 1120 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698