| 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 "chrome/browser/search/search.h" | 7 #include "chrome/browser/search/search.h" |
| 8 #include "chrome/browser/themes/theme_properties.h" | 8 #include "chrome/browser/themes/theme_properties.h" |
| 9 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 9 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| 10 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 10 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 11 #include "chrome/browser/ui/views/omnibox/omnibox_result_view.h" | 11 #include "chrome/browser/ui/views/omnibox/omnibox_result_view.h" |
| 12 #include "chrome/browser/ui/views/omnibox/touch_omnibox_popup_contents_view.h" | 12 #include "chrome/browser/ui/views/omnibox/touch_omnibox_popup_contents_view.h" |
| 13 #include "grit/ui_resources.h" | 13 #include "grit/ui_resources.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/views/controls/image_view.h" | 18 #include "ui/views/controls/image_view.h" |
| 19 #include "ui/views/widget/widget.h" | 19 #include "ui/views/widget/widget.h" |
| 20 #include "ui/views/window/non_client_view.h" | 20 #include "ui/views/window/non_client_view.h" |
| 21 | 21 |
| 22 #if defined(USE_AURA) | 22 #if defined(USE_AURA) |
| 23 #include "ui/views/corewm/window_animations.h" | 23 #include "ui/views/corewm/window_animations.h" |
| 24 #endif | 24 #endif |
| 25 | 25 |
| 26 namespace { | |
| 27 | |
| 28 // This is the number of pixels in the border image used to draw the bottom | |
| 29 // border + drop shadow interior to the "visual" border. We lay out assuming | |
| 30 // that this many pixels inside the border is "in the popup." | |
| 31 const SkAlpha kGlassPopupAlpha = 240; | |
| 32 const SkAlpha kOpaquePopupAlpha = 255; | |
| 33 | |
| 34 // This is the number of pixels in the border image interior to the actual | 26 // This is the number of pixels in the border image interior to the actual |
| 35 // border. | 27 // border. |
| 36 const int kBorderInterior = 6; | 28 const int kBorderInterior = 6; |
| 37 | 29 |
| 38 } // namespace | |
| 39 | |
| 40 class OmniboxPopupContentsView::AutocompletePopupWidget | 30 class OmniboxPopupContentsView::AutocompletePopupWidget |
| 41 : public views::Widget, | 31 : public views::Widget, |
| 42 public base::SupportsWeakPtr<AutocompletePopupWidget> { | 32 public base::SupportsWeakPtr<AutocompletePopupWidget> { |
| 43 public: | 33 public: |
| 44 AutocompletePopupWidget() {} | 34 AutocompletePopupWidget() {} |
| 45 virtual ~AutocompletePopupWidget() {} | 35 virtual ~AutocompletePopupWidget() {} |
| 46 | 36 |
| 47 private: | 37 private: |
| 48 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupWidget); | 38 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupWidget); |
| 49 }; | 39 }; |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 // OpenMatch() may close the popup, which will clear the result set and, by | 504 // OpenMatch() may close the popup, which will clear the result set and, by |
| 515 // extension, |match| and its contents. So copy the relevant match out to | 505 // extension, |match| and its contents. So copy the relevant match out to |
| 516 // make sure it stays alive until the call completes. | 506 // make sure it stays alive until the call completes. |
| 517 AutocompleteMatch match = model_->result().match_at(index); | 507 AutocompleteMatch match = model_->result().match_at(index); |
| 518 omnibox_view_->OpenMatch(match, disposition, GURL(), index); | 508 omnibox_view_->OpenMatch(match, disposition, GURL(), index); |
| 519 } | 509 } |
| 520 | 510 |
| 521 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { | 511 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { |
| 522 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); | 512 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); |
| 523 } | 513 } |
| OLD | NEW |