Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: sky/viewer/document_view.h

Issue 687273002: mojo: Update content handler API (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Add missing comment Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/viewer/content_handler_impl.cc ('k') | sky/viewer/document_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 SKY_VIEWER_DOCUMENT_VIEW_H_ 5 #ifndef SKY_VIEWER_DOCUMENT_VIEW_H_
6 #define SKY_VIEWER_DOCUMENT_VIEW_H_ 6 #define SKY_VIEWER_DOCUMENT_VIEW_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "mojo/public/cpp/application/lazy_interface_ptr.h" 10 #include "mojo/public/cpp/application/lazy_interface_ptr.h"
11 #include "mojo/public/cpp/application/service_provider_impl.h"
12 #include "mojo/public/cpp/bindings/interface_impl.h"
13 #include "mojo/public/interfaces/application/application.mojom.h"
11 #include "mojo/services/public/cpp/view_manager/view_manager_client_factory.h" 14 #include "mojo/services/public/cpp/view_manager/view_manager_client_factory.h"
12 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" 15 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h"
13 #include "mojo/services/public/cpp/view_manager/view_observer.h" 16 #include "mojo/services/public/cpp/view_manager/view_observer.h"
14 #include "mojo/services/public/interfaces/content_handler/content_handler.mojom. h" 17 #include "mojo/services/public/interfaces/content_handler/content_handler.mojom. h"
15 #include "mojo/services/public/interfaces/navigation/navigation.mojom.h" 18 #include "mojo/services/public/interfaces/navigation/navigation.mojom.h"
16 #include "mojo/services/public/interfaces/network/url_loader.mojom.h" 19 #include "mojo/services/public/interfaces/network/url_loader.mojom.h"
17 #include "sky/engine/public/web/WebFrameClient.h" 20 #include "sky/engine/public/web/WebFrameClient.h"
18 #include "sky/engine/public/web/WebViewClient.h" 21 #include "sky/engine/public/web/WebViewClient.h"
19 #include "sky/viewer/services/inspector_impl.h" 22 #include "sky/viewer/services/inspector_impl.h"
20 23
21 namespace base { 24 namespace base {
22 class MessageLoopProxy; 25 class MessageLoopProxy;
23 } 26 }
24 27
25 namespace mojo { 28 namespace mojo {
26 class ViewManager; 29 class ViewManager;
27 class View; 30 class View;
28 } 31 }
29 32
30 namespace sky { 33 namespace sky {
31 class ScriptRunner; 34 class ScriptRunner;
32 class WebLayerTreeViewImpl; 35 class WebLayerTreeViewImpl;
33 36
34 class DocumentView : public blink::WebViewClient, 37 class DocumentView : public mojo::InterfaceImpl<mojo::Application>,
38 public blink::WebViewClient,
35 public blink::WebFrameClient, 39 public blink::WebFrameClient,
36 public mojo::ViewManagerDelegate, 40 public mojo::ViewManagerDelegate,
37 public mojo::ViewObserver { 41 public mojo::ViewObserver {
38 public: 42 public:
39 // Load a new HTMLDocument with |response|. 43 // Load a new HTMLDocument with |response|.
40 // 44 //
41 // |sp_request| should be used to implement a
42 // ServiceProvider which exposes services to the connecting application.
43 // Commonly, the connecting application is the ViewManager and it will
44 // request ViewManagerClient.
45 //
46 // |shell| is the Shell connection for this mojo::Application. 45 // |shell| is the Shell connection for this mojo::Application.
47 DocumentView(mojo::URLResponsePtr response, 46 DocumentView(mojo::URLResponsePtr response,
48 mojo::InterfaceRequest<mojo::ServiceProvider> sp_request, 47 mojo::ShellPtr shell,
49 mojo::Shell* shell,
50 scoped_refptr<base::MessageLoopProxy> compositor_thread); 48 scoped_refptr<base::MessageLoopProxy> compositor_thread);
51 virtual ~DocumentView(); 49 virtual ~DocumentView();
52 50
53 base::WeakPtr<DocumentView> GetWeakPtr(); 51 base::WeakPtr<DocumentView> GetWeakPtr();
54 52
55 blink::WebView* web_view() const { return web_view_; } 53 blink::WebView* web_view() const { return web_view_; }
56 mojo::ServiceProvider* imported_services() const { 54 mojo::ServiceProvider* imported_services() const {
57 return imported_services_.get(); 55 return imported_services_.get();
58 } 56 }
59 57
60 mojo::Shell* shell() const { return shell_; } 58 mojo::Shell* shell() const { return shell_.get(); }
61 59
62 private: 60 private:
61 // Application methods:
62 void AcceptConnection(const mojo::String& requestor_url,
63 mojo::ServiceProviderPtr provider) override;
64 void Initialize(mojo::Array<mojo::String> args) override;
65
63 // WebWidgetClient methods: 66 // WebWidgetClient methods:
64 virtual blink::WebLayerTreeView* initializeLayerTreeView(); 67 virtual blink::WebLayerTreeView* initializeLayerTreeView();
65 68
66 // WebFrameClient methods: 69 // WebFrameClient methods:
67 virtual void frameDetached(blink::WebFrame*); 70 virtual void frameDetached(blink::WebFrame*);
68 virtual blink::WebNavigationPolicy decidePolicyForNavigation( 71 virtual blink::WebNavigationPolicy decidePolicyForNavigation(
69 const blink::WebFrameClient::NavigationPolicyInfo& info); 72 const blink::WebFrameClient::NavigationPolicyInfo& info);
70 virtual void didAddMessageToConsole( 73 virtual void didAddMessageToConsole(
71 const blink::WebConsoleMessage& message, 74 const blink::WebConsoleMessage& message,
72 const blink::WebString& source_name, 75 const blink::WebString& source_name,
(...skipping 13 matching lines...) Expand all
86 // ViewObserver methods: 89 // ViewObserver methods:
87 virtual void OnViewBoundsChanged(mojo::View* view, 90 virtual void OnViewBoundsChanged(mojo::View* view,
88 const mojo::Rect& old_bounds, 91 const mojo::Rect& old_bounds,
89 const mojo::Rect& new_bounds) override; 92 const mojo::Rect& new_bounds) override;
90 virtual void OnViewDestroyed(mojo::View* view) override; 93 virtual void OnViewDestroyed(mojo::View* view) override;
91 virtual void OnViewInputEvent(mojo::View* view, const mojo::EventPtr& event) o verride; 94 virtual void OnViewInputEvent(mojo::View* view, const mojo::EventPtr& event) o verride;
92 95
93 void Load(mojo::URLResponsePtr response); 96 void Load(mojo::URLResponsePtr response);
94 97
95 mojo::URLResponsePtr response_; 98 mojo::URLResponsePtr response_;
99 mojo::ServiceProviderImpl exported_services_;
96 scoped_ptr<mojo::ServiceProvider> imported_services_; 100 scoped_ptr<mojo::ServiceProvider> imported_services_;
97 mojo::Shell* shell_; 101 mojo::ShellPtr shell_;
98 mojo::LazyInterfacePtr<mojo::NavigatorHost> navigator_host_; 102 mojo::LazyInterfacePtr<mojo::NavigatorHost> navigator_host_;
99 blink::WebView* web_view_; 103 blink::WebView* web_view_;
100 mojo::View* root_; 104 mojo::View* root_;
101 mojo::ViewManagerClientFactory view_manager_client_factory_; 105 mojo::ViewManagerClientFactory view_manager_client_factory_;
102 InspectorServiceFactory inspector_service_factory_; 106 InspectorServiceFactory inspector_service_factory_;
103 scoped_ptr<WebLayerTreeViewImpl> web_layer_tree_view_impl_; 107 scoped_ptr<WebLayerTreeViewImpl> web_layer_tree_view_impl_;
104 scoped_refptr<base::MessageLoopProxy> compositor_thread_; 108 scoped_refptr<base::MessageLoopProxy> compositor_thread_;
105 scoped_ptr<ScriptRunner> script_runner_; 109 scoped_ptr<ScriptRunner> script_runner_;
106 110
107 base::WeakPtrFactory<DocumentView> weak_factory_; 111 base::WeakPtrFactory<DocumentView> weak_factory_;
108 DISALLOW_COPY_AND_ASSIGN(DocumentView); 112 DISALLOW_COPY_AND_ASSIGN(DocumentView);
109 }; 113 };
110 114
111 } // namespace sky 115 } // namespace sky
112 116
113 #endif // SKY_VIEWER_DOCUMENT_VIEW_H_ 117 #endif // SKY_VIEWER_DOCUMENT_VIEW_H_
OLDNEW
« no previous file with comments | « sky/viewer/content_handler_impl.cc ('k') | sky/viewer/document_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698