OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MANDOLINE_UI_OMNIBOX_OMNIBOX_IMPL_H_ |
| 6 #define MANDOLINE_UI_OMNIBOX_OMNIBOX_IMPL_H_ |
| 7 |
| 8 #include "components/view_manager/public/cpp/view_manager_delegate.h" |
| 9 #include "mandoline/ui/browser/omnibox.mojom.h" |
| 10 #include "mojo/common/weak_binding_set.h" |
| 11 #include "third_party/mojo/src/mojo/public/cpp/application/application_delegate.
h" |
| 12 #include "third_party/mojo/src/mojo/public/cpp/application/interface_factory.h" |
| 13 #include "ui/views/controls/textfield/textfield_controller.h" |
| 14 #include "ui/views/layout/layout_manager.h" |
| 15 |
| 16 namespace mojo { |
| 17 class ViewManagerClientFactory; |
| 18 } |
| 19 |
| 20 namespace mandoline { |
| 21 |
| 22 class AuraInit; |
| 23 |
| 24 class OmniboxImpl : public mojo::ApplicationDelegate, |
| 25 public mojo::ViewManagerDelegate, |
| 26 public views::LayoutManager, |
| 27 public views::TextfieldController, |
| 28 public mojo::InterfaceFactory<Omnibox>, |
| 29 public Omnibox { |
| 30 public: |
| 31 OmniboxImpl(); |
| 32 ~OmniboxImpl() override; |
| 33 |
| 34 private: |
| 35 // Overridden from mojo::ApplicationDelegate: |
| 36 void Initialize(mojo::ApplicationImpl* app) override; |
| 37 bool ConfigureIncomingConnection( |
| 38 mojo::ApplicationConnection* connection) override; |
| 39 bool ConfigureOutgoingConnection( |
| 40 mojo::ApplicationConnection* connection) override; |
| 41 |
| 42 // Overridden from mojo::ViewManagerDelegate: |
| 43 void OnEmbed(mojo::View* root, |
| 44 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 45 mojo::ServiceProviderPtr exposed_services) override; |
| 46 void OnViewManagerDisconnected(mojo::ViewManager* view_manager) override; |
| 47 |
| 48 // Overridden from views::LayoutManager: |
| 49 gfx::Size GetPreferredSize(const views::View* view) const override; |
| 50 void Layout(views::View* host) override; |
| 51 |
| 52 // Overridden from views::TextfieldController: |
| 53 bool HandleKeyEvent(views::Textfield* sender, |
| 54 const ui::KeyEvent& key_event) override; |
| 55 |
| 56 // InterfaceFactory<WindowManager>: |
| 57 void Create(mojo::ApplicationConnection* connection, |
| 58 mojo::InterfaceRequest<Omnibox> request) override; |
| 59 |
| 60 // Overridden from Omnibox: |
| 61 void SetClient(OmniboxClientPtr client) override; |
| 62 void ShowForURL(const mojo::String& url) override; |
| 63 |
| 64 OmniboxClientPtr client_; |
| 65 scoped_ptr<AuraInit> aura_init_; |
| 66 mojo::ApplicationImpl* app_impl_; |
| 67 mojo::String url_; |
| 68 views::Textfield* edit_; |
| 69 mojo::WeakBindingSet<Omnibox> bindings_; |
| 70 scoped_ptr<mojo::ViewManagerClientFactory> view_manager_client_factory_; |
| 71 |
| 72 DISALLOW_COPY_AND_ASSIGN(OmniboxImpl); |
| 73 }; |
| 74 |
| 75 } // namespace mandoline |
| 76 |
| 77 #endif // MANDOLINE_UI_OMNIBOX_OMNIBOX_IMPL_H_ |
OLD | NEW |