Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(367)

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc

Issue 10580039: Adds ability to render omnibox as a view above the page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/autocomplete/autocomplete_popup_model.h" 15 #include "chrome/browser/autocomplete/autocomplete_popup_model.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/themes/theme_service.h" 17 #include "chrome/browser/themes/theme_service.h"
18 #include "chrome/browser/ui/omnibox/omnibox_view.h" 18 #include "chrome/browser/ui/omnibox/omnibox_view.h"
19 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 19 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
20 #include "chrome/browser/ui/views/omnibox/inline_omnibox_popup_view.h"
20 #include "chrome/browser/ui/views/omnibox/omnibox_result_view.h" 21 #include "chrome/browser/ui/views/omnibox/omnibox_result_view.h"
21 #include "chrome/browser/ui/views/omnibox/touch_omnibox_popup_contents_view.h" 22 #include "chrome/browser/ui/views/omnibox/touch_omnibox_popup_contents_view.h"
22 #include "grit/chromium_strings.h" 23 #include "grit/chromium_strings.h"
23 #include "grit/generated_resources.h" 24 #include "grit/generated_resources.h"
24 #include "grit/theme_resources.h" 25 #include "grit/theme_resources.h"
25 #include "third_party/skia/include/core/SkShader.h" 26 #include "third_party/skia/include/core/SkShader.h"
26 #include "ui/base/l10n/l10n_util.h" 27 #include "ui/base/l10n/l10n_util.h"
27 #include "ui/base/layout.h" 28 #include "ui/base/layout.h"
28 #include "ui/base/resource/resource_bundle.h" 29 #include "ui/base/resource/resource_bundle.h"
29 #include "ui/base/theme_provider.h" 30 #include "ui/base/theme_provider.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 AutocompletePopupWidget() {} 73 AutocompletePopupWidget() {}
73 virtual ~AutocompletePopupWidget() {} 74 virtual ~AutocompletePopupWidget() {}
74 75
75 private: 76 private:
76 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupWidget); 77 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupWidget);
77 }; 78 };
78 79
79 //////////////////////////////////////////////////////////////////////////////// 80 ////////////////////////////////////////////////////////////////////////////////
80 // OmniboxPopupContentsView, public: 81 // OmniboxPopupContentsView, public:
81 82
82 OmniboxPopupContentsView* OmniboxPopupContentsView::CreateForEnvironment( 83 AutocompletePopupView* OmniboxPopupContentsView::Create(
83 const gfx::Font& font, 84 const gfx::Font& font,
84 OmniboxView* omnibox_view, 85 OmniboxView* omnibox_view,
85 AutocompleteEditModel* edit_model, 86 AutocompleteEditModel* edit_model,
86 views::View* location_bar) { 87 views::View* location_bar,
88 views::View* popup_parent_view) {
89 // TODO(sky): add a flag to enable this.
90 /*
91 if (...) {
92 InlineOmniboxPopupView* inline_view =
93 new InlineOmniboxPopupView(font, omnibox_view, edit_model,
94 location_bar);
95 inline_view->Init();
96 popup_parent_view->AddChildView(inline_view);
97 return inline_view;
98 }
99 */
100
87 OmniboxPopupContentsView* view = NULL; 101 OmniboxPopupContentsView* view = NULL;
88 if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH) { 102 if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH) {
89 view = new TouchOmniboxPopupContentsView( 103 view = new TouchOmniboxPopupContentsView(
90 font, omnibox_view, edit_model, location_bar); 104 font, omnibox_view, edit_model, location_bar);
91 } else { 105 } else {
92 view = new OmniboxPopupContentsView( 106 view = new OmniboxPopupContentsView(
93 font, omnibox_view, edit_model, location_bar); 107 font, omnibox_view, edit_model, location_bar);
94 } 108 }
95 109
96 view->Init(); 110 view->Init();
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 if (HasMatchAt(index) && should_set_selected_line) 575 if (HasMatchAt(index) && should_set_selected_line)
562 model_->SetSelectedLine(index, false, false); 576 model_->SetSelectedLine(index, false, false);
563 } 577 }
564 578
565 void OmniboxPopupContentsView::OpenSelectedLine( 579 void OmniboxPopupContentsView::OpenSelectedLine(
566 const views::LocatedEvent& event, 580 const views::LocatedEvent& event,
567 WindowOpenDisposition disposition) { 581 WindowOpenDisposition disposition) {
568 size_t index = GetIndexForPoint(event.location()); 582 size_t index = GetIndexForPoint(event.location());
569 OpenIndex(index, disposition); 583 OpenIndex(index, disposition);
570 } 584 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698