Chromium Code Reviews| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 // The menu style assumes a top most window. We don't want that in this | 226 // The menu style assumes a top most window. We don't want that in this |
| 224 // case. | 227 // case. |
| 225 params.keep_on_top = false; | 228 params.keep_on_top = false; |
| 226 #else | 229 #else |
| 227 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 230 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
| 228 #endif | 231 #endif |
| 229 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 232 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
| 230 params.parent = popup_parent->GetNativeView(); | 233 params.parent = popup_parent->GetNativeView(); |
| 231 params.bounds = GetPopupBounds(); | 234 params.bounds = GetPopupBounds(); |
| 232 params.context = popup_parent->GetNativeWindow(); | 235 params.context = popup_parent->GetNativeWindow(); |
| 236 params.theme_provider = ThemeServiceFactory::GetForProfile( | |
| 237 ProfileManager::GetActiveUserProfile()); | |
|
oshima
2015/09/02 18:44:12
ditto
| |
| 233 popup_->Init(params); | 238 popup_->Init(params); |
| 234 // Third-party software such as DigitalPersona identity verification can | 239 // Third-party software such as DigitalPersona identity verification can |
| 235 // hook the underlying window creation methods and use SendMessage to | 240 // hook the underlying window creation methods and use SendMessage to |
| 236 // synchronously change focus/activation, resulting in the popup being | 241 // synchronously change focus/activation, resulting in the popup being |
| 237 // destroyed by the time control returns here. Bail out in this case to | 242 // destroyed by the time control returns here. Bail out in this case to |
| 238 // avoid a NULL dereference. | 243 // avoid a NULL dereference. |
| 239 if (!popup_.get()) | 244 if (!popup_.get()) |
| 240 return; | 245 return; |
| 241 popup_->SetVisibilityAnimationTransition(views::Widget::ANIMATE_NONE); | 246 popup_->SetVisibilityAnimationTransition(views::Widget::ANIMATE_NONE); |
| 242 popup_->SetContentsView(this); | 247 popup_->SetContentsView(this); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 511 size_t index = GetIndexForPoint(event.location()); | 516 size_t index = GetIndexForPoint(event.location()); |
| 512 if (!HasMatchAt(index)) | 517 if (!HasMatchAt(index)) |
| 513 return; | 518 return; |
| 514 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, | 519 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, |
| 515 GURL(), base::string16(), index); | 520 GURL(), base::string16(), index); |
| 516 } | 521 } |
| 517 | 522 |
| 518 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { | 523 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { |
| 519 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); | 524 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); |
| 520 } | 525 } |
| OLD | NEW |