On Chrome uninstall, if App Launcher is installed, then hide the "Also delete your browser data?" check box.


Review URL: https://chromiumcodereview.appspot.com/11421141

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171173 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/chrome_browser_main_win.cc b/chrome/browser/chrome_browser_main_win.cc
index fa07e02..1c37072 100644
--- a/chrome/browser/chrome_browser_main_win.cc
+++ b/chrome/browser/chrome_browser_main_win.cc
@@ -37,6 +37,7 @@
 #include "chrome/common/chrome_result_codes.h"
 #include "chrome/common/chrome_switches.h"
 #include "chrome/common/env_vars.h"
+#include "chrome/installer/launcher_support/chrome_launcher_support.h"
 #include "chrome/installer/util/browser_distribution.h"
 #include "chrome/installer/util/helper.h"
 #include "chrome/installer/util/install_util.h"
@@ -125,7 +126,9 @@
     ShowCloseBrowserFirstMessageBox();
     return chrome::RESULT_CODE_UNINSTALL_CHROME_ALIVE;
   }
-  int result = chrome::ShowUninstallBrowserPrompt();
+  int result = chrome::ShowUninstallBrowserPrompt(
+      !chrome_launcher_support::IsAppLauncherPresent());
+  // Don't offer to delete the profile if the App Launcher is also installed.
   if (browser_util::IsBrowserAlreadyRunning()) {
     ShowCloseBrowserFirstMessageBox();
     return chrome::RESULT_CODE_UNINSTALL_CHROME_ALIVE;
diff --git a/chrome/browser/ui/uninstall_browser_prompt.h b/chrome/browser/ui/uninstall_browser_prompt.h
index 15ce952..eb3c5bc 100644
--- a/chrome/browser/ui/uninstall_browser_prompt.h
+++ b/chrome/browser/ui/uninstall_browser_prompt.h
@@ -11,7 +11,7 @@
 // content::RESULT_CODE_NORMAL_EXIT,
 // chrome::RESULT_CODE_UNINSTALL_DELETE_PROFILE or
 // chrome::RESULT_CODE_UNINSTALL_USER_CANCEL.
-int ShowUninstallBrowserPrompt();
+int ShowUninstallBrowserPrompt(bool show_delete_profile);
 
 }  // namespace chrome
 
diff --git a/chrome/browser/ui/views/uninstall_view.cc b/chrome/browser/ui/views/uninstall_view.cc
index 42a7ea512..41fbb46 100644
--- a/chrome/browser/ui/views/uninstall_view.cc
+++ b/chrome/browser/ui/views/uninstall_view.cc
@@ -23,8 +23,10 @@
 #include "ui/views/widget/widget.h"
 
 UninstallView::UninstallView(int* user_selection,
-                             const base::Closure& quit_closure)
+                             const base::Closure& quit_closure,
+                             bool show_delete_profile)
     : confirm_label_(NULL),
+      show_delete_profile_(show_delete_profile),
       delete_profile_(NULL),
       change_default_browser_(NULL),
       browsers_combo_(NULL),
@@ -59,15 +61,17 @@
   layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing);
 
   // The "delete profile" check box.
-  ++column_set_id;
-  column_set = layout->AddColumnSet(column_set_id);
-  column_set->AddPaddingColumn(0, views::kPanelHorizIndentation);
-  column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
-                        GridLayout::USE_PREF, 0, 0);
-  layout->StartRow(0, column_set_id);
-  delete_profile_ = new views::Checkbox(
-      l10n_util::GetStringUTF16(IDS_UNINSTALL_DELETE_PROFILE));
-  layout->AddView(delete_profile_);
+  if (show_delete_profile_) {
+    ++column_set_id;
+    column_set = layout->AddColumnSet(column_set_id);
+    column_set->AddPaddingColumn(0, views::kPanelHorizIndentation);
+    column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
+                          GridLayout::USE_PREF, 0, 0);
+    layout->StartRow(0, column_set_id);
+    delete_profile_ = new views::Checkbox(
+        l10n_util::GetStringUTF16(IDS_UNINSTALL_DELETE_PROFILE));
+    layout->AddView(delete_profile_);
+  }
 
   // Set default browser combo box. If the default should not or cannot be
   // changed, widgets are not shown. We assume here that if Chrome cannot
@@ -107,7 +111,7 @@
 
 bool UninstallView::Accept() {
   user_selection_ = content::RESULT_CODE_NORMAL_EXIT;
-  if (delete_profile_->checked())
+  if (show_delete_profile_ && delete_profile_->checked())
     user_selection_ = chrome::RESULT_CODE_UNINSTALL_DELETE_PROFILE;
   if (change_default_browser_ && change_default_browser_->checked()) {
     BrowsersMap::const_iterator i = browsers_->begin();
@@ -163,12 +167,14 @@
 
 namespace chrome {
 
-int ShowUninstallBrowserPrompt() {
+int ShowUninstallBrowserPrompt(bool show_delete_profile) {
   DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type());
   int result = content::RESULT_CODE_NORMAL_EXIT;
   views::AcceleratorHandler accelerator_handler;
   base::RunLoop run_loop(&accelerator_handler);
-  UninstallView* view = new UninstallView(&result, run_loop.QuitClosure());
+  UninstallView* view = new UninstallView(&result,
+                                          run_loop.QuitClosure(),
+                                          show_delete_profile);
   views::Widget::CreateWindow(view)->Show();
   run_loop.Run();
   return result;
diff --git a/chrome/browser/ui/views/uninstall_view.h b/chrome/browser/ui/views/uninstall_view.h
index ce086f9..d660b3112 100644
--- a/chrome/browser/ui/views/uninstall_view.h
+++ b/chrome/browser/ui/views/uninstall_view.h
@@ -29,7 +29,8 @@
                       public ui::ComboboxModel {
  public:
   explicit UninstallView(int* user_selection,
-                         const base::Closure& quit_closure);
+                         const base::Closure& quit_closure,
+                         bool show_delete_profile);
   virtual ~UninstallView();
 
   // Overridden form views::ButtonListener.
@@ -56,6 +57,7 @@
   void SetupControls();
 
   views::Label* confirm_label_;
+  bool show_delete_profile_;
   views::Checkbox* delete_profile_;
   views::Checkbox* change_default_browser_;
   views::Combobox* browsers_combo_;
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
old mode 100644
new mode 100755
index ea6e71b..83cc52b
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -2584,6 +2584,7 @@
                 ['exclude', '^browser/lifetime/application_lifetime_win.cc'],
               ],
               'dependencies': [
+                'launcher_support',
                 '../ui/metro_viewer/metro_viewer.gyp:metro_viewer',
               ],
             }],