| 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/profiles/profile_manager.h" |
| 9 #include "chrome/browser/search/search.h" | 10 #include "chrome/browser/search/search.h" |
| 10 #include "chrome/browser/themes/theme_properties.h" | 11 #include "chrome/browser/themes/theme_properties.h" |
| 12 #include "chrome/browser/themes/theme_service.h" |
| 13 #include "chrome/browser/themes/theme_service_factory.h" |
| 11 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 14 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 12 #include "chrome/browser/ui/views/omnibox/omnibox_result_view.h" | 15 #include "chrome/browser/ui/views/omnibox/omnibox_result_view.h" |
| 13 #include "components/omnibox/browser/omnibox_view.h" | 16 #include "components/omnibox/browser/omnibox_view.h" |
| 14 #include "grit/theme_resources.h" | 17 #include "grit/theme_resources.h" |
| 15 #include "ui/base/resource/material_design/material_design_controller.h" | 18 #include "ui/base/resource/material_design/material_design_controller.h" |
| 16 #include "ui/base/theme_provider.h" | 19 #include "ui/base/theme_provider.h" |
| 17 #include "ui/compositor/clip_transform_recorder.h" | 20 #include "ui/compositor/clip_transform_recorder.h" |
| 18 #include "ui/compositor/paint_recorder.h" | 21 #include "ui/compositor/paint_recorder.h" |
| 19 #include "ui/gfx/canvas.h" | 22 #include "ui/gfx/canvas.h" |
| 20 #include "ui/gfx/image/image.h" | 23 #include "ui/gfx/image/image.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 // The menu style assumes a top most window. We don't want that in this | 247 // The menu style assumes a top most window. We don't want that in this |
| 245 // case. | 248 // case. |
| 246 params.keep_on_top = false; | 249 params.keep_on_top = false; |
| 247 #else | 250 #else |
| 248 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 251 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
| 249 #endif | 252 #endif |
| 250 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 253 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
| 251 params.parent = popup_parent->GetNativeView(); | 254 params.parent = popup_parent->GetNativeView(); |
| 252 params.bounds = GetPopupBounds(); | 255 params.bounds = GetPopupBounds(); |
| 253 params.context = popup_parent->GetNativeWindow(); | 256 params.context = popup_parent->GetNativeWindow(); |
| 257 params.theme_provider = ThemeServiceFactory::GetForProfile( |
| 258 ProfileManager::GetActiveUserProfile()); |
| 254 popup_->Init(params); | 259 popup_->Init(params); |
| 255 // Third-party software such as DigitalPersona identity verification can | 260 // Third-party software such as DigitalPersona identity verification can |
| 256 // hook the underlying window creation methods and use SendMessage to | 261 // hook the underlying window creation methods and use SendMessage to |
| 257 // synchronously change focus/activation, resulting in the popup being | 262 // synchronously change focus/activation, resulting in the popup being |
| 258 // destroyed by the time control returns here. Bail out in this case to | 263 // destroyed by the time control returns here. Bail out in this case to |
| 259 // avoid a NULL dereference. | 264 // avoid a NULL dereference. |
| 260 if (!popup_.get()) | 265 if (!popup_.get()) |
| 261 return; | 266 return; |
| 262 popup_->SetVisibilityAnimationTransition(views::Widget::ANIMATE_NONE); | 267 popup_->SetVisibilityAnimationTransition(views::Widget::ANIMATE_NONE); |
| 263 popup_->SetContentsView(this); | 268 popup_->SetContentsView(this); |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 size_t index = GetIndexForPoint(event.location()); | 542 size_t index = GetIndexForPoint(event.location()); |
| 538 if (!HasMatchAt(index)) | 543 if (!HasMatchAt(index)) |
| 539 return; | 544 return; |
| 540 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, | 545 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, |
| 541 GURL(), base::string16(), index); | 546 GURL(), base::string16(), index); |
| 542 } | 547 } |
| 543 | 548 |
| 544 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { | 549 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { |
| 545 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); | 550 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); |
| 546 } | 551 } |
| OLD | NEW |