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_impl.h" | 5 #include "mandoline/ui/omnibox/omnibox_impl.h" |
6 | 6 |
7 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
8 #include "components/view_manager/public/cpp/view_manager_client_factory.h" | 8 #include "components/view_manager/public/cpp/view_manager_client_factory.h" |
9 #include "mandoline/ui/aura/aura_init.h" | 9 #include "mandoline/ui/aura/aura_init.h" |
10 #include "mandoline/ui/aura/native_widget_view_manager.h" | 10 #include "mandoline/ui/aura/native_widget_view_manager.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 } | 49 } |
50 | 50 |
51 //////////////////////////////////////////////////////////////////////////////// | 51 //////////////////////////////////////////////////////////////////////////////// |
52 // OmniboxImpl, mojo::ViewManagerDelegate implementation: | 52 // OmniboxImpl, mojo::ViewManagerDelegate implementation: |
53 | 53 |
54 void OmniboxImpl::OnEmbed(mojo::View* root) { | 54 void OmniboxImpl::OnEmbed(mojo::View* root) { |
55 if (!aura_init_.get()) { | 55 if (!aura_init_.get()) { |
56 aura_init_.reset(new AuraInit(root, app_impl_->shell())); | 56 aura_init_.reset(new AuraInit(root, app_impl_->shell())); |
57 edit_ = new views::Textfield; | 57 edit_ = new views::Textfield; |
58 edit_->set_controller(this); | 58 edit_->set_controller(this); |
| 59 edit_->SetTextInputType(ui::TEXT_INPUT_TYPE_URL); |
59 } | 60 } |
60 | 61 |
61 const int kOpacity = 0xC0; | 62 const int kOpacity = 0xC0; |
62 views::WidgetDelegateView* widget_delegate = new views::WidgetDelegateView; | 63 views::WidgetDelegateView* widget_delegate = new views::WidgetDelegateView; |
63 widget_delegate->GetContentsView()->set_background( | 64 widget_delegate->GetContentsView()->set_background( |
64 views::Background::CreateSolidBackground( | 65 views::Background::CreateSolidBackground( |
65 SkColorSetA(0xDDDDDD, kOpacity))); | 66 SkColorSetA(0xDDDDDD, kOpacity))); |
66 widget_delegate->GetContentsView()->AddChildView(edit_); | 67 widget_delegate->GetContentsView()->AddChildView(edit_); |
67 widget_delegate->GetContentsView()->SetLayoutManager(this); | 68 widget_delegate->GetContentsView()->SetLayoutManager(this); |
68 | 69 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 } | 134 } |
134 | 135 |
135 void OmniboxImpl::ShowForURL(const mojo::String& url) { | 136 void OmniboxImpl::ShowForURL(const mojo::String& url) { |
136 url_ = url; | 137 url_ = url; |
137 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 138 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
138 request->url = mojo::String::From("mojo:omnibox"); | 139 request->url = mojo::String::From("mojo:omnibox"); |
139 view_embedder_->Embed(request.Pass()); | 140 view_embedder_->Embed(request.Pass()); |
140 } | 141 } |
141 | 142 |
142 } // namespace mandoline | 143 } // namespace mandoline |
OLD | NEW |