OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 SERVICES_NAVIGATION_VIEW_IMPL_H_ | 5 #ifndef SERVICES_NAVIGATION_VIEW_IMPL_H_ |
6 #define SERVICES_NAVIGATION_VIEW_IMPL_H_ | 6 #define SERVICES_NAVIGATION_VIEW_IMPL_H_ |
7 | 7 |
8 #include <memory> | |
9 | |
10 #include "base/macros.h" | 8 #include "base/macros.h" |
11 #include "content/public/browser/notification_observer.h" | 9 #include "content/public/browser/notification_observer.h" |
12 #include "content/public/browser/notification_registrar.h" | 10 #include "content/public/browser/notification_registrar.h" |
13 #include "content/public/browser/web_contents_delegate.h" | 11 #include "content/public/browser/web_contents_delegate.h" |
14 #include "mojo/public/cpp/bindings/binding_set.h" | 12 #include "mojo/public/cpp/bindings/binding_set.h" |
15 #include "mojo/public/cpp/bindings/strong_binding.h" | 13 #include "mojo/public/cpp/bindings/strong_binding.h" |
16 #include "services/navigation/public/interfaces/view.mojom.h" | 14 #include "services/navigation/public/interfaces/view.mojom.h" |
17 #include "services/shell/public/cpp/interface_factory.h" | 15 #include "services/shell/public/cpp/interface_factory.h" |
18 #include "services/shell/public/cpp/service.h" | 16 #include "services/shell/public/cpp/service.h" |
19 #include "services/shell/public/cpp/service_context_ref.h" | 17 #include "services/shell/public/cpp/service_context_ref.h" |
20 #include "services/ui/public/cpp/window_tree_client_delegate.h" | 18 #include "services/ui/public/cpp/window_tree_client_delegate.h" |
21 #include "ui/gfx/geometry/size.h" | 19 #include "ui/gfx/geometry/size.h" |
22 #include "ui/views/widget/widget_delegate.h" | 20 #include "ui/views/widget/widget_delegate.h" |
23 | 21 |
24 namespace views { | 22 namespace views { |
25 class WebView; | 23 class WebView; |
26 class Widget; | 24 class Widget; |
27 } | 25 } |
28 | 26 |
29 namespace navigation { | 27 namespace navigation { |
30 | 28 |
31 class ViewImpl : public mojom::View, | 29 class ViewImpl : public mojom::View, |
32 public content::WebContentsDelegate, | 30 public content::WebContentsDelegate, |
33 public content::NotificationObserver, | 31 public content::NotificationObserver, |
34 public ui::WindowTreeClientDelegate, | 32 public ui::WindowTreeClientDelegate, |
35 public views::WidgetDelegate { | 33 public views::WidgetDelegate { |
36 public: | 34 public: |
37 ViewImpl(std::unique_ptr<shell::Connector> connector, | 35 ViewImpl(shell::Connector* connector, |
38 const std::string& client_user_id, | 36 const std::string& client_user_id, |
39 mojom::ViewClientPtr client, | 37 mojom::ViewClientPtr client, |
40 mojom::ViewRequest request, | 38 mojom::ViewRequest request, |
41 std::unique_ptr<shell::ServiceContextRef> ref); | 39 std::unique_ptr<shell::ServiceContextRef> ref); |
42 ~ViewImpl() override; | 40 ~ViewImpl() override; |
43 | 41 |
44 private: | 42 private: |
45 // mojom::View: | 43 // mojom::View: |
46 void NavigateTo(const GURL& url) override; | 44 void NavigateTo(const GURL& url) override; |
47 void GoBack() override; | 45 void GoBack() override; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // ui::WindowTreeClientDelegate: | 80 // ui::WindowTreeClientDelegate: |
83 void OnEmbed(ui::Window* root) override; | 81 void OnEmbed(ui::Window* root) override; |
84 void OnDidDestroyClient(ui::WindowTreeClient* client) override; | 82 void OnDidDestroyClient(ui::WindowTreeClient* client) override; |
85 void OnEventObserved(const ui::Event& event, ui::Window* target) override; | 83 void OnEventObserved(const ui::Event& event, ui::Window* target) override; |
86 | 84 |
87 // views::WidgetDelegate: | 85 // views::WidgetDelegate: |
88 views::View* GetContentsView() override; | 86 views::View* GetContentsView() override; |
89 views::Widget* GetWidget() override; | 87 views::Widget* GetWidget() override; |
90 const views::Widget* GetWidget() const override; | 88 const views::Widget* GetWidget() const override; |
91 | 89 |
92 std::unique_ptr<shell::Connector> connector_; | 90 shell::Connector* connector_; |
93 mojo::StrongBinding<mojom::View> binding_; | 91 mojo::StrongBinding<mojom::View> binding_; |
94 mojom::ViewClientPtr client_; | 92 mojom::ViewClientPtr client_; |
95 std::unique_ptr<shell::ServiceContextRef> ref_; | 93 std::unique_ptr<shell::ServiceContextRef> ref_; |
96 | 94 |
97 views::WebView* web_view_; | 95 views::WebView* web_view_; |
98 | 96 |
99 std::unique_ptr<content::WebContents> web_contents_; | 97 std::unique_ptr<content::WebContents> web_contents_; |
100 | 98 |
101 content::NotificationRegistrar registrar_; | 99 content::NotificationRegistrar registrar_; |
102 | 100 |
103 std::unique_ptr<views::Widget> widget_; | 101 std::unique_ptr<views::Widget> widget_; |
104 | 102 |
105 gfx::Size resizer_size_; | 103 gfx::Size resizer_size_; |
106 | 104 |
107 DISALLOW_COPY_AND_ASSIGN(ViewImpl); | 105 DISALLOW_COPY_AND_ASSIGN(ViewImpl); |
108 }; | 106 }; |
109 | 107 |
110 } // navigation | 108 } // navigation |
111 | 109 |
112 #endif // SERVICES_NAVIGATION_VIEW_IMPL_H_ | 110 #endif // SERVICES_NAVIGATION_VIEW_IMPL_H_ |
OLD | NEW |