| 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 "chrome/browser/ui/views/omnibox/touch_omnibox_popup_contents_view.h" | |
| 15 #include "grit/ui_resources.h" | 14 #include "grit/ui_resources.h" |
| 16 #include "ui/base/theme_provider.h" | 15 #include "ui/base/theme_provider.h" |
| 17 #include "ui/gfx/canvas.h" | 16 #include "ui/gfx/canvas.h" |
| 18 #include "ui/gfx/image/image.h" | 17 #include "ui/gfx/image/image.h" |
| 19 #include "ui/gfx/path.h" | 18 #include "ui/gfx/path.h" |
| 20 #include "ui/views/controls/image_view.h" | 19 #include "ui/views/controls/image_view.h" |
| 21 #include "ui/views/widget/widget.h" | 20 #include "ui/views/widget/widget.h" |
| 22 #include "ui/views/window/non_client_view.h" | 21 #include "ui/views/window/non_client_view.h" |
| 23 | 22 |
| 24 #if defined(USE_AURA) | 23 #if defined(USE_AURA) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 42 | 41 |
| 43 //////////////////////////////////////////////////////////////////////////////// | 42 //////////////////////////////////////////////////////////////////////////////// |
| 44 // OmniboxPopupContentsView, public: | 43 // OmniboxPopupContentsView, public: |
| 45 | 44 |
| 46 OmniboxPopupView* OmniboxPopupContentsView::Create( | 45 OmniboxPopupView* OmniboxPopupContentsView::Create( |
| 47 const gfx::FontList& font_list, | 46 const gfx::FontList& font_list, |
| 48 OmniboxView* omnibox_view, | 47 OmniboxView* omnibox_view, |
| 49 OmniboxEditModel* edit_model, | 48 OmniboxEditModel* edit_model, |
| 50 LocationBarView* location_bar_view) { | 49 LocationBarView* location_bar_view) { |
| 51 OmniboxPopupContentsView* view = NULL; | 50 OmniboxPopupContentsView* view = NULL; |
| 52 if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH) { | 51 view = new OmniboxPopupContentsView( |
| 53 view = new TouchOmniboxPopupContentsView( | 52 font_list, omnibox_view, edit_model, location_bar_view); |
| 54 font_list, omnibox_view, edit_model, location_bar_view); | |
| 55 } else { | |
| 56 view = new OmniboxPopupContentsView( | |
| 57 font_list, omnibox_view, edit_model, location_bar_view); | |
| 58 } | |
| 59 | |
| 60 view->Init(); | 53 view->Init(); |
| 61 return view; | 54 return view; |
| 62 } | 55 } |
| 63 | 56 |
| 64 OmniboxPopupContentsView::OmniboxPopupContentsView( | 57 OmniboxPopupContentsView::OmniboxPopupContentsView( |
| 65 const gfx::FontList& font_list, | 58 const gfx::FontList& font_list, |
| 66 OmniboxView* omnibox_view, | 59 OmniboxView* omnibox_view, |
| 67 OmniboxEditModel* edit_model, | 60 OmniboxEditModel* edit_model, |
| 68 LocationBarView* location_bar_view) | 61 LocationBarView* location_bar_view) |
| 69 : model_(new OmniboxPopupModel(this, edit_model)), | 62 : model_(new OmniboxPopupModel(this, edit_model)), |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 size_t index = GetIndexForPoint(event.location()); | 497 size_t index = GetIndexForPoint(event.location()); |
| 505 if (!HasMatchAt(index)) | 498 if (!HasMatchAt(index)) |
| 506 return; | 499 return; |
| 507 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, | 500 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, |
| 508 GURL(), base::string16(), index); | 501 GURL(), base::string16(), index); |
| 509 } | 502 } |
| 510 | 503 |
| 511 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { | 504 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { |
| 512 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); | 505 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); |
| 513 } | 506 } |
| OLD | NEW |