| 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 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <commctrl.h> | 8 #include <commctrl.h> |
| 9 #include <dwmapi.h> | 9 #include <dwmapi.h> |
| 10 #include <objidl.h> | 10 #include <objidl.h> |
| 11 #endif | 11 #endif |
| 12 | 12 |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/themes/theme_service.h" | 16 #include "chrome/browser/themes/theme_service.h" |
| 17 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 17 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| 18 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 18 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 19 #include "chrome/browser/ui/views/omnibox/inline_omnibox_popup_view.h" |
| 19 #include "chrome/browser/ui/views/omnibox/omnibox_result_view.h" | 20 #include "chrome/browser/ui/views/omnibox/omnibox_result_view.h" |
| 20 #include "chrome/browser/ui/views/omnibox/touch_omnibox_popup_contents_view.h" | 21 #include "chrome/browser/ui/views/omnibox/touch_omnibox_popup_contents_view.h" |
| 21 #include "grit/chromium_strings.h" | 22 #include "grit/chromium_strings.h" |
| 22 #include "grit/generated_resources.h" | 23 #include "grit/generated_resources.h" |
| 23 #include "grit/theme_resources.h" | 24 #include "grit/theme_resources.h" |
| 24 #include "third_party/skia/include/core/SkShader.h" | 25 #include "third_party/skia/include/core/SkShader.h" |
| 25 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
| 26 #include "ui/base/layout.h" | 27 #include "ui/base/layout.h" |
| 27 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
| 28 #include "ui/base/theme_provider.h" | 29 #include "ui/base/theme_provider.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 AutocompletePopupWidget() {} | 72 AutocompletePopupWidget() {} |
| 72 virtual ~AutocompletePopupWidget() {} | 73 virtual ~AutocompletePopupWidget() {} |
| 73 | 74 |
| 74 private: | 75 private: |
| 75 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupWidget); | 76 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupWidget); |
| 76 }; | 77 }; |
| 77 | 78 |
| 78 //////////////////////////////////////////////////////////////////////////////// | 79 //////////////////////////////////////////////////////////////////////////////// |
| 79 // OmniboxPopupContentsView, public: | 80 // OmniboxPopupContentsView, public: |
| 80 | 81 |
| 81 OmniboxPopupContentsView* OmniboxPopupContentsView::CreateForEnvironment( | 82 OmniboxPopupView* OmniboxPopupContentsView::Create( |
| 82 const gfx::Font& font, | 83 const gfx::Font& font, |
| 83 OmniboxView* omnibox_view, | 84 OmniboxView* omnibox_view, |
| 84 AutocompleteEditModel* edit_model, | 85 AutocompleteEditModel* edit_model, |
| 85 views::View* location_bar) { | 86 views::View* location_bar, |
| 87 views::View* popup_parent_view) { |
| 88 // TODO(sky): add a flag to enable this. |
| 89 /* |
| 90 if (...) { |
| 91 InlineOmniboxPopupView* inline_view = |
| 92 new InlineOmniboxPopupView(font, omnibox_view, edit_model, |
| 93 location_bar); |
| 94 inline_view->Init(); |
| 95 popup_parent_view->AddChildView(inline_view); |
| 96 return inline_view; |
| 97 } |
| 98 */ |
| 99 |
| 86 OmniboxPopupContentsView* view = NULL; | 100 OmniboxPopupContentsView* view = NULL; |
| 87 if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH) { | 101 if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH) { |
| 88 view = new TouchOmniboxPopupContentsView( | 102 view = new TouchOmniboxPopupContentsView( |
| 89 font, omnibox_view, edit_model, location_bar); | 103 font, omnibox_view, edit_model, location_bar); |
| 90 } else { | 104 } else { |
| 91 view = new OmniboxPopupContentsView( | 105 view = new OmniboxPopupContentsView( |
| 92 font, omnibox_view, edit_model, location_bar); | 106 font, omnibox_view, edit_model, location_bar); |
| 93 } | 107 } |
| 94 | 108 |
| 95 view->Init(); | 109 view->Init(); |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 if (HasMatchAt(index) && should_set_selected_line) | 574 if (HasMatchAt(index) && should_set_selected_line) |
| 561 model_->SetSelectedLine(index, false, false); | 575 model_->SetSelectedLine(index, false, false); |
| 562 } | 576 } |
| 563 | 577 |
| 564 void OmniboxPopupContentsView::OpenSelectedLine( | 578 void OmniboxPopupContentsView::OpenSelectedLine( |
| 565 const views::LocatedEvent& event, | 579 const views::LocatedEvent& event, |
| 566 WindowOpenDisposition disposition) { | 580 WindowOpenDisposition disposition) { |
| 567 size_t index = GetIndexForPoint(event.location()); | 581 size_t index = GetIndexForPoint(event.location()); |
| 568 OpenIndex(index, disposition); | 582 OpenIndex(index, disposition); |
| 569 } | 583 } |
| OLD | NEW |