| 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/browser_toolbar_gtk.h" | 5 #include "chrome/browser/gtk/browser_toolbar_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #include <X11/XF86keysym.h> | 9 #include <X11/XF86keysym.h> |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 // Exterior padding on left/right of toolbar. | 63 // Exterior padding on left/right of toolbar. |
| 64 const int kLeftRightPadding = 2; | 64 const int kLeftRightPadding = 2; |
| 65 | 65 |
| 66 // Height of the toolbar in pixels when we only show the location bar. | 66 // Height of the toolbar in pixels when we only show the location bar. |
| 67 const int kToolbarHeightLocationBarOnly = kToolbarHeight - 2; | 67 const int kToolbarHeightLocationBarOnly = kToolbarHeight - 2; |
| 68 | 68 |
| 69 // Interior spacing between toolbar widgets. | 69 // Interior spacing between toolbar widgets. |
| 70 const int kToolbarWidgetSpacing = 4; | 70 const int kToolbarWidgetSpacing = 4; |
| 71 | 71 |
| 72 // The color used as the base[] color of the location entry during a secure | |
| 73 // connection. | |
| 74 const GdkColor kSecureColor = GDK_COLOR_RGB(255, 245, 195); | |
| 75 | |
| 76 } // namespace | 72 } // namespace |
| 77 | 73 |
| 78 // BrowserToolbarGtk, public --------------------------------------------------- | 74 // BrowserToolbarGtk, public --------------------------------------------------- |
| 79 | 75 |
| 80 BrowserToolbarGtk::BrowserToolbarGtk(Browser* browser, BrowserWindowGtk* window) | 76 BrowserToolbarGtk::BrowserToolbarGtk(Browser* browser, BrowserWindowGtk* window) |
| 81 : toolbar_(NULL), | 77 : toolbar_(NULL), |
| 82 location_bar_(new LocationBarViewGtk(this, browser)), | 78 location_bar_(new LocationBarViewGtk(this, browser)), |
| 83 model_(browser->toolbar_model()), | 79 model_(browser->toolbar_model()), |
| 84 page_menu_model_(this, browser), | 80 page_menu_model_(this, browser), |
| 85 app_menu_model_(this, browser), | 81 app_menu_model_(this, browser), |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 right = star_->widget(); | 585 right = star_->widget(); |
| 590 } | 586 } |
| 591 | 587 |
| 592 GdkRectangle rec = { | 588 GdkRectangle rec = { |
| 593 left->allocation.x, | 589 left->allocation.x, |
| 594 left->allocation.y, | 590 left->allocation.y, |
| 595 (right->allocation.x - left->allocation.x) + right->allocation.width, | 591 (right->allocation.x - left->allocation.x) + right->allocation.width, |
| 596 (right->allocation.y - left->allocation.y) + right->allocation.height | 592 (right->allocation.y - left->allocation.y) + right->allocation.height |
| 597 }; | 593 }; |
| 598 | 594 |
| 599 // Make sure our off screen entry has the correct base color if we're in | |
| 600 // secure mode. | |
| 601 gtk_widget_modify_base( | |
| 602 offscreen_entry_.get(), GTK_STATE_NORMAL, | |
| 603 (browser_->toolbar_model()->GetSchemeSecurityLevel() == | |
| 604 ToolbarModel::SECURE) ? | |
| 605 &kSecureColor : NULL); | |
| 606 | |
| 607 gtk_util::DrawTextEntryBackground(offscreen_entry_.get(), | 595 gtk_util::DrawTextEntryBackground(offscreen_entry_.get(), |
| 608 location_hbox, &e->area, | 596 location_hbox, &e->area, |
| 609 &rec); | 597 &rec); |
| 610 } | 598 } |
| 611 | 599 |
| 612 return FALSE; | 600 return FALSE; |
| 613 } | 601 } |
| 614 | 602 |
| 615 void BrowserToolbarGtk::OnButtonClick(GtkWidget* button) { | 603 void BrowserToolbarGtk::OnButtonClick(GtkWidget* button) { |
| 616 if ((button == back_->widget()) || | 604 if ((button == back_->widget()) || |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 menu->PopupAsFromKeyEvent(button); | 705 menu->PopupAsFromKeyEvent(button); |
| 718 menu_bar_helper_.MenuStartedShowing(button, menu->widget()); | 706 menu_bar_helper_.MenuStartedShowing(button, menu->widget()); |
| 719 } | 707 } |
| 720 | 708 |
| 721 void BrowserToolbarGtk::PopupForButtonNextTo(GtkWidget* button, | 709 void BrowserToolbarGtk::PopupForButtonNextTo(GtkWidget* button, |
| 722 GtkMenuDirectionType dir) { | 710 GtkMenuDirectionType dir) { |
| 723 GtkWidget* other_button = button == page_menu_button_.get() ? | 711 GtkWidget* other_button = button == page_menu_button_.get() ? |
| 724 app_menu_button_.get() : page_menu_button_.get(); | 712 app_menu_button_.get() : page_menu_button_.get(); |
| 725 PopupForButton(other_button); | 713 PopupForButton(other_button); |
| 726 } | 714 } |
| OLD | NEW |