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

Side by Side Diff: chrome/browser/ui/gtk/web_intent_picker_gtk.cc

Issue 10166016: Web Intents: Remove the CWS icon from GTK picker. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/gtk/web_intent_picker_gtk.h" 5 #include "chrome/browser/ui/gtk/web_intent_picker_gtk.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 // Hbox containing the header label. 408 // Hbox containing the header label.
409 GtkWidget* header_hbox = gtk_hbox_new(FALSE, 0); 409 GtkWidget* header_hbox = gtk_hbox_new(FALSE, 0);
410 gtk_box_pack_start(GTK_BOX(sub_contents), header_hbox, TRUE, TRUE, 0); 410 gtk_box_pack_start(GTK_BOX(sub_contents), header_hbox, TRUE, TRUE, 0);
411 411
412 // Label text will be set in the call to SetActionString(). 412 // Label text will be set in the call to SetActionString().
413 header_label_ = theme_service->BuildLabel(std::string(), ui::kGdkBlack); 413 header_label_ = theme_service->BuildLabel(std::string(), ui::kGdkBlack);
414 gtk_util::ForceFontSizePixels(header_label_, kHeaderLabelPixelSize); 414 gtk_util::ForceFontSizePixels(header_label_, kHeaderLabelPixelSize);
415 gtk_box_pack_start(GTK_BOX(header_hbox), header_label_, TRUE, TRUE, 0); 415 gtk_box_pack_start(GTK_BOX(header_hbox), header_label_, TRUE, TRUE, 0);
416 gtk_misc_set_alignment(GTK_MISC(header_label_), 0, 0); 416 gtk_misc_set_alignment(GTK_MISC(header_label_), 0, 0);
417 417
418
419 // Add separation between the installed services list and the app suggestions. 418 // Add separation between the installed services list and the app suggestions.
420 GtkWidget* button_alignment = gtk_alignment_new(0.5, 0, 0, 0); 419 GtkWidget* button_alignment = gtk_alignment_new(0.5, 0, 0, 0);
421 gtk_alignment_set_padding(GTK_ALIGNMENT(button_alignment), 0, 420 gtk_alignment_set_padding(GTK_ALIGNMENT(button_alignment), 0,
422 kMainContentPixelSize * 2, 0, 0); 421 kMainContentPixelSize * 2, 0, 0);
423 422
424 // Vbox containing all service buttons. 423 // Vbox containing all service buttons.
425 button_vbox_ = gtk_vbox_new(FALSE, ui::kControlSpacing); 424 button_vbox_ = gtk_vbox_new(FALSE, ui::kControlSpacing);
426 gtk_container_add(GTK_CONTAINER(button_alignment), button_vbox_); 425 gtk_container_add(GTK_CONTAINER(button_alignment), button_vbox_);
427 gtk_box_pack_start(GTK_BOX(sub_contents), button_alignment, TRUE, TRUE, 0); 426 gtk_box_pack_start(GTK_BOX(sub_contents), button_alignment, TRUE, TRUE, 0);
428 427
(...skipping 13 matching lines...) Expand all
442 441
443 // Suggested extensions vbox. 442 // Suggested extensions vbox.
444 extensions_vbox_ = gtk_vbox_new(FALSE, ui::kControlSpacing); 443 extensions_vbox_ = gtk_vbox_new(FALSE, ui::kControlSpacing);
445 GtkWidget* indent_extensions = gtk_alignment_new(0.0, 0.5, 1.0, 1.0); 444 GtkWidget* indent_extensions = gtk_alignment_new(0.0, 0.5, 1.0, 1.0);
446 gtk_alignment_set_padding(GTK_ALIGNMENT(indent_extensions), 0, 0, 445 gtk_alignment_set_padding(GTK_ALIGNMENT(indent_extensions), 0, 0,
447 ui::kGroupIndent, ui::kGroupIndent); 446 ui::kGroupIndent, ui::kGroupIndent);
448 gtk_container_add(GTK_CONTAINER(indent_extensions), extensions_vbox_); 447 gtk_container_add(GTK_CONTAINER(indent_extensions), extensions_vbox_);
449 gtk_widget_set_no_show_all(indent_extensions, TRUE); 448 gtk_widget_set_no_show_all(indent_extensions, TRUE);
450 gtk_box_pack_start(GTK_BOX(sub_contents), indent_extensions, TRUE, TRUE, 0); 449 gtk_box_pack_start(GTK_BOX(sub_contents), indent_extensions, TRUE, TRUE, 0);
451 450
452 // Chrome Web Store icon.
453 GtkWidget* hbox = gtk_hbox_new(FALSE, ui::kControlSpacing);
454 SkBitmap* bmp = ResourceBundle::GetSharedInstance().GetBitmapNamed(
455 IDR_WEBSTORE_ICON_16);
456 GtkWidget* icon = gtk_image_new_from_pixbuf(gfx::GdkPixbufFromSkBitmap(bmp));
457 gtk_box_pack_start(GTK_BOX(hbox), icon, FALSE, FALSE, 0);
458
459 // CWS 'More Suggestions' link. 451 // CWS 'More Suggestions' link.
452 GtkWidget* link_alignment = gtk_alignment_new(0, 0.5f, 0, 0);
460 GtkWidget* more_suggestions_link = theme_service->BuildChromeLinkButton( 453 GtkWidget* more_suggestions_link = theme_service->BuildChromeLinkButton(
461 l10n_util::GetStringUTF8(IDS_INTENT_PICKER_MORE_SUGGESTIONS).c_str()); 454 l10n_util::GetStringUTF8(IDS_INTENT_PICKER_MORE_SUGGESTIONS).c_str());
462 gtk_box_pack_start(GTK_BOX(hbox), more_suggestions_link, FALSE, FALSE, 0); 455 gtk_container_add(GTK_CONTAINER(link_alignment), more_suggestions_link);
463 gtk_chrome_link_button_set_use_gtk_theme( 456 gtk_chrome_link_button_set_use_gtk_theme(
464 GTK_CHROME_LINK_BUTTON(more_suggestions_link), 457 GTK_CHROME_LINK_BUTTON(more_suggestions_link),
465 theme_service->UsingNativeTheme()); 458 theme_service->UsingNativeTheme());
466 gtk_util::ForceFontSizePixels( 459 gtk_util::ForceFontSizePixels(
467 GTK_CHROME_LINK_BUTTON(more_suggestions_link)->label, 460 GTK_CHROME_LINK_BUTTON(more_suggestions_link)->label,
468 kMainContentPixelSize); 461 kMainContentPixelSize);
469 g_signal_connect(more_suggestions_link, "clicked", 462 g_signal_connect(more_suggestions_link, "clicked",
470 G_CALLBACK(OnMoreSuggestionsLinkClickThunk), this); 463 G_CALLBACK(OnMoreSuggestionsLinkClickThunk), this);
471 464
472 GtkWidget* indent_hbox = gtk_util::IndentWidget(hbox); 465 GtkWidget* indent_link = gtk_util::IndentWidget(link_alignment);
473 gtk_box_pack_start(GTK_BOX(sub_contents), indent_hbox, TRUE, TRUE, 0); 466 gtk_box_pack_start(GTK_BOX(sub_contents), indent_link, TRUE, TRUE, 0);
474 467
475 // Throbber, which will be added to the hierarchy when necessary. 468 // Throbber, which will be added to the hierarchy when necessary.
476 throbber_.reset(new ThrobberGtk(theme_service)); 469 throbber_.reset(new ThrobberGtk(theme_service));
477 470
478 g_signal_connect(contents_, "destroy", G_CALLBACK(&OnDestroyThunk), this); 471 g_signal_connect(contents_, "destroy", G_CALLBACK(&OnDestroyThunk), this);
479 } 472 }
480 473
481 void WebIntentPickerGtk::UpdateInstalledServices() { 474 void WebIntentPickerGtk::UpdateInstalledServices() {
482 gtk_util::RemoveAllChildren(button_vbox_); 475 gtk_util::RemoveAllChildren(button_vbox_);
483 476
484 if (model_->GetInstalledServiceCount() == 0) { 477 if (model_->GetInstalledServiceCount() == 0) {
485 gtk_widget_hide(gtk_widget_get_parent(button_vbox_)); 478 gtk_widget_hide(gtk_widget_get_parent(button_vbox_));
486 return; 479 return;
487 } 480 }
488 481
489 for (size_t i = 0; i < model_->GetInstalledServiceCount(); ++i) { 482 for (size_t i = 0; i < model_->GetInstalledServiceCount(); ++i) {
490 const WebIntentPickerModel::InstalledService& installed_service = 483 const WebIntentPickerModel::InstalledService& installed_service =
491 model_->GetInstalledServiceAt(i); 484 model_->GetInstalledServiceAt(i);
492 485
493 GtkWidget* button = gtk_button_new(); 486 GtkWidget* button = gtk_button_new();
494
495 gtk_widget_set_tooltip_text(button, installed_service.url.spec().c_str()); 487 gtk_widget_set_tooltip_text(button, installed_service.url.spec().c_str());
496 gtk_button_set_label(GTK_BUTTON(button), 488 gtk_button_set_label(GTK_BUTTON(button),
497 UTF16ToUTF8(installed_service.title).c_str()); 489 UTF16ToUTF8(installed_service.title).c_str());
498 gtk_button_set_alignment(GTK_BUTTON(button), 0, 0); 490 gtk_button_set_alignment(GTK_BUTTON(button), 0, 0);
499 491
500 gtk_container_add(GTK_CONTAINER(button_vbox_), button); 492 gtk_container_add(GTK_CONTAINER(button_vbox_), button);
501 g_signal_connect(button, "clicked", G_CALLBACK(OnServiceButtonClickThunk), 493 g_signal_connect(button, "clicked", G_CALLBACK(OnServiceButtonClickThunk),
502 this); 494 this);
503 495
504 SetServiceButtonImage(button, installed_service.favicon.ToGdkPixbuf()); 496 SetServiceButtonImage(button, installed_service.favicon.ToGdkPixbuf());
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 return alignment; 598 return alignment;
607 } 599 }
608 600
609 void WebIntentPickerGtk::RemoveThrobber() { 601 void WebIntentPickerGtk::RemoveThrobber() {
610 GtkWidget* alignment = gtk_widget_get_parent(throbber_->widget()); 602 GtkWidget* alignment = gtk_widget_get_parent(throbber_->widget());
611 DCHECK(alignment); 603 DCHECK(alignment);
612 gtk_container_remove(GTK_CONTAINER(alignment), throbber_->widget()); 604 gtk_container_remove(GTK_CONTAINER(alignment), throbber_->widget());
613 gtk_widget_destroy(alignment); 605 gtk_widget_destroy(alignment);
614 throbber_->Stop(); 606 throbber_->Stop();
615 } 607 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698