| 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" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 // Overridden from views::LayoutManager: | 45 // Overridden from views::LayoutManager: |
| 46 gfx::Size GetPreferredSize(const views::View* view) const override; | 46 gfx::Size GetPreferredSize(const views::View* view) const override; |
| 47 void Layout(views::View* host) override; | 47 void Layout(views::View* host) override; |
| 48 | 48 |
| 49 // Overridden from views::TextfieldController: | 49 // Overridden from views::TextfieldController: |
| 50 bool HandleKeyEvent(views::Textfield* sender, | 50 bool HandleKeyEvent(views::Textfield* sender, |
| 51 const ui::KeyEvent& key_event) override; | 51 const ui::KeyEvent& key_event) override; |
| 52 | 52 |
| 53 // Overridden from Omnibox: | 53 // Overridden from Omnibox: |
| 54 void GetViewTreeClient( | 54 void GetWindowTreeClient( |
| 55 mojo::InterfaceRequest<mojo::ViewTreeClient> request) override; | 55 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request) override; |
| 56 void ShowForURL(const mojo::String& url) override; | 56 void ShowForURL(const mojo::String& url) override; |
| 57 | 57 |
| 58 void HideWindow(); | 58 void HideWindow(); |
| 59 void ShowWindow(); | 59 void ShowWindow(); |
| 60 | 60 |
| 61 scoped_ptr<views::AuraInit> aura_init_; | 61 scoped_ptr<views::AuraInit> aura_init_; |
| 62 mojo::ApplicationImpl* app_; | 62 mojo::ApplicationImpl* app_; |
| 63 mus::Window* root_; | 63 mus::Window* root_; |
| 64 mojo::String url_; | 64 mojo::String url_; |
| 65 views::Textfield* edit_; | 65 views::Textfield* edit_; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 view_embedder_->Embed(request.Pass()); | 182 view_embedder_->Embed(request.Pass()); |
| 183 HideWindow(); | 183 HideWindow(); |
| 184 return true; | 184 return true; |
| 185 } | 185 } |
| 186 return false; | 186 return false; |
| 187 } | 187 } |
| 188 | 188 |
| 189 //////////////////////////////////////////////////////////////////////////////// | 189 //////////////////////////////////////////////////////////////////////////////// |
| 190 // OmniboxImpl, Omnibox implementation: | 190 // OmniboxImpl, Omnibox implementation: |
| 191 | 191 |
| 192 void OmniboxImpl::GetViewTreeClient( | 192 void OmniboxImpl::GetWindowTreeClient( |
| 193 mojo::InterfaceRequest<mojo::ViewTreeClient> request) { | 193 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request) { |
| 194 mus::WindowTreeConnection::Create( | 194 mus::WindowTreeConnection::Create( |
| 195 this, request.Pass(), | 195 this, request.Pass(), |
| 196 mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); | 196 mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); |
| 197 } | 197 } |
| 198 | 198 |
| 199 void OmniboxImpl::ShowForURL(const mojo::String& url) { | 199 void OmniboxImpl::ShowForURL(const mojo::String& url) { |
| 200 url_ = url; | 200 url_ = url; |
| 201 if (root_) { | 201 if (root_) { |
| 202 ShowWindow(); | 202 ShowWindow(); |
| 203 } else { | 203 } else { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 219 edit_->SelectAll(false); | 219 edit_->SelectAll(false); |
| 220 edit_->RequestFocus(); | 220 edit_->RequestFocus(); |
| 221 } | 221 } |
| 222 | 222 |
| 223 void OmniboxImpl::HideWindow() { | 223 void OmniboxImpl::HideWindow() { |
| 224 DCHECK(root_); | 224 DCHECK(root_); |
| 225 root_->SetVisible(false); | 225 root_->SetVisible(false); |
| 226 } | 226 } |
| 227 | 227 |
| 228 } // namespace mandoline | 228 } // namespace mandoline |
| OLD | NEW |