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

Side by Side Diff: mojo/services/html_viewer/html_document_view.h

Issue 537843002: Expose NavigatorHost via Embed() rather than globally. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@viewman3
Patch Set: git cl format Created 6 years, 3 months 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
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 MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_ 5 #ifndef MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_
6 #define MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_ 6 #define MOJO_SERVICES_HTML_VIEWER_HTML_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/services/public/cpp/view_manager/view_manager_client_factory.h" 11 #include "mojo/services/public/cpp/view_manager/view_manager_client_factory.h"
11 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" 12 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h"
12 #include "mojo/services/public/cpp/view_manager/view_observer.h" 13 #include "mojo/services/public/cpp/view_manager/view_observer.h"
13 #include "mojo/services/public/interfaces/content_handler/content_handler.mojom. h" 14 #include "mojo/services/public/interfaces/content_handler/content_handler.mojom. h"
14 #include "mojo/services/public/interfaces/navigation/navigation.mojom.h" 15 #include "mojo/services/public/interfaces/navigation/navigation.mojom.h"
15 #include "mojo/services/public/interfaces/network/url_loader.mojom.h" 16 #include "mojo/services/public/interfaces/network/url_loader.mojom.h"
16 #include "third_party/WebKit/public/web/WebFrameClient.h" 17 #include "third_party/WebKit/public/web/WebFrameClient.h"
17 #include "third_party/WebKit/public/web/WebViewClient.h" 18 #include "third_party/WebKit/public/web/WebViewClient.h"
18 19
19 namespace mojo { 20 namespace mojo {
20 21
21 class ViewManager; 22 class ViewManager;
22 class View; 23 class View;
23 24
24 // A view for a single HTML document. 25 // A view for a single HTML document.
25 class HTMLDocumentView : public blink::WebViewClient, 26 class HTMLDocumentView : public blink::WebViewClient,
26 public blink::WebFrameClient, 27 public blink::WebFrameClient,
27 public ViewManagerDelegate, 28 public ViewManagerDelegate,
28 public ViewObserver { 29 public ViewObserver {
29 public: 30 public:
30 // Load a new HTMLDocument with |response|. 31 // Load a new HTMLDocument with |response|.
31 // 32 //
32 // |imported_from_connector| is used to request services of the connecting 33 // |service_provider_request| should be used to implement a
33 // application (e.g., the application that called 34 // ServiceProvider which exposes services to the connecting application.
34 // Shell::ConnectToApplication()). 35 // Commonly, the connecting application is the ViewManager and it will
35 // 36 // request ViewManagerClient.
36 // |exported_to_connector| is used to export services from this
37 // HTMLDocumentView to the connecting application.
38 // 37 //
39 // |shell| is the Shell connection for this mojo::Application. 38 // |shell| is the Shell connection for this mojo::Application.
40 HTMLDocumentView(URLResponsePtr response, 39 HTMLDocumentView(URLResponsePtr response,
41 scoped_ptr<ServiceProvider> imported_from_connector, 40 InterfaceRequest<ServiceProvider> service_provider_request,
42 ServiceProviderImpl* exported_to_connector,
43 Shell* shell); 41 Shell* shell);
44 virtual ~HTMLDocumentView(); 42 virtual ~HTMLDocumentView();
45 43
46 private: 44 private:
47 // WebViewClient methods: 45 // WebViewClient methods:
48 virtual blink::WebStorageNamespace* createSessionStorageNamespace(); 46 virtual blink::WebStorageNamespace* createSessionStorageNamespace();
49 47
50 // WebWidgetClient methods: 48 // WebWidgetClient methods:
51 virtual void didInvalidateRect(const blink::WebRect& rect); 49 virtual void didInvalidateRect(const blink::WebRect& rect);
52 virtual bool allowsBrokenNullLayerTreeView() const; 50 virtual bool allowsBrokenNullLayerTreeView() const;
(...skipping 14 matching lines...) Expand all
67 const blink::WebString& stack_trace); 65 const blink::WebString& stack_trace);
68 virtual void didNavigateWithinPage( 66 virtual void didNavigateWithinPage(
69 blink::WebLocalFrame* frame, 67 blink::WebLocalFrame* frame,
70 const blink::WebHistoryItem& history_item, 68 const blink::WebHistoryItem& history_item,
71 blink::WebHistoryCommitType commit_type); 69 blink::WebHistoryCommitType commit_type);
72 70
73 // ViewManagerDelegate methods: 71 // ViewManagerDelegate methods:
74 virtual void OnEmbed( 72 virtual void OnEmbed(
75 ViewManager* view_manager, 73 ViewManager* view_manager,
76 View* root, 74 View* root,
77 ServiceProviderImpl* exported_to_embedder, 75 ServiceProviderImpl* embedee_service_provider_impl,
78 scoped_ptr<ServiceProvider> exported_from_embedder) OVERRIDE; 76 scoped_ptr<ServiceProvider> embedder_service_provider) OVERRIDE;
79 virtual void OnViewManagerDisconnected(ViewManager* view_manager) OVERRIDE; 77 virtual void OnViewManagerDisconnected(ViewManager* view_manager) OVERRIDE;
80 78
81 // ViewObserver methods: 79 // ViewObserver methods:
82 virtual void OnViewBoundsChanged(View* view, 80 virtual void OnViewBoundsChanged(View* view,
83 const gfx::Rect& old_bounds, 81 const gfx::Rect& old_bounds,
84 const gfx::Rect& new_bounds) OVERRIDE; 82 const gfx::Rect& new_bounds) OVERRIDE;
85 virtual void OnViewDestroyed(View* view) OVERRIDE; 83 virtual void OnViewDestroyed(View* view) OVERRIDE;
86 virtual void OnViewInputEvent(View* view, const EventPtr& event) OVERRIDE; 84 virtual void OnViewInputEvent(View* view, const EventPtr& event) OVERRIDE;
87 85
88 void Load(URLResponsePtr response); 86 void Load(URLResponsePtr response);
89 void Repaint(); 87 void Repaint();
90 NavigatorHost* GetNavigatorHost();
91 88
92 URLResponsePtr response_; 89 URLResponsePtr response_;
93 scoped_ptr<ServiceProvider> imported_services_; 90 scoped_ptr<ServiceProvider> embedder_service_provider_;
94 Shell* shell_; 91 Shell* shell_;
95 InterfacePtr<NavigatorHost> navigator_host_; 92 LazyInterfacePtr<NavigatorHost> navigator_host_;
96 blink::WebView* web_view_; 93 blink::WebView* web_view_;
97 View* root_; 94 View* root_;
98 ViewManagerClientFactory view_manager_client_factory_; 95 ViewManagerClientFactory view_manager_client_factory_;
99 bool repaint_pending_; 96 bool repaint_pending_;
100 97
101 base::WeakPtrFactory<HTMLDocumentView> weak_factory_; 98 base::WeakPtrFactory<HTMLDocumentView> weak_factory_;
102 DISALLOW_COPY_AND_ASSIGN(HTMLDocumentView); 99 DISALLOW_COPY_AND_ASSIGN(HTMLDocumentView);
103 }; 100 };
104 101
105 } // namespace mojo 102 } // namespace mojo
106 103
107 #endif // MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_ 104 #endif // MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698