| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 //////////////////////////////////////////////////////////////////////////////// | 95 //////////////////////////////////////////////////////////////////////////////// |
| 96 // LocationBarViewGtk | 96 // LocationBarViewGtk |
| 97 | 97 |
| 98 // static | 98 // static |
| 99 const GdkColor LocationBarViewGtk::kBackgroundColorByLevel[3] = { | 99 const GdkColor LocationBarViewGtk::kBackgroundColorByLevel[3] = { |
| 100 GDK_COLOR_RGB(255, 245, 195), // SecurityLevel SECURE: Yellow. | 100 GDK_COLOR_RGB(255, 245, 195), // SecurityLevel SECURE: Yellow. |
| 101 GDK_COLOR_RGB(255, 255, 255), // SecurityLevel NORMAL: White. | 101 GDK_COLOR_RGB(255, 255, 255), // SecurityLevel NORMAL: White. |
| 102 GDK_COLOR_RGB(255, 255, 255), // SecurityLevel INSECURE: White. | 102 GDK_COLOR_RGB(255, 255, 255), // SecurityLevel INSECURE: White. |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 LocationBarViewGtk::LocationBarViewGtk(CommandUpdater* command_updater, | 105 LocationBarViewGtk::LocationBarViewGtk( |
| 106 ToolbarModel* toolbar_model, AutocompletePopupPositioner* popup_positioner, | 106 CommandUpdater* command_updater, |
| 107 ToolbarModel* toolbar_model, |
| 108 const BubblePositioner* bubble_positioner, |
| 107 Browser* browser) | 109 Browser* browser) |
| 108 : security_icon_event_box_(NULL), | 110 : security_icon_event_box_(NULL), |
| 109 security_lock_icon_image_(NULL), | 111 security_lock_icon_image_(NULL), |
| 110 security_warning_icon_image_(NULL), | 112 security_warning_icon_image_(NULL), |
| 111 info_label_(NULL), | 113 info_label_(NULL), |
| 112 tab_to_search_box_(NULL), | 114 tab_to_search_box_(NULL), |
| 113 tab_to_search_label_(NULL), | 115 tab_to_search_label_(NULL), |
| 114 tab_to_search_hint_(NULL), | 116 tab_to_search_hint_(NULL), |
| 115 tab_to_search_hint_leading_label_(NULL), | 117 tab_to_search_hint_leading_label_(NULL), |
| 116 tab_to_search_hint_icon_(NULL), | 118 tab_to_search_hint_icon_(NULL), |
| 117 tab_to_search_hint_trailing_label_(NULL), | 119 tab_to_search_hint_trailing_label_(NULL), |
| 118 profile_(NULL), | 120 profile_(NULL), |
| 119 command_updater_(command_updater), | 121 command_updater_(command_updater), |
| 120 toolbar_model_(toolbar_model), | 122 toolbar_model_(toolbar_model), |
| 121 browser_(browser), | 123 browser_(browser), |
| 122 popup_positioner_(popup_positioner), | 124 bubble_positioner_(bubble_positioner), |
| 123 disposition_(CURRENT_TAB), | 125 disposition_(CURRENT_TAB), |
| 124 transition_(PageTransition::TYPED), | 126 transition_(PageTransition::TYPED), |
| 125 first_run_bubble_(this), | 127 first_run_bubble_(this), |
| 126 popup_window_mode_(false), | 128 popup_window_mode_(false), |
| 127 theme_provider_(NULL) { | 129 theme_provider_(NULL) { |
| 128 } | 130 } |
| 129 | 131 |
| 130 LocationBarViewGtk::~LocationBarViewGtk() { | 132 LocationBarViewGtk::~LocationBarViewGtk() { |
| 131 // All of our widgets should have be children of / owned by the alignment. | 133 // All of our widgets should have be children of / owned by the alignment. |
| 132 hbox_.Destroy(); | 134 hbox_.Destroy(); |
| 133 } | 135 } |
| 134 | 136 |
| 135 void LocationBarViewGtk::Init(bool popup_window_mode) { | 137 void LocationBarViewGtk::Init(bool popup_window_mode) { |
| 136 popup_window_mode_ = popup_window_mode; | 138 popup_window_mode_ = popup_window_mode; |
| 137 location_entry_.reset(new AutocompleteEditViewGtk(this, | 139 location_entry_.reset(new AutocompleteEditViewGtk(this, |
| 138 toolbar_model_, | 140 toolbar_model_, |
| 139 profile_, | 141 profile_, |
| 140 command_updater_, | 142 command_updater_, |
| 141 popup_window_mode_, | 143 popup_window_mode_, |
| 142 popup_positioner_)); | 144 bubble_positioner_)); |
| 143 location_entry_->Init(); | 145 location_entry_->Init(); |
| 144 | 146 |
| 145 hbox_.Own(gtk_hbox_new(FALSE, kInnerPadding)); | 147 hbox_.Own(gtk_hbox_new(FALSE, kInnerPadding)); |
| 146 gtk_container_set_border_width(GTK_CONTAINER(hbox_.get()), kHboxBorder); | 148 gtk_container_set_border_width(GTK_CONTAINER(hbox_.get()), kHboxBorder); |
| 147 // We will paint for the alignment, to paint the background and border. | 149 // We will paint for the alignment, to paint the background and border. |
| 148 gtk_widget_set_app_paintable(hbox_.get(), TRUE); | 150 gtk_widget_set_app_paintable(hbox_.get(), TRUE); |
| 149 // Have GTK double buffer around the expose signal. | 151 // Have GTK double buffer around the expose signal. |
| 150 gtk_widget_set_double_buffered(hbox_.get(), TRUE); | 152 gtk_widget_set_double_buffered(hbox_.get(), TRUE); |
| 151 // Redraw the whole location bar when it changes size (e.g., when toggling | 153 // Redraw the whole location bar when it changes size (e.g., when toggling |
| 152 // the home button on/off. | 154 // the home button on/off. |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 LocationBarViewGtk::PageActionViewGtk* page_action_view) { | 751 LocationBarViewGtk::PageActionViewGtk* page_action_view) { |
| 750 ExtensionBrowserEventRouter::GetInstance()->PageActionExecuted( | 752 ExtensionBrowserEventRouter::GetInstance()->PageActionExecuted( |
| 751 page_action_view->profile_, | 753 page_action_view->profile_, |
| 752 page_action_view->page_action_->extension_id(), | 754 page_action_view->page_action_->extension_id(), |
| 753 page_action_view->page_action_->id(), | 755 page_action_view->page_action_->id(), |
| 754 page_action_view->current_tab_id_, | 756 page_action_view->current_tab_id_, |
| 755 page_action_view->current_url_.spec(), | 757 page_action_view->current_url_.spec(), |
| 756 event->button); | 758 event->button); |
| 757 return true; | 759 return true; |
| 758 } | 760 } |
| OLD | NEW |