| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <gtk/gtk.h> | 5 #include <gtk/gtk.h> |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/extensions/extension_install_dialog.h" | 9 #include "chrome/browser/extensions/extension_install_dialog.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 const Extension* extension, | 55 const Extension* extension, |
| 56 ExtensionInstallUI::Delegate *delegate, | 56 ExtensionInstallUI::Delegate *delegate, |
| 57 const std::vector<string16>& permissions, | 57 const std::vector<string16>& permissions, |
| 58 ExtensionInstallUI::PromptType type) { | 58 ExtensionInstallUI::PromptType type) { |
| 59 // Build the dialog. | 59 // Build the dialog. |
| 60 GtkWidget* dialog = gtk_dialog_new_with_buttons( | 60 GtkWidget* dialog = gtk_dialog_new_with_buttons( |
| 61 l10n_util::GetStringUTF8(ExtensionInstallUI::kTitleIds[type]).c_str(), | 61 l10n_util::GetStringUTF8(ExtensionInstallUI::kTitleIds[type]).c_str(), |
| 62 parent, | 62 parent, |
| 63 GTK_DIALOG_MODAL, | 63 GTK_DIALOG_MODAL, |
| 64 NULL); | 64 NULL); |
| 65 GtkWidget* close_button = gtk_dialog_add_button(GTK_DIALOG(dialog), | 65 int cancel = ExtensionInstallUI::kAbortButtonIds[type]; |
| 66 GTK_STOCK_CANCEL, GTK_RESPONSE_CLOSE); | 66 GtkWidget* close_button = gtk_dialog_add_button( |
| 67 GTK_DIALOG(dialog), |
| 68 cancel > 0 ? l10n_util::GetStringUTF8(cancel).c_str(): GTK_STOCK_CANCEL, |
| 69 GTK_RESPONSE_CLOSE); |
| 67 gtk_dialog_add_button( | 70 gtk_dialog_add_button( |
| 68 GTK_DIALOG(dialog), | 71 GTK_DIALOG(dialog), |
| 69 l10n_util::GetStringUTF8(ExtensionInstallUI::kButtonIds[type]).c_str(), | 72 l10n_util::GetStringUTF8(ExtensionInstallUI::kButtonIds[type]).c_str(), |
| 70 GTK_RESPONSE_ACCEPT); | 73 GTK_RESPONSE_ACCEPT); |
| 71 gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); | 74 gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); |
| 72 | 75 |
| 73 // Create a two column layout. | 76 // Create a two column layout. |
| 74 GtkWidget* content_area = GTK_DIALOG(dialog)->vbox; | 77 GtkWidget* content_area = GTK_DIALOG(dialog)->vbox; |
| 75 gtk_box_set_spacing(GTK_BOX(content_area), gtk_util::kContentAreaSpacing); | 78 gtk_box_set_spacing(GTK_BOX(content_area), gtk_util::kContentAreaSpacing); |
| 76 | 79 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 BrowserWindowGtk* browser_window = static_cast<BrowserWindowGtk*>( | 188 BrowserWindowGtk* browser_window = static_cast<BrowserWindowGtk*>( |
| 186 browser->window()); | 189 browser->window()); |
| 187 if (!browser_window) { | 190 if (!browser_window) { |
| 188 delegate->InstallUIAbort(false); | 191 delegate->InstallUIAbort(false); |
| 189 return; | 192 return; |
| 190 } | 193 } |
| 191 | 194 |
| 192 ShowInstallDialog( | 195 ShowInstallDialog( |
| 193 browser_window->window(), icon, extension, delegate, permissions, type); | 196 browser_window->window(), icon, extension, delegate, permissions, type); |
| 194 } | 197 } |
| OLD | NEW |