| 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_edit_view.h" | 9 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" |
| 10 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 10 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 if (new_target_bounds.height() != target_bounds_.height()) | 325 if (new_target_bounds.height() != target_bounds_.height()) |
| 326 size_animation_.Reset(); | 326 size_animation_.Reset(); |
| 327 target_bounds_ = new_target_bounds; | 327 target_bounds_ = new_target_bounds; |
| 328 | 328 |
| 329 if (popup_ == NULL) { | 329 if (popup_ == NULL) { |
| 330 // If the popup is currently closed, we need to create it. | 330 // If the popup is currently closed, we need to create it. |
| 331 popup_ = (new AutocompletePopupClass)->AsWeakPtr(); | 331 popup_ = (new AutocompletePopupClass)->AsWeakPtr(); |
| 332 views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_POPUP); | 332 views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_POPUP); |
| 333 params.can_activate = false; | 333 params.can_activate = false; |
| 334 params.transparent = true; | 334 params.transparent = true; |
| 335 popup_->SetCreateParams(params); | 335 params.parent = location_bar_->GetWidget()->GetNativeView(); |
| 336 popup_->Init(location_bar_->GetWidget()->GetNativeView(), GetPopupBounds()); | 336 params.bounds = GetPopupBounds(); |
| 337 popup_->GetWidget()->Init(params); |
| 337 popup_->SetContentsView(this); | 338 popup_->SetContentsView(this); |
| 338 popup_->MoveAbove(popup_->GetRelativeWindowForPopup( | 339 popup_->MoveAbove(popup_->GetRelativeWindowForPopup( |
| 339 edit_view_->GetNativeView())); | 340 edit_view_->GetNativeView())); |
| 340 popup_->Show(); | 341 popup_->Show(); |
| 341 } else { | 342 } else { |
| 342 // Animate the popup shrinking, but don't animate growing larger since that | 343 // Animate the popup shrinking, but don't animate growing larger since that |
| 343 // would make the popup feel less responsive. | 344 // would make the popup feel less responsive. |
| 344 start_bounds_ = GetWidget()->GetWindowScreenBounds(); | 345 start_bounds_ = GetWidget()->GetWindowScreenBounds(); |
| 345 if (target_bounds_.height() < start_bounds_.height()) | 346 if (target_bounds_.height() < start_bounds_.height()) |
| 346 size_animation_.Show(); | 347 size_animation_.Show(); |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 opt_in_view_ = NULL; | 676 opt_in_view_ = NULL; |
| 676 PromoCounter* counter = model_->profile()->GetInstantPromoCounter(); | 677 PromoCounter* counter = model_->profile()->GetInstantPromoCounter(); |
| 677 DCHECK(counter); | 678 DCHECK(counter); |
| 678 counter->Hide(); | 679 counter->Hide(); |
| 679 if (opt_in) { | 680 if (opt_in) { |
| 680 browser::ShowInstantConfirmDialogIfNecessary( | 681 browser::ShowInstantConfirmDialogIfNecessary( |
| 681 location_bar_->GetWindow()->GetNativeWindow(), model_->profile()); | 682 location_bar_->GetWindow()->GetNativeWindow(), model_->profile()); |
| 682 } | 683 } |
| 683 UpdatePopupAppearance(); | 684 UpdatePopupAppearance(); |
| 684 } | 685 } |
| OLD | NEW |