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 #include "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
8 #include "app/gfx/favicon_size.h" | 8 #include "app/gfx/favicon_size.h" |
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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 // URL edit field. | 132 // URL edit field. |
133 // View container for URL edit field. | 133 // View container for URL edit field. |
134 #if defined(OS_WIN) | 134 #if defined(OS_WIN) |
135 views::Widget* widget = GetWidget(); | 135 views::Widget* widget = GetWidget(); |
136 location_entry_.reset(new AutocompleteEditViewWin(font_, this, model_, this, | 136 location_entry_.reset(new AutocompleteEditViewWin(font_, this, model_, this, |
137 widget->GetNativeView(), | 137 widget->GetNativeView(), |
138 profile_, command_updater_, | 138 profile_, command_updater_, |
139 popup_window_mode_, | 139 popup_window_mode_, |
140 popup_positioner_)); | 140 popup_positioner_)); |
141 location_entry_view_ = new views::HWNDView; | |
142 #else | 141 #else |
143 location_entry_.reset(new AutocompleteEditViewGtk(this, model_, profile_, | 142 location_entry_.reset(new AutocompleteEditViewGtk(this, model_, profile_, |
144 command_updater_, | 143 command_updater_, |
145 popup_positioner_)); | 144 popup_positioner_)); |
146 location_entry_view_ = new views::NativeViewHostGtk; | |
147 #endif | 145 #endif |
148 DCHECK(location_entry_view_) << "LocationBarView::Init - OOM!"; | 146 location_entry_view_ = new views::NativeViewHost; |
149 location_entry_view_->SetID(VIEW_ID_AUTOCOMPLETE); | 147 location_entry_view_->SetID(VIEW_ID_AUTOCOMPLETE); |
150 AddChildView(location_entry_view_); | 148 AddChildView(location_entry_view_); |
151 location_entry_view_->SetAssociatedFocusView(this); | 149 location_entry_view_->set_focus_view(this); |
| 150 location_entry_view_->Attach( |
152 #if defined(OS_WIN) | 151 #if defined(OS_WIN) |
153 location_entry_view_->Attach(location_entry_->m_hWnd); | 152 location_entry_->m_hWnd |
154 #else | 153 #else |
155 location_entry_view_->Attach(location_entry_->widget()); | 154 location_entry_->widget() |
156 #endif | 155 #endif |
| 156 ); |
157 | 157 |
158 AddChildView(&selected_keyword_view_); | 158 AddChildView(&selected_keyword_view_); |
159 selected_keyword_view_.SetFont(font_); | 159 selected_keyword_view_.SetFont(font_); |
160 selected_keyword_view_.SetVisible(false); | 160 selected_keyword_view_.SetVisible(false); |
161 selected_keyword_view_.SetParentOwned(false); | 161 selected_keyword_view_.SetParentOwned(false); |
162 | 162 |
163 #if defined(OS_WIN) | 163 #if defined(OS_WIN) |
164 DWORD sys_color = GetSysColor(COLOR_GRAYTEXT); | 164 DWORD sys_color = GetSysColor(COLOR_GRAYTEXT); |
165 SkColor gray = SkColorSetRGB(GetRValue(sys_color), GetGValue(sys_color), | 165 SkColor gray = SkColorSetRGB(GetRValue(sys_color), GetGValue(sys_color), |
166 GetBValue(sys_color)); | 166 GetBValue(sys_color)); |
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 location_entry_->SetFocus(); | 1336 location_entry_->SetFocus(); |
1337 } | 1337 } |
1338 | 1338 |
1339 void LocationBarView::SaveStateToContents(TabContents* contents) { | 1339 void LocationBarView::SaveStateToContents(TabContents* contents) { |
1340 location_entry_->SaveStateToTab(contents); | 1340 location_entry_->SaveStateToTab(contents); |
1341 } | 1341 } |
1342 | 1342 |
1343 void LocationBarView::Revert() { | 1343 void LocationBarView::Revert() { |
1344 location_entry_->RevertAll(); | 1344 location_entry_->RevertAll(); |
1345 } | 1345 } |
OLD | NEW |