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

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: fix merge 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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 441
442 void WebIntentPickerController::OnExtensionInstallRequested( 442 void WebIntentPickerController::OnExtensionInstallRequested(
443 const std::string& id) { 443 const std::string& id) {
444 picker_model_->SetPendingExtensionInstallId(id); 444 picker_model_->SetPendingExtensionInstallId(id);
445 445
446 scoped_ptr<WebstoreInstaller::Approval> approval( 446 scoped_ptr<WebstoreInstaller::Approval> approval(
447 WebstoreInstaller::Approval::CreateWithInstallPrompt(profile_)); 447 WebstoreInstaller::Approval::CreateWithInstallPrompt(profile_));
448 // Don't show a bubble pointing to the extension or any other post 448 // Don't show a bubble pointing to the extension or any other post
449 // installation UI. 449 // installation UI.
450 approval->skip_post_install_ui = true; 450 approval->skip_post_install_ui = true;
451 approval->show_dialog_callback = base::Bind(
452 &WebIntentPickerController::OnShowExtensionInstallDialog,
453 weak_ptr_factory_.GetWeakPtr());
451 454
452 scoped_refptr<WebstoreInstaller> installer = new WebstoreInstaller( 455 scoped_refptr<WebstoreInstaller> installer = new WebstoreInstaller(
453 profile_, this, 456 profile_, this,
454 &web_contents_->GetController(), id, 457 &web_contents_->GetController(), id,
455 approval.Pass(), WebstoreInstaller::FLAG_INLINE_INSTALL); 458 approval.Pass(), WebstoreInstaller::FLAG_INLINE_INSTALL);
456 459
457 pending_async_count_++; 460 pending_async_count_++;
458 installer->Start(); 461 installer->Start();
459 } 462 }
460 463
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 const gfx::Image& icon_image) { 861 const gfx::Image& icon_image) {
859 picker_model_->SetSuggestedExtensionIconWithId(extension_id, icon_image); 862 picker_model_->SetSuggestedExtensionIconWithId(extension_id, icon_image);
860 AsyncOperationFinished(); 863 AsyncOperationFinished();
861 } 864 }
862 865
863 void WebIntentPickerController::OnExtensionIconUnavailable( 866 void WebIntentPickerController::OnExtensionIconUnavailable(
864 const std::string& extension_id) { 867 const std::string& extension_id) {
865 AsyncOperationFinished(); 868 AsyncOperationFinished();
866 } 869 }
867 870
871 void WebIntentPickerController::OnShowExtensionInstallDialog(
872 gfx::NativeWindow parent,
873 content::PageNavigator* navigator,
874 ExtensionInstallPrompt::Delegate* delegate,
875 const ExtensionInstallPrompt::Prompt& prompt) {
876 picker_model_->SetPendingExtensionInstallDelegate(delegate);
877 picker_model_->SetPendingExtensionInstallPrompt(prompt);
878 if (picker_)
879 picker_->OnShowExtensionInstallDialog(parent, navigator, delegate, prompt);
880 }
881
868 void WebIntentPickerController::SetWindowDispositionSource( 882 void WebIntentPickerController::SetWindowDispositionSource(
869 content::WebContents* source, 883 content::WebContents* source,
870 content::WebIntentsDispatcher* dispatcher) { 884 content::WebIntentsDispatcher* dispatcher) {
871 DCHECK(source); 885 DCHECK(source);
872 DCHECK(dispatcher); 886 DCHECK(dispatcher);
873 window_disposition_source_ = source; 887 window_disposition_source_ = source;
874 if (window_disposition_source_) { 888 if (window_disposition_source_) {
875 // This object is self-deleting when the source WebContents is destroyed. 889 // This object is self-deleting when the source WebContents is destroyed.
876 new SourceWindowObserver(window_disposition_source_, 890 new SourceWindowObserver(window_disposition_source_,
877 weak_ptr_factory_.GetWeakPtr()); 891 weak_ptr_factory_.GetWeakPtr());
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 content::DownloadManager* download_manager = 1096 content::DownloadManager* download_manager =
1083 content::BrowserContext::GetDownloadManager(profile); 1097 content::BrowserContext::GetDownloadManager(profile);
1084 if (!download_manager) 1098 if (!download_manager)
1085 return; 1099 return;
1086 content::DownloadItem* item = 1100 content::DownloadItem* item =
1087 download_manager->GetDownload(download_id_.local()); 1101 download_manager->GetDownload(download_id_.local());
1088 if (item) 1102 if (item)
1089 item->Cancel(true); 1103 item->Cancel(true);
1090 download_id_ = content::DownloadId(); 1104 download_id_ = content::DownloadId();
1091 } 1105 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/intents/web_intent_picker_controller.h ('k') | chrome/browser/ui/intents/web_intent_picker_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698