OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <commctrl.h> | 8 #include <commctrl.h> |
9 #include <dwmapi.h> | 9 #include <dwmapi.h> |
10 #include <objidl.h> | 10 #include <objidl.h> |
(...skipping 27 matching lines...) Expand all Loading... | |
38 #include "ui/views/painter.h" | 38 #include "ui/views/painter.h" |
39 #include "ui/views/widget/widget.h" | 39 #include "ui/views/widget/widget.h" |
40 #include "unicode/ubidi.h" | 40 #include "unicode/ubidi.h" |
41 | 41 |
42 #if defined(OS_WIN) | 42 #if defined(OS_WIN) |
43 #include "base/win/scoped_gdi_object.h" | 43 #include "base/win/scoped_gdi_object.h" |
44 #if !defined(USE_AURA) | 44 #if !defined(USE_AURA) |
45 #include "ui/views/widget/native_widget_win.h" | 45 #include "ui/views/widget/native_widget_win.h" |
46 #endif | 46 #endif |
47 #endif | 47 #endif |
48 #if defined(USE_AURA) | 48 #if defined(USE_ASH) |
49 #include "ash/wm/window_animations.h" | 49 #include "ash/wm/window_animations.h" |
50 #endif | 50 #endif |
51 | 51 |
52 namespace { | 52 namespace { |
53 | 53 |
54 const SkAlpha kGlassPopupAlpha = 240; | 54 const SkAlpha kGlassPopupAlpha = 240; |
55 const SkAlpha kOpaquePopupAlpha = 255; | 55 const SkAlpha kOpaquePopupAlpha = 255; |
56 // The size delta between the font used for the edit and the result rows. Passed | 56 // The size delta between the font used for the edit and the result rows. Passed |
57 // to gfx::Font::DeriveFont. | 57 // to gfx::Font::DeriveFont. |
58 #if defined(OS_CHROMEOS) | 58 #if defined(OS_CHROMEOS) |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
342 | 342 |
343 if (popup_ == NULL) { | 343 if (popup_ == NULL) { |
344 // If the popup is currently closed, we need to create it. | 344 // If the popup is currently closed, we need to create it. |
345 popup_ = (new AutocompletePopupWidget)->AsWeakPtr(); | 345 popup_ = (new AutocompletePopupWidget)->AsWeakPtr(); |
346 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 346 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
347 params.can_activate = false; | 347 params.can_activate = false; |
348 params.transparent = true; | 348 params.transparent = true; |
349 params.parent_widget = location_bar_->GetWidget(); | 349 params.parent_widget = location_bar_->GetWidget(); |
350 params.bounds = GetPopupBounds(); | 350 params.bounds = GetPopupBounds(); |
351 popup_->Init(params); | 351 popup_->Init(params); |
352 #if defined(USE_AURA) | 352 #if defined(USE_ASH) |
353 // TODO(beng): This should be if defined(USE_ASH) | |
354 ash::SetWindowVisibilityAnimationType( | 353 ash::SetWindowVisibilityAnimationType( |
355 popup_->GetNativeView(), | 354 popup_->GetNativeView(), |
356 ash::WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL); | 355 ash::WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL); |
Elliot Glaysher
2012/02/28 18:13:32
This doesn't look as good without upstreaming the
| |
357 #endif | 356 #endif |
358 popup_->SetContentsView(this); | 357 popup_->SetContentsView(this); |
359 popup_->StackAbove(omnibox_view_->GetRelativeWindowForPopup()); | 358 popup_->StackAbove(omnibox_view_->GetRelativeWindowForPopup()); |
360 if (!popup_.get()) { | 359 if (!popup_.get()) { |
361 // For some IMEs GetRelativeWindowForPopup triggers the omnibox to lose | 360 // For some IMEs GetRelativeWindowForPopup triggers the omnibox to lose |
362 // focus, thereby closing (and destroying) the popup. | 361 // focus, thereby closing (and destroying) the popup. |
363 // TODO(sky): this won't be needed once we close the omnibox on input | 362 // TODO(sky): this won't be needed once we close the omnibox on input |
364 // window showing. | 363 // window showing. |
365 return; | 364 return; |
366 } | 365 } |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
697 opt_in_view_ = NULL; | 696 opt_in_view_ = NULL; |
698 PromoCounter* counter = profile_->GetInstantPromoCounter(); | 697 PromoCounter* counter = profile_->GetInstantPromoCounter(); |
699 DCHECK(counter); | 698 DCHECK(counter); |
700 counter->Hide(); | 699 counter->Hide(); |
701 if (opt_in) { | 700 if (opt_in) { |
702 browser::ShowInstantConfirmDialogIfNecessary( | 701 browser::ShowInstantConfirmDialogIfNecessary( |
703 location_bar_->GetWidget()->GetNativeWindow(), profile_); | 702 location_bar_->GetWidget()->GetNativeWindow(), profile_); |
704 } | 703 } |
705 UpdatePopupAppearance(); | 704 UpdatePopupAppearance(); |
706 } | 705 } |
OLD | NEW |