OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "mandoline/ui/omnibox/omnibox_application.h" | 5 #include "mandoline/ui/omnibox/omnibox_application.h" |
6 | 6 |
7 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "components/mus/public/cpp/window.h" | 9 #include "components/mus/public/cpp/window.h" |
10 #include "components/mus/public/cpp/window_tree_connection.h" | 10 #include "components/mus/public/cpp/window_tree_connection.h" |
11 #include "components/mus/public/cpp/window_tree_delegate.h" | 11 #include "components/mus/public/cpp/window_tree_delegate.h" |
12 #include "components/url_formatter/url_fixer.h" | 12 #include "components/url_formatter/url_fixer.h" |
13 #include "mandoline/ui/common/util.h" | |
14 #include "mandoline/ui/desktop_ui/public/interfaces/view_embedder.mojom.h" | 13 #include "mandoline/ui/desktop_ui/public/interfaces/view_embedder.mojom.h" |
15 #include "mojo/application/public/cpp/application_impl.h" | 14 #include "mojo/application/public/cpp/application_impl.h" |
16 #include "mojo/common/common_type_converters.h" | 15 #include "mojo/common/common_type_converters.h" |
17 #include "ui/mojo/init/ui_init.h" | 16 #include "ui/mojo/init/ui_init.h" |
18 #include "ui/views/background.h" | 17 #include "ui/views/background.h" |
19 #include "ui/views/controls/textfield/textfield.h" | 18 #include "ui/views/controls/textfield/textfield.h" |
20 #include "ui/views/controls/textfield/textfield_controller.h" | 19 #include "ui/views/controls/textfield/textfield_controller.h" |
21 #include "ui/views/layout/layout_manager.h" | 20 #include "ui/views/layout/layout_manager.h" |
22 #include "ui/views/mus/aura_init.h" | 21 #include "ui/views/mus/aura_init.h" |
| 22 #include "ui/views/mus/display_converter.h" |
23 #include "ui/views/mus/native_widget_view_manager.h" | 23 #include "ui/views/mus/native_widget_view_manager.h" |
24 #include "ui/views/widget/widget_delegate.h" | 24 #include "ui/views/widget/widget_delegate.h" |
25 | 25 |
26 namespace mandoline { | 26 namespace mandoline { |
27 | 27 |
28 //////////////////////////////////////////////////////////////////////////////// | 28 //////////////////////////////////////////////////////////////////////////////// |
29 // OmniboxImpl | 29 // OmniboxImpl |
30 | 30 |
31 class OmniboxImpl : public mus::WindowTreeDelegate, | 31 class OmniboxImpl : public mus::WindowTreeDelegate, |
32 public views::LayoutManager, | 32 public views::LayoutManager, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 112 } |
113 OmniboxImpl::~OmniboxImpl() {} | 113 OmniboxImpl::~OmniboxImpl() {} |
114 | 114 |
115 //////////////////////////////////////////////////////////////////////////////// | 115 //////////////////////////////////////////////////////////////////////////////// |
116 // OmniboxImpl, mus::WindowTreeDelegate implementation: | 116 // OmniboxImpl, mus::WindowTreeDelegate implementation: |
117 | 117 |
118 void OmniboxImpl::OnEmbed(mus::Window* root) { | 118 void OmniboxImpl::OnEmbed(mus::Window* root) { |
119 root_ = root; | 119 root_ = root; |
120 | 120 |
121 if (!aura_init_.get()) { | 121 if (!aura_init_.get()) { |
122 ui_init_.reset(new ui::mojo::UIInit(GetDisplaysFromWindow(root_))); | 122 ui_init_.reset(new ui::mojo::UIInit(views::GetDisplaysFromWindow(root_))); |
123 aura_init_.reset(new views::AuraInit(app_, "mandoline_ui.pak")); | 123 aura_init_.reset(new views::AuraInit(app_, "mandoline_ui.pak")); |
124 edit_ = new views::Textfield; | 124 edit_ = new views::Textfield; |
125 edit_->set_controller(this); | 125 edit_->set_controller(this); |
126 edit_->SetTextInputType(ui::TEXT_INPUT_TYPE_URL); | 126 edit_->SetTextInputType(ui::TEXT_INPUT_TYPE_URL); |
127 } | 127 } |
128 | 128 |
129 const int kOpacity = 0xC0; | 129 const int kOpacity = 0xC0; |
130 views::WidgetDelegateView* widget_delegate = new views::WidgetDelegateView; | 130 views::WidgetDelegateView* widget_delegate = new views::WidgetDelegateView; |
131 widget_delegate->GetContentsView()->set_background( | 131 widget_delegate->GetContentsView()->set_background( |
132 views::Background::CreateSolidBackground( | 132 views::Background::CreateSolidBackground( |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 edit_->SelectAll(false); | 222 edit_->SelectAll(false); |
223 edit_->RequestFocus(); | 223 edit_->RequestFocus(); |
224 } | 224 } |
225 | 225 |
226 void OmniboxImpl::HideWindow() { | 226 void OmniboxImpl::HideWindow() { |
227 DCHECK(root_); | 227 DCHECK(root_); |
228 root_->SetVisible(false); | 228 root_->SetVisible(false); |
229 } | 229 } |
230 | 230 |
231 } // namespace mandoline | 231 } // namespace mandoline |
OLD | NEW |