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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
357 popup_ = (new AutocompletePopupWidget)->AsWeakPtr(); | 357 popup_ = (new AutocompletePopupWidget)->AsWeakPtr(); |
358 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 358 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
359 params.can_activate = false; | 359 params.can_activate = false; |
360 params.transparent = true; | 360 params.transparent = true; |
361 params.parent_widget = location_bar_->GetWidget(); | 361 params.parent_widget = location_bar_->GetWidget(); |
362 params.bounds = GetPopupBounds(); | 362 params.bounds = GetPopupBounds(); |
363 popup_->Init(params); | 363 popup_->Init(params); |
364 popup_->SetContentsView(this); | 364 popup_->SetContentsView(this); |
365 popup_->MoveAbove( | 365 popup_->MoveAbove( |
366 GetRelativeWindowForPopup(omnibox_view_->GetNativeView())); | 366 GetRelativeWindowForPopup(omnibox_view_->GetNativeView())); |
367 if (!popup_.get()) { | |
368 // For some IMEs GetRelativeWindowForPopup triggers the omnibox to lose | |
369 // focus, thereby closing (and destroying) the popup. | |
370 // TODO: this won't be needed once we close the omnibox on input window | |
Peter Kasting
2011/09/12 18:36:52
? We explicitly wanted to avoid closing the omnibo
| |
371 // showing. | |
372 return; | |
373 } | |
367 popup_->Show(); | 374 popup_->Show(); |
368 } else { | 375 } else { |
369 // Animate the popup shrinking, but don't animate growing larger since that | 376 // Animate the popup shrinking, but don't animate growing larger since that |
370 // would make the popup feel less responsive. | 377 // would make the popup feel less responsive. |
371 start_bounds_ = GetWidget()->GetWindowScreenBounds(); | 378 start_bounds_ = GetWidget()->GetWindowScreenBounds(); |
372 if (target_bounds_.height() < start_bounds_.height()) | 379 if (target_bounds_.height() < start_bounds_.height()) |
373 size_animation_.Show(); | 380 size_animation_.Show(); |
374 else | 381 else |
375 start_bounds_ = target_bounds_; | 382 start_bounds_ = target_bounds_; |
376 popup_->SetBounds(GetPopupBounds()); | 383 popup_->SetBounds(GetPopupBounds()); |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
697 opt_in_view_ = NULL; | 704 opt_in_view_ = NULL; |
698 PromoCounter* counter = profile_->GetInstantPromoCounter(); | 705 PromoCounter* counter = profile_->GetInstantPromoCounter(); |
699 DCHECK(counter); | 706 DCHECK(counter); |
700 counter->Hide(); | 707 counter->Hide(); |
701 if (opt_in) { | 708 if (opt_in) { |
702 browser::ShowInstantConfirmDialogIfNecessary( | 709 browser::ShowInstantConfirmDialogIfNecessary( |
703 location_bar_->GetWidget()->GetNativeWindow(), profile_); | 710 location_bar_->GetWidget()->GetNativeWindow(), profile_); |
704 } | 711 } |
705 UpdatePopupAppearance(); | 712 UpdatePopupAppearance(); |
706 } | 713 } |
OLD | NEW |