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> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
12 #include "content/public/browser/notification_registrar.h" | 12 #include "content/public/browser/notification_registrar.h" |
13 #include "content/public/browser/web_contents_delegate.h" | 13 #include "content/public/browser/web_contents_delegate.h" |
14 #include "mojo/public/cpp/bindings/binding_set.h" | 14 #include "mojo/public/cpp/bindings/binding_set.h" |
15 #include "mojo/public/cpp/bindings/strong_binding.h" | |
16 #include "services/navigation/public/interfaces/view.mojom.h" | 15 #include "services/navigation/public/interfaces/view.mojom.h" |
17 #include "services/shell/public/cpp/interface_factory.h" | 16 #include "services/shell/public/cpp/interface_factory.h" |
18 #include "services/shell/public/cpp/service.h" | 17 #include "services/shell/public/cpp/service.h" |
19 #include "services/shell/public/cpp/service_context_ref.h" | 18 #include "services/shell/public/cpp/service_context_ref.h" |
20 #include "services/ui/public/cpp/window_tree_client_delegate.h" | 19 #include "services/ui/public/cpp/window_tree_client_delegate.h" |
21 #include "ui/gfx/geometry/size.h" | 20 #include "ui/gfx/geometry/size.h" |
22 #include "ui/views/widget/widget_delegate.h" | 21 #include "ui/views/widget/widget_delegate.h" |
23 | 22 |
24 namespace views { | 23 namespace views { |
25 class WebView; | 24 class WebView; |
26 class Widget; | 25 class Widget; |
27 } | 26 } |
28 | 27 |
29 namespace navigation { | 28 namespace navigation { |
30 | 29 |
31 class ViewImpl : public mojom::View, | 30 class ViewImpl : public mojom::View, |
32 public content::WebContentsDelegate, | 31 public content::WebContentsDelegate, |
33 public content::NotificationObserver, | 32 public content::NotificationObserver, |
34 public ui::WindowTreeClientDelegate, | 33 public ui::WindowTreeClientDelegate, |
35 public views::WidgetDelegate { | 34 public views::WidgetDelegate { |
36 public: | 35 public: |
37 ViewImpl(std::unique_ptr<shell::Connector> connector, | 36 ViewImpl(std::unique_ptr<shell::Connector> connector, |
38 const std::string& client_user_id, | 37 const std::string& client_user_id, |
39 mojom::ViewClientPtr client, | 38 mojom::ViewClientPtr client, |
40 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; |
48 void GoForward() override; | 46 void GoForward() override; |
49 void NavigateToOffset(int offset) override; | 47 void NavigateToOffset(int offset) override; |
50 void Reload(bool skip_cache) override; | 48 void Reload(bool skip_cache) override; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 void OnLostConnection(ui::WindowTreeClient* client) override; | 83 void OnLostConnection(ui::WindowTreeClient* client) override; |
86 void OnPointerEventObserved(const ui::PointerEvent& event, | 84 void OnPointerEventObserved(const ui::PointerEvent& event, |
87 ui::Window* target) override; | 85 ui::Window* target) override; |
88 | 86 |
89 // views::WidgetDelegate: | 87 // views::WidgetDelegate: |
90 views::View* GetContentsView() override; | 88 views::View* GetContentsView() override; |
91 views::Widget* GetWidget() override; | 89 views::Widget* GetWidget() override; |
92 const views::Widget* GetWidget() const override; | 90 const views::Widget* GetWidget() const override; |
93 | 91 |
94 std::unique_ptr<shell::Connector> connector_; | 92 std::unique_ptr<shell::Connector> connector_; |
95 mojo::StrongBinding<mojom::View> binding_; | |
96 mojom::ViewClientPtr client_; | 93 mojom::ViewClientPtr client_; |
97 std::unique_ptr<shell::ServiceContextRef> ref_; | 94 std::unique_ptr<shell::ServiceContextRef> ref_; |
98 | 95 |
99 std::unique_ptr<ui::WindowTreeClient> window_tree_client_; | 96 std::unique_ptr<ui::WindowTreeClient> window_tree_client_; |
100 | 97 |
101 views::WebView* web_view_; | 98 views::WebView* web_view_; |
102 | 99 |
103 std::unique_ptr<content::WebContents> web_contents_; | 100 std::unique_ptr<content::WebContents> web_contents_; |
104 | 101 |
105 content::NotificationRegistrar registrar_; | 102 content::NotificationRegistrar registrar_; |
106 | 103 |
107 std::unique_ptr<views::Widget> widget_; | 104 std::unique_ptr<views::Widget> widget_; |
108 | 105 |
109 gfx::Size resizer_size_; | 106 gfx::Size resizer_size_; |
110 | 107 |
111 DISALLOW_COPY_AND_ASSIGN(ViewImpl); | 108 DISALLOW_COPY_AND_ASSIGN(ViewImpl); |
112 }; | 109 }; |
113 | 110 |
114 } // navigation | 111 } // navigation |
115 | 112 |
116 #endif // SERVICES_NAVIGATION_VIEW_IMPL_H_ | 113 #endif // SERVICES_NAVIGATION_VIEW_IMPL_H_ |
OLD | NEW |