| 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/views/location_bar_view.h" | 5 #include "chrome/browser/views/location_bar_view.h" |
| 6 | 6 |
| 7 #if defined(OS_LINUX) | 7 #if defined(OS_LINUX) |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 if (template_url) | 79 if (template_url) |
| 80 return template_url->AdjustedShortNameForLocaleDirection(); | 80 return template_url->AdjustedShortNameForLocaleDirection(); |
| 81 return std::wstring(); | 81 return std::wstring(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 LocationBarView::LocationBarView(Profile* profile, | 84 LocationBarView::LocationBarView(Profile* profile, |
| 85 CommandUpdater* command_updater, | 85 CommandUpdater* command_updater, |
| 86 ToolbarModel* model, | 86 ToolbarModel* model, |
| 87 Delegate* delegate, | 87 Delegate* delegate, |
| 88 bool popup_window_mode, | 88 bool popup_window_mode, |
| 89 AutocompletePopupPositioner* popup_positioner) | 89 const BubblePositioner* bubble_positioner) |
| 90 : profile_(profile), | 90 : profile_(profile), |
| 91 command_updater_(command_updater), | 91 command_updater_(command_updater), |
| 92 model_(model), | 92 model_(model), |
| 93 delegate_(delegate), | 93 delegate_(delegate), |
| 94 disposition_(CURRENT_TAB), | 94 disposition_(CURRENT_TAB), |
| 95 location_entry_view_(NULL), | 95 location_entry_view_(NULL), |
| 96 selected_keyword_view_(profile), | 96 selected_keyword_view_(profile), |
| 97 keyword_hint_view_(profile), | 97 keyword_hint_view_(profile), |
| 98 type_to_search_view_(l10n_util::GetString(IDS_OMNIBOX_EMPTY_TEXT)), | 98 type_to_search_view_(l10n_util::GetString(IDS_OMNIBOX_EMPTY_TEXT)), |
| 99 security_image_view_(profile, model), | 99 security_image_view_(profile, model), |
| 100 popup_window_mode_(popup_window_mode), | 100 popup_window_mode_(popup_window_mode), |
| 101 first_run_bubble_(this), | 101 first_run_bubble_(this), |
| 102 popup_positioner_(popup_positioner) { | 102 bubble_positioner_(bubble_positioner) { |
| 103 DCHECK(profile_); | 103 DCHECK(profile_); |
| 104 SetID(VIEW_ID_LOCATION_BAR); | 104 SetID(VIEW_ID_LOCATION_BAR); |
| 105 SetFocusable(true); | 105 SetFocusable(true); |
| 106 | 106 |
| 107 if (!kBackground) { | 107 if (!kBackground) { |
| 108 ResourceBundle &rb = ResourceBundle::GetSharedInstance(); | 108 ResourceBundle &rb = ResourceBundle::GetSharedInstance(); |
| 109 kBackground = rb.GetBitmapNamed(IDR_LOCATIONBG); | 109 kBackground = rb.GetBitmapNamed(IDR_LOCATIONBG); |
| 110 kPopupBackground = rb.GetBitmapNamed(IDR_LOCATIONBG_POPUPMODE_CENTER); | 110 kPopupBackground = rb.GetBitmapNamed(IDR_LOCATIONBG_POPUPMODE_CENTER); |
| 111 } | 111 } |
| 112 } | 112 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 131 } | 131 } |
| 132 | 132 |
| 133 // URL edit field. | 133 // URL edit field. |
| 134 // View container for URL edit field. | 134 // View container for URL edit field. |
| 135 #if defined(OS_WIN) | 135 #if defined(OS_WIN) |
| 136 views::Widget* widget = GetWidget(); | 136 views::Widget* widget = GetWidget(); |
| 137 location_entry_.reset(new AutocompleteEditViewWin(font_, this, model_, this, | 137 location_entry_.reset(new AutocompleteEditViewWin(font_, this, model_, this, |
| 138 widget->GetNativeView(), | 138 widget->GetNativeView(), |
| 139 profile_, command_updater_, | 139 profile_, command_updater_, |
| 140 popup_window_mode_, | 140 popup_window_mode_, |
| 141 popup_positioner_)); | 141 bubble_positioner_)); |
| 142 #else | 142 #else |
| 143 location_entry_.reset(new AutocompleteEditViewGtk(this, model_, profile_, | 143 location_entry_.reset(new AutocompleteEditViewGtk(this, model_, profile_, |
| 144 command_updater_, | 144 command_updater_, |
| 145 popup_window_mode_, | 145 popup_window_mode_, |
| 146 popup_positioner_)); | 146 bubble_positioner_)); |
| 147 location_entry_->Init(); | 147 location_entry_->Init(); |
| 148 // Make all the children of the widget visible. NOTE: this won't display | 148 // Make all the children of the widget visible. NOTE: this won't display |
| 149 // anything, it just toggles the visible flag. | 149 // anything, it just toggles the visible flag. |
| 150 gtk_widget_show_all(location_entry_->widget()); | 150 gtk_widget_show_all(location_entry_->widget()); |
| 151 // Hide the widget. NativeViewHostGtk will make it visible again as | 151 // Hide the widget. NativeViewHostGtk will make it visible again as |
| 152 // necessary. | 152 // necessary. |
| 153 gtk_widget_hide(location_entry_->widget()); | 153 gtk_widget_hide(location_entry_->widget()); |
| 154 #endif | 154 #endif |
| 155 location_entry_view_ = new views::NativeViewHost; | 155 location_entry_view_ = new views::NativeViewHost; |
| 156 location_entry_view_->SetID(VIEW_ID_AUTOCOMPLETE); | 156 location_entry_view_->SetID(VIEW_ID_AUTOCOMPLETE); |
| (...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1318 } | 1318 } |
| 1319 | 1319 |
| 1320 int LocationBarView::PageActionVisibleCount() { | 1320 int LocationBarView::PageActionVisibleCount() { |
| 1321 int result = 0; | 1321 int result = 0; |
| 1322 for (size_t i = 0; i < page_action_image_views_.size(); i++) { | 1322 for (size_t i = 0; i < page_action_image_views_.size(); i++) { |
| 1323 if (page_action_image_views_[i]->IsVisible()) | 1323 if (page_action_image_views_[i]->IsVisible()) |
| 1324 ++result; | 1324 ++result; |
| 1325 } | 1325 } |
| 1326 return result; | 1326 return result; |
| 1327 } | 1327 } |
| OLD | NEW |