| 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/omnibox/omnibox_popup_contents_view.h" | 5 #include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 7 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| 8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 9 #include "chrome/browser/ui/views/omnibox/inline_omnibox_popup_view.h" | 9 #include "chrome/browser/ui/views/omnibox/inline_omnibox_popup_view.h" |
| 10 #include "chrome/browser/ui/views/omnibox/omnibox_result_view.h" | 10 #include "chrome/browser/ui/views/omnibox/omnibox_result_view.h" |
| 11 #include "chrome/browser/ui/views/omnibox/touch_omnibox_popup_contents_view.h" | 11 #include "chrome/browser/ui/views/omnibox/touch_omnibox_popup_contents_view.h" |
| 12 #include "ui/base/theme_provider.h" | 12 #include "ui/base/theme_provider.h" |
| 13 #include "ui/gfx/canvas.h" | 13 #include "ui/gfx/canvas.h" |
| 14 #include "ui/gfx/image/image.h" | 14 #include "ui/gfx/image/image.h" |
| 15 #include "ui/gfx/path.h" | 15 #include "ui/gfx/path.h" |
| 16 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
| 17 | 17 |
| 18 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
| 19 #include <dwmapi.h> | 19 #include <dwmapi.h> |
| 20 | 20 |
| 21 #include "base/win/scoped_gdi_object.h" | 21 #include "base/win/scoped_gdi_object.h" |
| 22 #if !defined(USE_AURA) | 22 #if !defined(USE_AURA) |
| 23 #include "ui/views/widget/native_widget_win.h" | 23 #include "ui/base/win/shell.h" |
| 24 #endif | 24 #endif |
| 25 #endif | 25 #endif |
| 26 #if defined(USE_ASH) | 26 #if defined(USE_ASH) |
| 27 #include "ash/wm/window_animations.h" | 27 #include "ash/wm/window_animations.h" |
| 28 #endif | 28 #endif |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 const SkAlpha kGlassPopupAlpha = 240; | 32 const SkAlpha kGlassPopupAlpha = 240; |
| 33 const SkAlpha kOpaquePopupAlpha = 255; | 33 const SkAlpha kOpaquePopupAlpha = 255; |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 SkIntToScalar(bounding_rect.right()), | 452 SkIntToScalar(bounding_rect.right()), |
| 453 SkIntToScalar(bounding_rect.bottom())); | 453 SkIntToScalar(bounding_rect.bottom())); |
| 454 | 454 |
| 455 SkScalar radius = SkIntToScalar(views::BubbleBorder::GetCornerRadius()); | 455 SkScalar radius = SkIntToScalar(views::BubbleBorder::GetCornerRadius()); |
| 456 path->addRoundRect(rect, radius, radius); | 456 path->addRoundRect(rect, radius, radius); |
| 457 } | 457 } |
| 458 | 458 |
| 459 void OmniboxPopupContentsView::UpdateBlurRegion() { | 459 void OmniboxPopupContentsView::UpdateBlurRegion() { |
| 460 #if defined(OS_WIN) && !defined(USE_AURA) | 460 #if defined(OS_WIN) && !defined(USE_AURA) |
| 461 // We only support background blurring on Vista with Aero-Glass enabled. | 461 // We only support background blurring on Vista with Aero-Glass enabled. |
| 462 if (!views::NativeWidgetWin::IsAeroGlassEnabled() || !GetWidget()) | 462 if (!ui::win::IsAeroGlassEnabled() || !GetWidget()) |
| 463 return; | 463 return; |
| 464 | 464 |
| 465 // Provide a blurred background effect within the contents region of the | 465 // Provide a blurred background effect within the contents region of the |
| 466 // popup. | 466 // popup. |
| 467 DWM_BLURBEHIND bb = {0}; | 467 DWM_BLURBEHIND bb = {0}; |
| 468 bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION; | 468 bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION; |
| 469 bb.fEnable = true; | 469 bb.fEnable = true; |
| 470 | 470 |
| 471 // Translate the contents rect into widget coordinates, since that's what | 471 // Translate the contents rect into widget coordinates, since that's what |
| 472 // DwmEnableBlurBehindWindow expects a region in. | 472 // DwmEnableBlurBehindWindow expects a region in. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 if (HasMatchAt(index) && should_set_selected_line) | 549 if (HasMatchAt(index) && should_set_selected_line) |
| 550 model_->SetSelectedLine(index, false, false); | 550 model_->SetSelectedLine(index, false, false); |
| 551 } | 551 } |
| 552 | 552 |
| 553 void OmniboxPopupContentsView::OpenSelectedLine( | 553 void OmniboxPopupContentsView::OpenSelectedLine( |
| 554 const ui::LocatedEvent& event, | 554 const ui::LocatedEvent& event, |
| 555 WindowOpenDisposition disposition) { | 555 WindowOpenDisposition disposition) { |
| 556 size_t index = GetIndexForPoint(event.location()); | 556 size_t index = GetIndexForPoint(event.location()); |
| 557 OpenIndex(index, disposition); | 557 OpenIndex(index, disposition); |
| 558 } | 558 } |
| OLD | NEW |