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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 //////////////////////////////////////////////////////////////////////////////// | 83 //////////////////////////////////////////////////////////////////////////////// |
84 // OmniboxApplication, mojo::ShellClient implementation: | 84 // OmniboxApplication, mojo::ShellClient implementation: |
85 | 85 |
86 void OmniboxApplication::Initialize(mojo::Shell* shell, const std::string& url, | 86 void OmniboxApplication::Initialize(mojo::Shell* shell, const std::string& url, |
87 uint32_t id) { | 87 uint32_t id) { |
88 shell_ = shell; | 88 shell_ = shell; |
89 tracing_.Initialize(shell, url); | 89 tracing_.Initialize(shell, url); |
90 } | 90 } |
91 | 91 |
92 bool OmniboxApplication::AcceptConnection(mojo::Connection* connection) { | 92 bool OmniboxApplication::AcceptConnection(mojo::Connection* connection) { |
93 connection->AddService<Omnibox>(this); | 93 connection->AddInterface<Omnibox>(this); |
94 return true; | 94 return true; |
95 } | 95 } |
96 | 96 |
97 //////////////////////////////////////////////////////////////////////////////// | 97 //////////////////////////////////////////////////////////////////////////////// |
98 // OmniboxApplication, mojo::InterfaceFactory<Omnibox> implementation: | 98 // OmniboxApplication, mojo::InterfaceFactory<Omnibox> implementation: |
99 | 99 |
100 void OmniboxApplication::Create(mojo::Connection* connection, | 100 void OmniboxApplication::Create(mojo::Connection* connection, |
101 mojo::InterfaceRequest<Omnibox> request) { | 101 mojo::InterfaceRequest<Omnibox> request) { |
102 new OmniboxImpl(shell_, connection, std::move(request)); | 102 new OmniboxImpl(shell_, connection, std::move(request)); |
103 } | 103 } |
104 | 104 |
105 //////////////////////////////////////////////////////////////////////////////// | 105 //////////////////////////////////////////////////////////////////////////////// |
106 // OmniboxImpl, public: | 106 // OmniboxImpl, public: |
107 | 107 |
108 OmniboxImpl::OmniboxImpl(mojo::Shell* shell, | 108 OmniboxImpl::OmniboxImpl(mojo::Shell* shell, |
109 mojo::Connection* connection, | 109 mojo::Connection* connection, |
110 mojo::InterfaceRequest<Omnibox> request) | 110 mojo::InterfaceRequest<Omnibox> request) |
111 : shell_(shell), | 111 : shell_(shell), |
112 root_(nullptr), | 112 root_(nullptr), |
113 edit_(nullptr), | 113 edit_(nullptr), |
114 binding_(this, std::move(request)) { | 114 binding_(this, std::move(request)) { |
115 connection->ConnectToService(&view_embedder_); | 115 connection->GetInterface(&view_embedder_); |
116 } | 116 } |
117 OmniboxImpl::~OmniboxImpl() {} | 117 OmniboxImpl::~OmniboxImpl() {} |
118 | 118 |
119 //////////////////////////////////////////////////////////////////////////////// | 119 //////////////////////////////////////////////////////////////////////////////// |
120 // OmniboxImpl, mus::WindowTreeDelegate implementation: | 120 // OmniboxImpl, mus::WindowTreeDelegate implementation: |
121 | 121 |
122 void OmniboxImpl::OnEmbed(mus::Window* root) { | 122 void OmniboxImpl::OnEmbed(mus::Window* root) { |
123 root_ = root; | 123 root_ = root; |
124 | 124 |
125 if (!aura_init_.get()) { | 125 if (!aura_init_.get()) { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 edit_->SelectAll(false); | 226 edit_->SelectAll(false); |
227 edit_->RequestFocus(); | 227 edit_->RequestFocus(); |
228 } | 228 } |
229 | 229 |
230 void OmniboxImpl::HideWindow() { | 230 void OmniboxImpl::HideWindow() { |
231 DCHECK(root_); | 231 DCHECK(root_); |
232 root_->SetVisible(false); | 232 root_->SetVisible(false); |
233 } | 233 } |
234 | 234 |
235 } // namespace mandoline | 235 } // namespace mandoline |
OLD | NEW |