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/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" |
| 11 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 11 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| 12 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 12 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 13 #include "chrome/browser/ui/views/omnibox/omnibox_result_view.h" | 13 #include "chrome/browser/ui/views/omnibox/omnibox_result_view.h" |
| 14 #include "ui/base/theme_provider.h" | 14 #include "ui/base/theme_provider.h" |
| 15 #include "ui/gfx/canvas.h" | 15 #include "ui/gfx/canvas.h" |
| 16 #include "ui/gfx/image/image.h" | 16 #include "ui/gfx/image/image.h" |
| 17 #include "ui/gfx/path.h" | 17 #include "ui/gfx/path.h" |
| 18 #include "ui/resources/grit/ui_resources.h" | 18 #include "ui/resources/grit/ui_resources.h" |
| 19 #include "ui/views/controls/image_view.h" | 19 #include "ui/views/controls/image_view.h" |
| 20 #include "ui/views/view_targeter.h" | 20 #include "ui/views/view_targeter.h" |
| 21 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
| 22 #include "ui/views/window/non_client_view.h" | 22 #include "ui/views/window/non_client_view.h" |
| 23 | 23 |
| 24 namespace { | |
|
Peter Kasting
2015/01/23 07:28:10
Nit: Blank line below this
oshima
2015/01/24 01:23:07
Done.
| |
| 24 // This is the number of pixels in the border image interior to the actual | 25 // This is the number of pixels in the border image interior to the actual |
| 25 // border. | 26 // border. |
| 26 const int kBorderInterior = 6; | 27 const int kBorderInterior = 6; |
| 27 | 28 |
| 29 } // namespace | |
| 30 | |
| 28 class OmniboxPopupContentsView::AutocompletePopupWidget | 31 class OmniboxPopupContentsView::AutocompletePopupWidget |
| 29 : public views::Widget, | 32 : public views::Widget, |
| 30 public base::SupportsWeakPtr<AutocompletePopupWidget> { | 33 public base::SupportsWeakPtr<AutocompletePopupWidget> { |
| 31 public: | 34 public: |
| 32 AutocompletePopupWidget() {} | 35 AutocompletePopupWidget() {} |
| 33 ~AutocompletePopupWidget() override {} | 36 ~AutocompletePopupWidget() override {} |
| 34 | 37 |
| 35 private: | 38 private: |
| 36 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupWidget); | 39 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupWidget); |
| 37 }; | 40 }; |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 void OmniboxPopupContentsView::AnimationProgressed( | 282 void OmniboxPopupContentsView::AnimationProgressed( |
| 280 const gfx::Animation* animation) { | 283 const gfx::Animation* animation) { |
| 281 // We should only be running the animation when the popup is already visible. | 284 // We should only be running the animation when the popup is already visible. |
| 282 DCHECK(popup_ != NULL); | 285 DCHECK(popup_ != NULL); |
| 283 popup_->SetBounds(GetPopupBounds()); | 286 popup_->SetBounds(GetPopupBounds()); |
| 284 } | 287 } |
| 285 | 288 |
| 286 //////////////////////////////////////////////////////////////////////////////// | 289 //////////////////////////////////////////////////////////////////////////////// |
| 287 // OmniboxPopupContentsView, views::View overrides: | 290 // OmniboxPopupContentsView, views::View overrides: |
| 288 | 291 |
| 292 const char* OmniboxPopupContentsView::GetClassName() const { | |
| 293 return "OmniboxPopupContentsView"; | |
| 294 } | |
| 295 | |
| 289 void OmniboxPopupContentsView::Layout() { | 296 void OmniboxPopupContentsView::Layout() { |
| 290 // Size our children to the available content area. | 297 // Size our children to the available content area. |
| 291 LayoutChildren(); | 298 LayoutChildren(); |
| 292 | 299 |
| 293 // We need to manually schedule a paint here since we are a layered window and | 300 // We need to manually schedule a paint here since we are a layered window and |
| 294 // won't implicitly require painting until we ask for one. | 301 // won't implicitly require painting until we ask for one. |
| 295 SchedulePaint(); | 302 SchedulePaint(); |
| 296 } | 303 } |
| 297 | 304 |
| 298 views::View* OmniboxPopupContentsView::GetTooltipHandlerForPoint( | 305 views::View* OmniboxPopupContentsView::GetTooltipHandlerForPoint( |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 499 size_t index = GetIndexForPoint(event.location()); | 506 size_t index = GetIndexForPoint(event.location()); |
| 500 if (!HasMatchAt(index)) | 507 if (!HasMatchAt(index)) |
| 501 return; | 508 return; |
| 502 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, | 509 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, |
| 503 GURL(), base::string16(), index); | 510 GURL(), base::string16(), index); |
| 504 } | 511 } |
| 505 | 512 |
| 506 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { | 513 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { |
| 507 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); | 514 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); |
| 508 } | 515 } |
| OLD | NEW |