| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/gtk/location_bar_view_gtk.h" | 5 #include "chrome/browser/gtk/location_bar_view_gtk.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "app/gtk_dnd_util.h" | 9 #include "app/gtk_dnd_util.h" |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // Extra vertical spacing for first run bubble. | 72 // Extra vertical spacing for first run bubble. |
| 73 const int kFirstRunBubbleTopMargin = 5; | 73 const int kFirstRunBubbleTopMargin = 5; |
| 74 | 74 |
| 75 // The padding around the top, bottom, and sides of the location bar hbox. | 75 // The padding around the top, bottom, and sides of the location bar hbox. |
| 76 // We don't want to edit control's text to be right against the edge, | 76 // We don't want to edit control's text to be right against the edge, |
| 77 // as well the tab to search box and other widgets need to have the padding on | 77 // as well the tab to search box and other widgets need to have the padding on |
| 78 // top and bottom to avoid drawing larger than the location bar space. | 78 // top and bottom to avoid drawing larger than the location bar space. |
| 79 const int kHboxBorder = 4; | 79 const int kHboxBorder = 4; |
| 80 | 80 |
| 81 // Padding between the elements in the bar. | 81 // Padding between the elements in the bar. |
| 82 static const int kInnerPadding = 4; | 82 const int kInnerPadding = 4; |
| 83 |
| 84 // Padding between the right of the star and the edge of the URL entry. |
| 85 const int kStarRightPadding = 2; |
| 83 | 86 |
| 84 // Colors used to draw the EV certificate rounded bubble. | 87 // Colors used to draw the EV certificate rounded bubble. |
| 85 const GdkColor kEvSecureTextColor = GDK_COLOR_RGB(0x07, 0x95, 0x00); | 88 const GdkColor kEvSecureTextColor = GDK_COLOR_RGB(0x07, 0x95, 0x00); |
| 86 const GdkColor kEvSecureBackgroundColor = GDK_COLOR_RGB(0xef, 0xfc, 0xef); | 89 const GdkColor kEvSecureBackgroundColor = GDK_COLOR_RGB(0xef, 0xfc, 0xef); |
| 87 const GdkColor kEvSecureBorderColor = GDK_COLOR_RGB(0x90, 0xc3, 0x90); | 90 const GdkColor kEvSecureBorderColor = GDK_COLOR_RGB(0x90, 0xc3, 0x90); |
| 88 | 91 |
| 89 // Colors used to draw the Tab to Search rounded bubble. | 92 // Colors used to draw the Tab to Search rounded bubble. |
| 90 const GdkColor kKeywordBackgroundColor = GDK_COLOR_RGB(0xf0, 0xf4, 0xfa); | 93 const GdkColor kKeywordBackgroundColor = GDK_COLOR_RGB(0xf0, 0xf4, 0xfa); |
| 91 const GdkColor kKeywordBorderColor = GDK_COLOR_RGB(0xcb, 0xde, 0xf7); | 94 const GdkColor kKeywordBorderColor = GDK_COLOR_RGB(0xcb, 0xde, 0xf7); |
| 92 | 95 |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 if (show_selected_keyword_) | 468 if (show_selected_keyword_) |
| 466 SetKeywordLabel(keyword); | 469 SetKeywordLabel(keyword); |
| 467 | 470 |
| 468 if (show_keyword_hint_) | 471 if (show_keyword_hint_) |
| 469 SetKeywordHintLabel(keyword); | 472 SetKeywordHintLabel(keyword); |
| 470 | 473 |
| 471 AdjustChildrenVisibility(); | 474 AdjustChildrenVisibility(); |
| 472 } | 475 } |
| 473 | 476 |
| 474 void LocationBarViewGtk::CreateStarButton() { | 477 void LocationBarViewGtk::CreateStarButton() { |
| 478 star_image_ = gtk_image_new(); |
| 479 |
| 480 GtkWidget* alignment = gtk_alignment_new(0, 0, 1, 1); |
| 481 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 0, |
| 482 0, kStarRightPadding); |
| 483 gtk_container_add(GTK_CONTAINER(alignment), star_image_); |
| 484 |
| 475 star_.Own(gtk_event_box_new()); | 485 star_.Own(gtk_event_box_new()); |
| 476 gtk_event_box_set_visible_window(GTK_EVENT_BOX(star_.get()), FALSE); | 486 gtk_event_box_set_visible_window(GTK_EVENT_BOX(star_.get()), FALSE); |
| 477 star_image_ = gtk_image_new(); | 487 gtk_container_add(GTK_CONTAINER(star_.get()), alignment); |
| 478 gtk_container_add(GTK_CONTAINER(star_.get()), star_image_); | |
| 479 gtk_widget_show_all(star_.get()); | 488 gtk_widget_show_all(star_.get()); |
| 480 ViewIDUtil::SetID(star_.get(), VIEW_ID_STAR_BUTTON); | 489 ViewIDUtil::SetID(star_.get(), VIEW_ID_STAR_BUTTON); |
| 481 | 490 |
| 482 gtk_widget_set_tooltip_text(star_.get(), | 491 gtk_widget_set_tooltip_text(star_.get(), |
| 483 l10n_util::GetStringUTF8(IDS_TOOLTIP_STAR).c_str()); | 492 l10n_util::GetStringUTF8(IDS_TOOLTIP_STAR).c_str()); |
| 484 g_signal_connect(star_.get(), "button-press-event", | 493 g_signal_connect(star_.get(), "button-press-event", |
| 485 G_CALLBACK(OnStarButtonPressThunk), this); | 494 G_CALLBACK(OnStarButtonPressThunk), this); |
| 486 } | 495 } |
| 487 | 496 |
| 488 void LocationBarViewGtk::OnInputInProgress(bool in_progress) { | 497 void LocationBarViewGtk::OnInputInProgress(bool in_progress) { |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1394 | 1403 |
| 1395 std::string badge_text = page_action_->GetBadgeText(tab_id); | 1404 std::string badge_text = page_action_->GetBadgeText(tab_id); |
| 1396 if (badge_text.empty()) | 1405 if (badge_text.empty()) |
| 1397 return FALSE; | 1406 return FALSE; |
| 1398 | 1407 |
| 1399 gfx::CanvasSkiaPaint canvas(event, false); | 1408 gfx::CanvasSkiaPaint canvas(event, false); |
| 1400 gfx::Rect bounding_rect(widget->allocation); | 1409 gfx::Rect bounding_rect(widget->allocation); |
| 1401 page_action_->PaintBadge(&canvas, bounding_rect, tab_id); | 1410 page_action_->PaintBadge(&canvas, bounding_rect, tab_id); |
| 1402 return FALSE; | 1411 return FALSE; |
| 1403 } | 1412 } |
| OLD | NEW |