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
3 // found in the LICENSE file.
5 #ifndef MOJO_EXAMPLES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_
6 #define MOJO_EXAMPLES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_
8 #include "base/memory/weak_ptr.h"
9 #include "mojo/services/public/interfaces/network/url_loader.mojom.h"
10 #include "third_party/WebKit/public/web/WebFrameClient.h"
11 #include "third_party/WebKit/public/web/WebViewClient.h"
15 namespace view_manager {
23 // A view for a single HTML document.
24 class HTMLDocumentView : public blink::WebViewClient,
25 public blink::WebFrameClient {
27 explicit HTMLDocumentView(view_manager::ViewManager* view_manager);
28 virtual ~HTMLDocumentView();
30 void AttachToNode(view_manager::Node* node);
32 void Load(URLResponsePtr response,
33 ScopedDataPipeConsumerHandle response_body_stream);
36 // WebWidgetClient methods:
37 virtual void didInvalidateRect(const blink::WebRect& rect);
38 virtual bool allowsBrokenNullLayerTreeView() const;
40 // WebFrameClient methods:
41 virtual void didAddMessageToConsole(
42 const blink::WebConsoleMessage& message,
43 const blink::WebString& source_name,
45 const blink::WebString& stack_trace);
49 view_manager::ViewManager* view_manager_;
50 view_manager::View* view_;
51 blink::WebView* web_view_;
52 bool repaint_pending_;
54 base::WeakPtrFactory<HTMLDocumentView> weak_factory_;
56 DISALLOW_COPY_AND_ASSIGN(HTMLDocumentView);
59 } // namespace examples
62 #endif // MOJO_EXAMPLES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_