| 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.h" | 8 #include "components/view_manager/public/cpp/view_manager.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 16 matching lines...) Expand all Loading... |
| 27 //////////////////////////////////////////////////////////////////////////////// | 27 //////////////////////////////////////////////////////////////////////////////// |
| 28 // OmniboxImpl, mojo::ApplicationDelegate implementation: | 28 // OmniboxImpl, mojo::ApplicationDelegate implementation: |
| 29 | 29 |
| 30 void OmniboxImpl::Initialize(mojo::ApplicationImpl* app) { | 30 void OmniboxImpl::Initialize(mojo::ApplicationImpl* app) { |
| 31 app_impl_ = app; | 31 app_impl_ = app; |
| 32 } | 32 } |
| 33 | 33 |
| 34 bool OmniboxImpl::ConfigureIncomingConnection( | 34 bool OmniboxImpl::ConfigureIncomingConnection( |
| 35 mojo::ApplicationConnection* connection) { | 35 mojo::ApplicationConnection* connection) { |
| 36 connection->AddService<Omnibox>(this); | 36 connection->AddService<Omnibox>(this); |
| 37 connection->AddService<mojo::ViewManagerClient>(this); | 37 connection->AddService<mojo::ViewTreeClient>(this); |
| 38 connection->ConnectToService(&view_embedder_); | 38 connection->ConnectToService(&view_embedder_); |
| 39 return true; | 39 return true; |
| 40 } | 40 } |
| 41 | 41 |
| 42 bool OmniboxImpl::ConfigureOutgoingConnection( | 42 bool OmniboxImpl::ConfigureOutgoingConnection( |
| 43 mojo::ApplicationConnection* connection) { | 43 mojo::ApplicationConnection* connection) { |
| 44 return true; | 44 return true; |
| 45 } | 45 } |
| 46 | 46 |
| 47 //////////////////////////////////////////////////////////////////////////////// | 47 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 // OmniboxImpl, mojo::InterfaceFactory<Omnibox> implementation: | 125 // OmniboxImpl, mojo::InterfaceFactory<Omnibox> implementation: |
| 126 | 126 |
| 127 void OmniboxImpl::Create(mojo::ApplicationConnection* connection, | 127 void OmniboxImpl::Create(mojo::ApplicationConnection* connection, |
| 128 mojo::InterfaceRequest<Omnibox> request) { | 128 mojo::InterfaceRequest<Omnibox> request) { |
| 129 // TODO(beng): methinks this doesn't work well across multiple browser | 129 // TODO(beng): methinks this doesn't work well across multiple browser |
| 130 // windows... | 130 // windows... |
| 131 bindings_.AddBinding(this, request.Pass()); | 131 bindings_.AddBinding(this, request.Pass()); |
| 132 } | 132 } |
| 133 | 133 |
| 134 //////////////////////////////////////////////////////////////////////////////// | 134 //////////////////////////////////////////////////////////////////////////////// |
| 135 // OmniboxImpl, mojo::InterfaceFactory<mojo::ViewManagerClient> implementation: | 135 // OmniboxImpl, mojo::InterfaceFactory<mojo::ViewTreeClient> implementation: |
| 136 | 136 |
| 137 void OmniboxImpl::Create( | 137 void OmniboxImpl::Create( |
| 138 mojo::ApplicationConnection* connection, | 138 mojo::ApplicationConnection* connection, |
| 139 mojo::InterfaceRequest<mojo::ViewManagerClient> request) { | 139 mojo::InterfaceRequest<mojo::ViewTreeClient> request) { |
| 140 mojo::ViewManager::Create(this, request.Pass()); | 140 mojo::ViewManager::Create(this, request.Pass()); |
| 141 } | 141 } |
| 142 | 142 |
| 143 //////////////////////////////////////////////////////////////////////////////// | 143 //////////////////////////////////////////////////////////////////////////////// |
| 144 // OmniboxImpl, Omnibox implementation: | 144 // OmniboxImpl, Omnibox implementation: |
| 145 | 145 |
| 146 void OmniboxImpl::ShowForURL(const mojo::String& url) { | 146 void OmniboxImpl::ShowForURL(const mojo::String& url) { |
| 147 url_ = url; | 147 url_ = url; |
| 148 if (root_) { | 148 if (root_) { |
| 149 ShowWindow(); | 149 ShowWindow(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 163 root_->SetFocus(); | 163 root_->SetFocus(); |
| 164 root_->MoveToFront(); | 164 root_->MoveToFront(); |
| 165 } | 165 } |
| 166 | 166 |
| 167 void OmniboxImpl::HideWindow() { | 167 void OmniboxImpl::HideWindow() { |
| 168 DCHECK(root_); | 168 DCHECK(root_); |
| 169 root_->SetVisible(false); | 169 root_->SetVisible(false); |
| 170 } | 170 } |
| 171 | 171 |
| 172 } // namespace mandoline | 172 } // namespace mandoline |
| OLD | NEW |