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