| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "chrome/browser/search/search.h" | 9 #include "chrome/browser/search/search.h" |
| 10 #include "chrome/browser/themes/theme_properties.h" | 10 #include "chrome/browser/themes/theme_properties.h" |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 // last few pixels to get to one visible result. | 227 // last few pixels to get to one visible result. |
| 228 if (new_target_bounds.height() != target_bounds_.height()) | 228 if (new_target_bounds.height() != target_bounds_.height()) |
| 229 size_animation_.Reset(); | 229 size_animation_.Reset(); |
| 230 target_bounds_ = new_target_bounds; | 230 target_bounds_ = new_target_bounds; |
| 231 | 231 |
| 232 if (popup_ == NULL) { | 232 if (popup_ == NULL) { |
| 233 views::Widget* popup_parent = location_bar_view_->GetWidget(); | 233 views::Widget* popup_parent = location_bar_view_->GetWidget(); |
| 234 | 234 |
| 235 // If the popup is currently closed, we need to create it. | 235 // If the popup is currently closed, we need to create it. |
| 236 popup_ = (new AutocompletePopupWidget)->AsWeakPtr(); | 236 popup_ = (new AutocompletePopupWidget)->AsWeakPtr(); |
| 237 // On Windows use TYPE_MENU to ensure that this window uses the software | 237 |
| 238 // compositor which avoids the UI thread blocking issue during command | 238 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
| 239 // buffer creation. We can revert this change once http://crbug.com/125248 | |
| 240 // is fixed. | |
| 241 #if defined(OS_WIN) | 239 #if defined(OS_WIN) |
| 242 views::Widget::InitParams params(views::Widget::InitParams::TYPE_MENU); | 240 // On Windows use the software compositor to ensure that we don't block |
| 243 // The menu style assumes a top most window. We don't want that in this | 241 // the UI thread blocking issue during command buffer creation. We can |
| 244 // case. | 242 // revert this change once http://crbug.com/125248 is fixed. |
| 245 params.keep_on_top = false; | 243 params.force_software_compositing = true; |
| 246 #else | |
| 247 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | |
| 248 #endif | 244 #endif |
| 249 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 245 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
| 250 params.parent = popup_parent->GetNativeView(); | 246 params.parent = popup_parent->GetNativeView(); |
| 251 params.bounds = GetPopupBounds(); | 247 params.bounds = GetPopupBounds(); |
| 252 params.context = popup_parent->GetNativeWindow(); | 248 params.context = popup_parent->GetNativeWindow(); |
| 253 popup_->Init(params); | 249 popup_->Init(params); |
| 254 // Third-party software such as DigitalPersona identity verification can | 250 // Third-party software such as DigitalPersona identity verification can |
| 255 // hook the underlying window creation methods and use SendMessage to | 251 // hook the underlying window creation methods and use SendMessage to |
| 256 // synchronously change focus/activation, resulting in the popup being | 252 // synchronously change focus/activation, resulting in the popup being |
| 257 // destroyed by the time control returns here. Bail out in this case to | 253 // destroyed by the time control returns here. Bail out in this case to |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 size_t index = GetIndexForPoint(event.location()); | 521 size_t index = GetIndexForPoint(event.location()); |
| 526 if (!HasMatchAt(index)) | 522 if (!HasMatchAt(index)) |
| 527 return; | 523 return; |
| 528 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, | 524 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, |
| 529 GURL(), base::string16(), index); | 525 GURL(), base::string16(), index); |
| 530 } | 526 } |
| 531 | 527 |
| 532 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { | 528 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { |
| 533 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); | 529 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); |
| 534 } | 530 } |
| OLD | NEW |