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

Side by Side Diff: chrome/browser/ui/gtk/extensions/extension_install_dialog_gtk.cc

Issue 145153002: Make sideloaded (externally installed) extensions display webstore info (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ChromeOS fix Created 6 years, 10 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
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 <gtk/gtk.h> 5 #include <gtk/gtk.h>
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/extensions/bundle_installer.h" 10 #include "chrome/browser/extensions/bundle_installer.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 ExtensionInstallPrompt::Delegate *delegate, 109 ExtensionInstallPrompt::Delegate *delegate,
110 const ExtensionInstallPrompt::Prompt& prompt) 110 const ExtensionInstallPrompt::Prompt& prompt)
111 : navigator_(show_params.navigator), 111 : navigator_(show_params.navigator),
112 delegate_(delegate), 112 delegate_(delegate),
113 dialog_(NULL) { 113 dialog_(NULL) {
114 bool show_permissions = prompt.ShouldShowPermissions(); 114 bool show_permissions = prompt.ShouldShowPermissions();
115 bool show_oauth_issues = prompt.GetOAuthIssueCount() > 0; 115 bool show_oauth_issues = prompt.GetOAuthIssueCount() > 0;
116 bool show_retained_files = prompt.GetRetainedFileCount() > 0; 116 bool show_retained_files = prompt.GetRetainedFileCount() > 0;
117 bool is_inline_install = 117 bool is_inline_install =
118 prompt.type() == ExtensionInstallPrompt::INLINE_INSTALL_PROMPT; 118 prompt.type() == ExtensionInstallPrompt::INLINE_INSTALL_PROMPT;
119 bool has_webstore_data = prompt.has_webstore_data();
119 bool is_bundle_install = 120 bool is_bundle_install =
120 prompt.type() == ExtensionInstallPrompt::BUNDLE_INSTALL_PROMPT; 121 prompt.type() == ExtensionInstallPrompt::BUNDLE_INSTALL_PROMPT;
121 bool is_external_install = 122 bool is_external_install =
122 prompt.type() == ExtensionInstallPrompt::EXTERNAL_INSTALL_PROMPT; 123 prompt.type() == ExtensionInstallPrompt::EXTERNAL_INSTALL_PROMPT;
123 124
124 if (is_inline_install) 125 if (is_inline_install)
125 extension_id_ = prompt.extension()->id(); 126 extension_id_ = prompt.extension()->id();
126 127
127 // Build the dialog. 128 // Build the dialog.
128 gfx::NativeWindow parent = show_params.parent_window; 129 gfx::NativeWindow parent = show_params.parent_window;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 gtk_box_pack_start(GTK_BOX(left_column_area), heading_vbox, center_heading, 192 gtk_box_pack_start(GTK_BOX(left_column_area), heading_vbox, center_heading,
192 center_heading, 0); 193 center_heading, 0);
193 194
194 // Heading 195 // Heading
195 GtkWidget* heading_label = gtk_util::CreateBoldLabel( 196 GtkWidget* heading_label = gtk_util::CreateBoldLabel(
196 base::UTF16ToUTF8(prompt.GetHeading().c_str())); 197 base::UTF16ToUTF8(prompt.GetHeading().c_str()));
197 gtk_util::SetLabelWidth(heading_label, left_column_min_width); 198 gtk_util::SetLabelWidth(heading_label, left_column_min_width);
198 gtk_box_pack_start(GTK_BOX(heading_vbox), heading_label, center_heading, 199 gtk_box_pack_start(GTK_BOX(heading_vbox), heading_label, center_heading,
199 center_heading, 0); 200 center_heading, 0);
200 201
201 if (is_inline_install) { 202 if (has_webstore_data) {
202 // Average rating (as stars) and number of ratings. 203 // Average rating (as stars) and number of ratings.
203 GtkWidget* stars_hbox = gtk_hbox_new(FALSE, 0); 204 GtkWidget* stars_hbox = gtk_hbox_new(FALSE, 0);
204 gtk_box_pack_start(GTK_BOX(heading_vbox), stars_hbox, FALSE, FALSE, 0); 205 gtk_box_pack_start(GTK_BOX(heading_vbox), stars_hbox, FALSE, FALSE, 0);
205 prompt.AppendRatingStars(AddResourceIcon, stars_hbox); 206 prompt.AppendRatingStars(AddResourceIcon, stars_hbox);
206 GtkWidget* rating_label = gtk_label_new(base::UTF16ToUTF8( 207 GtkWidget* rating_label = gtk_label_new(base::UTF16ToUTF8(
207 prompt.GetRatingCount()).c_str()); 208 prompt.GetRatingCount()).c_str());
208 gtk_util::ForceFontSizePixels(rating_label, kRatingTextSize); 209 gtk_util::ForceFontSizePixels(rating_label, kRatingTextSize);
209 gtk_box_pack_start(GTK_BOX(stars_hbox), rating_label, 210 gtk_box_pack_start(GTK_BOX(stars_hbox), rating_label,
210 FALSE, FALSE, 3); 211 FALSE, FALSE, 3);
211 212
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 new chrome::ExtensionInstallDialog(show_params, delegate, prompt); 433 new chrome::ExtensionInstallDialog(show_params, delegate, prompt);
433 } 434 }
434 435
435 } // namespace 436 } // namespace
436 437
437 // static 438 // static
438 ExtensionInstallPrompt::ShowDialogCallback 439 ExtensionInstallPrompt::ShowDialogCallback
439 ExtensionInstallPrompt::GetDefaultShowDialogCallback() { 440 ExtensionInstallPrompt::GetDefaultShowDialogCallback() {
440 return base::Bind(&ShowExtensionInstallDialogImpl); 441 return base::Bind(&ShowExtensionInstallDialogImpl);
441 } 442 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698