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 | 56 |
57 // The size delta between the font used for the edit and the result rows. Passed | 57 // The size delta between the font used for the edit and the result rows. Passed |
58 // to gfx::Font::DeriveFont. | 58 // to gfx::Font::DeriveFont. |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_widget = location_bar_->GetWidget(); | 360 params.parent_widget = location_bar_->GetWidget(); |
361 params.bounds = GetPopupBounds(); | 361 params.bounds = GetPopupBounds(); |
362 popup_->Init(params); | 362 popup_->Init(params); |
363 #if defined(USE_AURA) | 363 #if defined(USE_ASH) |
364 // TODO(beng): This should be if defined(USE_ASH) | |
365 ash::SetWindowVisibilityAnimationType( | 364 ash::SetWindowVisibilityAnimationType( |
366 popup_->GetNativeView(), | 365 popup_->GetNativeView(), |
367 ash::WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL); | 366 ash::WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL); |
368 #endif | 367 #endif |
369 popup_->SetContentsView(this); | 368 popup_->SetContentsView(this); |
370 popup_->StackAbove(omnibox_view_->GetRelativeWindowForPopup()); | 369 popup_->StackAbove(omnibox_view_->GetRelativeWindowForPopup()); |
371 if (!popup_.get()) { | 370 if (!popup_.get()) { |
372 // For some IMEs GetRelativeWindowForPopup triggers the omnibox to lose | 371 // For some IMEs GetRelativeWindowForPopup triggers the omnibox to lose |
373 // focus, thereby closing (and destroying) the popup. | 372 // focus, thereby closing (and destroying) the popup. |
374 // TODO(sky): this won't be needed once we close the omnibox on input | 373 // TODO(sky): this won't be needed once we close the omnibox on input |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 opt_in_view_ = NULL; | 705 opt_in_view_ = NULL; |
707 PromoCounter* counter = profile_->GetInstantPromoCounter(); | 706 PromoCounter* counter = profile_->GetInstantPromoCounter(); |
708 DCHECK(counter); | 707 DCHECK(counter); |
709 counter->Hide(); | 708 counter->Hide(); |
710 if (opt_in) { | 709 if (opt_in) { |
711 browser::ShowInstantConfirmDialogIfNecessary( | 710 browser::ShowInstantConfirmDialogIfNecessary( |
712 location_bar_->GetWidget()->GetNativeWindow(), profile_); | 711 location_bar_->GetWidget()->GetNativeWindow(), profile_); |
713 } | 712 } |
714 UpdatePopupAppearance(); | 713 UpdatePopupAppearance(); |
715 } | 714 } |
OLD | NEW |