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

Side by Side Diff: chrome/browser/extensions/extension_install_prompt.cc

Issue 11131002: Make show_dialog_callback optional in ExtensionInstallPrompt (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/extensions/extension_install_prompt.h" 5 #include "chrome/browser/extensions/extension_install_prompt.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 void ExtensionInstallPrompt::ConfirmInstall( 395 void ExtensionInstallPrompt::ConfirmInstall(
396 Delegate* delegate, 396 Delegate* delegate,
397 const Extension* extension, 397 const Extension* extension,
398 const ShowDialogCallback& show_dialog_callback) { 398 const ShowDialogCallback& show_dialog_callback) {
399 DCHECK(ui_loop_ == MessageLoop::current()); 399 DCHECK(ui_loop_ == MessageLoop::current());
400 extension_ = extension; 400 extension_ = extension;
401 permissions_ = extension->GetActivePermissions(); 401 permissions_ = extension->GetActivePermissions();
402 delegate_ = delegate; 402 delegate_ = delegate;
403 prompt_type_ = INSTALL_PROMPT; 403 prompt_type_ = INSTALL_PROMPT;
404 show_dialog_callback_ = show_dialog_callback; 404 show_dialog_callback_ = show_dialog_callback;
405 DCHECK(!show_dialog_callback_.is_null());
406 405
407 // We special-case themes to not show any confirm UI. Instead they are 406 // We special-case themes to not show any confirm UI. Instead they are
408 // immediately installed, and then we show an infobar (see OnInstallSuccess) 407 // immediately installed, and then we show an infobar (see OnInstallSuccess)
409 // to allow the user to revert if they don't like it. 408 // to allow the user to revert if they don't like it.
410 // 409 //
411 // We don't do this in the case where off-store extension installs are 410 // We don't do this in the case where off-store extension installs are
412 // disabled because in that case, we don't show the dangerous download UI, so 411 // disabled because in that case, we don't show the dangerous download UI, so
413 // we need the UI confirmation. 412 // we need the UI confirmation.
414 if (extension->is_theme()) { 413 if (extension->is_theme()) {
415 if (extension->from_webstore() || 414 if (extension->from_webstore() ||
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 break; 581 break;
583 } 582 }
584 default: 583 default:
585 NOTREACHED() << "Unknown message"; 584 NOTREACHED() << "Unknown message";
586 return; 585 return;
587 } 586 }
588 587
589 if (AutoConfirmPrompt(delegate_)) 588 if (AutoConfirmPrompt(delegate_))
590 return; 589 return;
591 590
592 DCHECK(!show_dialog_callback_.is_null()); 591 if (show_dialog_callback_.is_null())
593 show_dialog_callback_.Run(parent_, navigator_, delegate_, prompt_); 592 GetDefaultShowDialogCallback().Run(parent_, navigator_, delegate_, prompt_);
593 else
594 show_dialog_callback_.Run(parent_, navigator_, delegate_, prompt_);
594 } 595 }
595 596
596 namespace chrome { 597 namespace chrome {
597 598
598 ExtensionInstallPrompt* CreateExtensionInstallPromptWithBrowser( 599 ExtensionInstallPrompt* CreateExtensionInstallPromptWithBrowser(
599 Browser* browser) { 600 Browser* browser) {
600 // |browser| can be NULL in unit tests. 601 // |browser| can be NULL in unit tests.
601 if (!browser) 602 if (!browser)
602 return new ExtensionInstallPrompt(NULL, NULL, NULL); 603 return new ExtensionInstallPrompt(NULL, NULL, NULL);
603 gfx::NativeWindow parent = 604 gfx::NativeWindow parent =
604 browser->window() ? browser->window()->GetNativeWindow() : NULL; 605 browser->window() ? browser->window()->GetNativeWindow() : NULL;
605 return new ExtensionInstallPrompt(parent, browser, browser->profile()); 606 return new ExtensionInstallPrompt(parent, browser, browser->profile());
606 } 607 }
607 608
608 } // namespace chrome 609 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/extensions/crx_installer.cc ('k') | chrome/browser/extensions/webstore_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698