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 #include "ui/wm/core/window_animations.h" | 22 #include "ui/wm/core/window_animations.h" |
24 | 23 |
(...skipping 14 matching lines...) Expand all Loading... |
39 | 38 |
40 //////////////////////////////////////////////////////////////////////////////// | 39 //////////////////////////////////////////////////////////////////////////////// |
41 // OmniboxPopupContentsView, public: | 40 // OmniboxPopupContentsView, public: |
42 | 41 |
43 OmniboxPopupView* OmniboxPopupContentsView::Create( | 42 OmniboxPopupView* OmniboxPopupContentsView::Create( |
44 const gfx::FontList& font_list, | 43 const gfx::FontList& font_list, |
45 OmniboxView* omnibox_view, | 44 OmniboxView* omnibox_view, |
46 OmniboxEditModel* edit_model, | 45 OmniboxEditModel* edit_model, |
47 LocationBarView* location_bar_view) { | 46 LocationBarView* location_bar_view) { |
48 OmniboxPopupContentsView* view = NULL; | 47 OmniboxPopupContentsView* view = NULL; |
49 if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH) { | 48 view = new OmniboxPopupContentsView( |
50 view = new TouchOmniboxPopupContentsView( | 49 font_list, omnibox_view, edit_model, location_bar_view); |
51 font_list, omnibox_view, edit_model, location_bar_view); | |
52 } else { | |
53 view = new OmniboxPopupContentsView( | |
54 font_list, omnibox_view, edit_model, location_bar_view); | |
55 } | |
56 | |
57 view->Init(); | 50 view->Init(); |
58 return view; | 51 return view; |
59 } | 52 } |
60 | 53 |
61 OmniboxPopupContentsView::OmniboxPopupContentsView( | 54 OmniboxPopupContentsView::OmniboxPopupContentsView( |
62 const gfx::FontList& font_list, | 55 const gfx::FontList& font_list, |
63 OmniboxView* omnibox_view, | 56 OmniboxView* omnibox_view, |
64 OmniboxEditModel* edit_model, | 57 OmniboxEditModel* edit_model, |
65 LocationBarView* location_bar_view) | 58 LocationBarView* location_bar_view) |
66 : model_(new OmniboxPopupModel(this, edit_model)), | 59 : model_(new OmniboxPopupModel(this, edit_model)), |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 size_t index = GetIndexForPoint(event.location()); | 492 size_t index = GetIndexForPoint(event.location()); |
500 if (!HasMatchAt(index)) | 493 if (!HasMatchAt(index)) |
501 return; | 494 return; |
502 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, | 495 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, |
503 GURL(), base::string16(), index); | 496 GURL(), base::string16(), index); |
504 } | 497 } |
505 | 498 |
506 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { | 499 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { |
507 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); | 500 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); |
508 } | 501 } |
OLD | NEW |