OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/views/autocomplete/autocomplete_popup_contents_view. h" | 5 #include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view. h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 9 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
10 #include "chrome/browser/instant/instant_confirm_dialog.h" | 10 #include "chrome/browser/instant/instant_confirm_dialog.h" |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
223 }; | 223 }; |
224 | 224 |
225 //////////////////////////////////////////////////////////////////////////////// | 225 //////////////////////////////////////////////////////////////////////////////// |
226 // AutocompletePopupContentsView, public: | 226 // AutocompletePopupContentsView, public: |
227 | 227 |
228 AutocompletePopupContentsView::AutocompletePopupContentsView( | 228 AutocompletePopupContentsView::AutocompletePopupContentsView( |
229 const gfx::Font& font, | 229 const gfx::Font& font, |
230 OmniboxView* omnibox_view, | 230 OmniboxView* omnibox_view, |
231 AutocompleteEditModel* edit_model, | 231 AutocompleteEditModel* edit_model, |
232 Profile* profile, | 232 Profile* profile, |
233 const views::View* location_bar) | 233 views::View* location_bar) |
234 : model_(new AutocompletePopupModel(this, edit_model, profile)), | 234 : model_(new AutocompletePopupModel(this, edit_model, profile)), |
235 opt_in_view_(NULL), | 235 opt_in_view_(NULL), |
236 omnibox_view_(omnibox_view), | 236 omnibox_view_(omnibox_view), |
237 location_bar_(location_bar), | 237 location_bar_(location_bar), |
238 result_font_(font.DeriveFont(kEditFontAdjust)), | 238 result_font_(font.DeriveFont(kEditFontAdjust)), |
239 result_bold_font_(result_font_.DeriveFont(0, gfx::Font::BOLD)), | 239 result_bold_font_(result_font_.DeriveFont(0, gfx::Font::BOLD)), |
240 ignore_mouse_drag_(false), | 240 ignore_mouse_drag_(false), |
241 ALLOW_THIS_IN_INITIALIZER_LIST(size_animation_(this)) { | 241 ALLOW_THIS_IN_INITIALIZER_LIST(size_animation_(this)) { |
242 // The following little dance is required because set_border() requires a | 242 // The following little dance is required because set_border() requires a |
243 // pointer to a non-const object. | 243 // pointer to a non-const object. |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
350 if (new_target_bounds.height() != target_bounds_.height()) | 350 if (new_target_bounds.height() != target_bounds_.height()) |
351 size_animation_.Reset(); | 351 size_animation_.Reset(); |
352 target_bounds_ = new_target_bounds; | 352 target_bounds_ = new_target_bounds; |
353 | 353 |
354 if (popup_ == NULL) { | 354 if (popup_ == NULL) { |
355 // If the popup is currently closed, we need to create it. | 355 // If the popup is currently closed, we need to create it. |
356 popup_ = (new AutocompletePopupWidget)->AsWeakPtr(); | 356 popup_ = (new AutocompletePopupWidget)->AsWeakPtr(); |
357 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 357 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
358 params.can_activate = false; | 358 params.can_activate = false; |
359 params.transparent = true; | 359 params.transparent = true; |
360 params.parent = location_bar_->GetWidget()->GetNativeView(); | 360 params.parent_widget = location_bar_->GetWidget(); |
sky
2011/08/08 16:35:28
Should InitParams parent_widget be a const* Widget
sadrul
2011/08/08 17:05:33
I think that'll be very difficult, considering NWV
| |
361 params.bounds = GetPopupBounds(); | 361 params.bounds = GetPopupBounds(); |
362 popup_->Init(params); | 362 popup_->Init(params); |
363 popup_->SetContentsView(this); | 363 popup_->SetContentsView(this); |
364 popup_->MoveAbove( | 364 popup_->MoveAbove( |
365 GetRelativeWindowForPopup(omnibox_view_->GetNativeView())); | 365 GetRelativeWindowForPopup(omnibox_view_->GetNativeView())); |
366 popup_->Show(); | 366 popup_->Show(); |
367 } else { | 367 } else { |
368 // Animate the popup shrinking, but don't animate growing larger since that | 368 // Animate the popup shrinking, but don't animate growing larger since that |
369 // would make the popup feel less responsive. | 369 // would make the popup feel less responsive. |
370 start_bounds_ = GetWidget()->GetWindowScreenBounds(); | 370 start_bounds_ = GetWidget()->GetWindowScreenBounds(); |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
696 opt_in_view_ = NULL; | 696 opt_in_view_ = NULL; |
697 PromoCounter* counter = model_->profile()->GetInstantPromoCounter(); | 697 PromoCounter* counter = model_->profile()->GetInstantPromoCounter(); |
698 DCHECK(counter); | 698 DCHECK(counter); |
699 counter->Hide(); | 699 counter->Hide(); |
700 if (opt_in) { | 700 if (opt_in) { |
701 browser::ShowInstantConfirmDialogIfNecessary( | 701 browser::ShowInstantConfirmDialogIfNecessary( |
702 location_bar_->GetWidget()->GetNativeWindow(), model_->profile()); | 702 location_bar_->GetWidget()->GetNativeWindow(), model_->profile()); |
703 } | 703 } |
704 UpdatePopupAppearance(); | 704 UpdatePopupAppearance(); |
705 } | 705 } |
OLD | NEW |