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 20 matching lines...) Expand all Loading... |
31 #include "views/layout/layout_constants.h" | 31 #include "views/layout/layout_constants.h" |
32 #include "views/painter.h" | 32 #include "views/painter.h" |
33 #include "views/widget/widget.h" | 33 #include "views/widget/widget.h" |
34 | 34 |
35 #if defined(OS_WIN) | 35 #if defined(OS_WIN) |
36 #include <commctrl.h> | 36 #include <commctrl.h> |
37 #include <dwmapi.h> | 37 #include <dwmapi.h> |
38 #include <objidl.h> | 38 #include <objidl.h> |
39 | 39 |
40 #include "base/win/scoped_gdi_object.h" | 40 #include "base/win/scoped_gdi_object.h" |
| 41 #if !defined(USE_AURA) |
41 #include "views/widget/native_widget_win.h" | 42 #include "views/widget/native_widget_win.h" |
42 #endif | 43 #endif |
| 44 #endif |
43 | 45 |
44 #if defined(TOOLKIT_USES_GTK) | 46 #if defined(TOOLKIT_USES_GTK) |
45 #include "ui/gfx/skia_utils_gtk.h" | 47 #include "ui/gfx/skia_utils_gtk.h" |
46 #endif | 48 #endif |
47 | 49 |
48 namespace { | 50 namespace { |
49 | 51 |
50 const SkAlpha kGlassPopupAlpha = 240; | 52 const SkAlpha kGlassPopupAlpha = 240; |
51 const SkAlpha kOpaquePopupAlpha = 255; | 53 const SkAlpha kOpaquePopupAlpha = 255; |
52 // The size delta between the font used for the edit and the result rows. Passed | 54 // The size delta between the font used for the edit and the result rows. Passed |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 return views::Painter::CreateImagePainter(*image, insets, true); | 112 return views::Painter::CreateImagePainter(*image, insets, true); |
111 } | 113 } |
112 | 114 |
113 scoped_ptr<views::Painter> border_painter_; | 115 scoped_ptr<views::Painter> border_painter_; |
114 scoped_ptr<views::Painter> border_pushed_painter_; | 116 scoped_ptr<views::Painter> border_pushed_painter_; |
115 | 117 |
116 DISALLOW_COPY_AND_ASSIGN(OptInButtonBorder); | 118 DISALLOW_COPY_AND_ASSIGN(OptInButtonBorder); |
117 }; | 119 }; |
118 | 120 |
119 gfx::NativeView GetRelativeWindowForPopup(gfx::NativeView edit_native_view) { | 121 gfx::NativeView GetRelativeWindowForPopup(gfx::NativeView edit_native_view) { |
120 #if defined(OS_WIN) | 122 #if defined(USE_AURA) |
| 123 // TODO(beng): |
| 124 NOTIMPLEMENTED(); |
| 125 return NULL; |
| 126 #elif defined(OS_WIN) |
121 // When an IME is attached to the rich-edit control, retrieve its window | 127 // When an IME is attached to the rich-edit control, retrieve its window |
122 // handle and show this popup window under the IME windows. | 128 // handle and show this popup window under the IME windows. |
123 // Otherwise, show this popup window under top-most windows. | 129 // Otherwise, show this popup window under top-most windows. |
124 // TODO(hbono): http://b/1111369 if we exclude this popup window from the | 130 // TODO(hbono): http://b/1111369 if we exclude this popup window from the |
125 // display area of IME windows, this workaround becomes unnecessary. | 131 // display area of IME windows, this workaround becomes unnecessary. |
126 HWND ime_window = ImmGetDefaultIMEWnd(edit_native_view); | 132 HWND ime_window = ImmGetDefaultIMEWnd(edit_native_view); |
127 return ime_window ? ime_window : HWND_NOTOPMOST; | 133 return ime_window ? ime_window : HWND_NOTOPMOST; |
128 #elif defined(TOOLKIT_USES_GTK) | 134 #elif defined(TOOLKIT_USES_GTK) |
129 GtkWidget* toplevel = gtk_widget_get_toplevel(edit_native_view); | 135 GtkWidget* toplevel = gtk_widget_get_toplevel(edit_native_view); |
130 DCHECK(GTK_WIDGET_TOPLEVEL(toplevel)); | 136 DCHECK(GTK_WIDGET_TOPLEVEL(toplevel)); |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 rect.set(SkIntToScalar(bounding_rect.x()), | 602 rect.set(SkIntToScalar(bounding_rect.x()), |
597 SkIntToScalar(bounding_rect.y()), | 603 SkIntToScalar(bounding_rect.y()), |
598 SkIntToScalar(bounding_rect.right()), | 604 SkIntToScalar(bounding_rect.right()), |
599 SkIntToScalar(bounding_rect.bottom())); | 605 SkIntToScalar(bounding_rect.bottom())); |
600 | 606 |
601 SkScalar radius = SkIntToScalar(views::BubbleBorder::GetCornerRadius()); | 607 SkScalar radius = SkIntToScalar(views::BubbleBorder::GetCornerRadius()); |
602 path->addRoundRect(rect, radius, radius); | 608 path->addRoundRect(rect, radius, radius); |
603 } | 609 } |
604 | 610 |
605 void AutocompletePopupContentsView::UpdateBlurRegion() { | 611 void AutocompletePopupContentsView::UpdateBlurRegion() { |
606 #if defined(OS_WIN) | 612 #if defined(OS_WIN) && !defined(USE_AURA) |
607 // We only support background blurring on Vista with Aero-Glass enabled. | 613 // We only support background blurring on Vista with Aero-Glass enabled. |
608 if (!views::NativeWidgetWin::IsAeroGlassEnabled() || !GetWidget()) | 614 if (!views::NativeWidgetWin::IsAeroGlassEnabled() || !GetWidget()) |
609 return; | 615 return; |
610 | 616 |
611 // Provide a blurred background effect within the contents region of the | 617 // Provide a blurred background effect within the contents region of the |
612 // popup. | 618 // popup. |
613 DWM_BLURBEHIND bb = {0}; | 619 DWM_BLURBEHIND bb = {0}; |
614 bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION; | 620 bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION; |
615 bb.fEnable = true; | 621 bb.fEnable = true; |
616 | 622 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 opt_in_view_ = NULL; | 703 opt_in_view_ = NULL; |
698 PromoCounter* counter = profile_->GetInstantPromoCounter(); | 704 PromoCounter* counter = profile_->GetInstantPromoCounter(); |
699 DCHECK(counter); | 705 DCHECK(counter); |
700 counter->Hide(); | 706 counter->Hide(); |
701 if (opt_in) { | 707 if (opt_in) { |
702 browser::ShowInstantConfirmDialogIfNecessary( | 708 browser::ShowInstantConfirmDialogIfNecessary( |
703 location_bar_->GetWidget()->GetNativeWindow(), profile_); | 709 location_bar_->GetWidget()->GetNativeWindow(), profile_); |
704 } | 710 } |
705 UpdatePopupAppearance(); | 711 UpdatePopupAppearance(); |
706 } | 712 } |
OLD | NEW |