| 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 "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "ui/gfx/shadow_value.h" | 27 #include "ui/gfx/shadow_value.h" |
| 28 #include "ui/views/controls/image_view.h" | 28 #include "ui/views/controls/image_view.h" |
| 29 #include "ui/views/view_targeter.h" | 29 #include "ui/views/view_targeter.h" |
| 30 #include "ui/views/widget/widget.h" | 30 #include "ui/views/widget/widget.h" |
| 31 #include "ui/views/window/non_client_view.h" | 31 #include "ui/views/window/non_client_view.h" |
| 32 | 32 |
| 33 namespace { | 33 namespace { |
| 34 | 34 |
| 35 // Cache the shadow images so that potentially expensive shadow drawing isn't | 35 // Cache the shadow images so that potentially expensive shadow drawing isn't |
| 36 // repeated. | 36 // repeated. |
| 37 base::LazyInstance<gfx::ImageSkia> g_top_shadow = LAZY_INSTANCE_INITIALIZER; | 37 base::LazyInstance<gfx::ImageSkia>::DestructorAtExit g_top_shadow = |
| 38 base::LazyInstance<gfx::ImageSkia> g_bottom_shadow = LAZY_INSTANCE_INITIALIZER; | 38 LAZY_INSTANCE_INITIALIZER; |
| 39 base::LazyInstance<gfx::ImageSkia>::DestructorAtExit g_bottom_shadow = |
| 40 LAZY_INSTANCE_INITIALIZER; |
| 39 | 41 |
| 40 const int kPopupVerticalPadding = 4; | 42 const int kPopupVerticalPadding = 4; |
| 41 | 43 |
| 42 } // namespace | 44 } // namespace |
| 43 | 45 |
| 44 class OmniboxPopupContentsView::AutocompletePopupWidget | 46 class OmniboxPopupContentsView::AutocompletePopupWidget |
| 45 : public ThemeCopyingWidget, | 47 : public ThemeCopyingWidget, |
| 46 public base::SupportsWeakPtr<AutocompletePopupWidget> { | 48 public base::SupportsWeakPtr<AutocompletePopupWidget> { |
| 47 public: | 49 public: |
| 48 explicit AutocompletePopupWidget(views::Widget* role_model) | 50 explicit AutocompletePopupWidget(views::Widget* role_model) |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 size_t index = GetIndexForPoint(event.location()); | 528 size_t index = GetIndexForPoint(event.location()); |
| 527 if (!HasMatchAt(index)) | 529 if (!HasMatchAt(index)) |
| 528 return; | 530 return; |
| 529 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, | 531 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, |
| 530 GURL(), base::string16(), index); | 532 GURL(), base::string16(), index); |
| 531 } | 533 } |
| 532 | 534 |
| 533 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { | 535 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { |
| 534 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); | 536 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); |
| 535 } | 537 } |
| OLD | NEW |