Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_EXAMPLES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_ | 5 #ifndef MOJO_EXAMPLES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_ |
| 6 #define MOJO_EXAMPLES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_ | 6 #define MOJO_EXAMPLES_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/public/cpp/application/lazy_interface_ptr.h" |
| 11 #include "mojo/public/interfaces/service_provider/service_provider.mojom.h" | 11 #include "mojo/public/interfaces/service_provider/service_provider.mojom.h" |
| 12 #include "mojo/services/public/cpp/view_manager/node_observer.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/navigation/navigation.mojom.h" | 14 #include "mojo/services/public/interfaces/navigation/navigation.mojom.h" |
| 14 #include "mojo/services/public/interfaces/network/url_loader.mojom.h" | 15 #include "mojo/services/public/interfaces/network/url_loader.mojom.h" |
| 15 #include "third_party/WebKit/public/web/WebFrameClient.h" | 16 #include "third_party/WebKit/public/web/WebFrameClient.h" |
| 16 #include "third_party/WebKit/public/web/WebViewClient.h" | 17 #include "third_party/WebKit/public/web/WebViewClient.h" |
| 17 | 18 |
| 18 namespace mojo { | 19 namespace mojo { |
| 19 | 20 |
| 20 namespace view_manager { | 21 namespace view_manager { |
| 21 class Node; | 22 class Node; |
| 22 class ViewManager; | 23 class ViewManager; |
| 23 class View; | 24 class View; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace examples { | 27 namespace examples { |
| 27 | 28 |
| 28 // A view for a single HTML document. | 29 // A view for a single HTML document. |
| 29 class HTMLDocumentView : public blink::WebViewClient, | 30 class HTMLDocumentView : public blink::WebViewClient, |
| 30 public blink::WebFrameClient, | 31 public blink::WebFrameClient, |
| 31 public view_manager::ViewObserver { | 32 public view_manager::ViewObserver, |
| 33 public view_manager::NodeObserver { | |
| 32 public: | 34 public: |
| 33 HTMLDocumentView(ServiceProvider* service_provider, | 35 HTMLDocumentView(ServiceProvider* service_provider, |
| 34 view_manager::ViewManager* view_manager); | 36 view_manager::ViewManager* view_manager); |
| 35 virtual ~HTMLDocumentView(); | 37 virtual ~HTMLDocumentView(); |
| 36 | 38 |
| 37 void AttachToNode(view_manager::Node* node); | 39 void AttachToNode(view_manager::Node* node); |
| 38 | 40 |
| 39 void Load(URLResponsePtr response); | 41 void Load(URLResponsePtr response); |
| 40 | 42 |
| 41 private: | 43 private: |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 58 const blink::WebString& stack_trace) OVERRIDE; | 60 const blink::WebString& stack_trace) OVERRIDE; |
| 59 virtual void didNavigateWithinPage( | 61 virtual void didNavigateWithinPage( |
| 60 blink::WebLocalFrame* frame, | 62 blink::WebLocalFrame* frame, |
| 61 const blink::WebHistoryItem& history_item, | 63 const blink::WebHistoryItem& history_item, |
| 62 blink::WebHistoryCommitType commit_type) OVERRIDE; | 64 blink::WebHistoryCommitType commit_type) OVERRIDE; |
| 63 | 65 |
| 64 // ViewObserver methods: | 66 // ViewObserver methods: |
| 65 virtual void OnViewInputEvent(view_manager::View* view, | 67 virtual void OnViewInputEvent(view_manager::View* view, |
| 66 const EventPtr& event) OVERRIDE; | 68 const EventPtr& event) OVERRIDE; |
| 67 | 69 |
| 70 // NodeObserver methods: | |
| 71 virtual void OnNodeBoundsChanged(view_manager::Node* node, | |
| 72 const gfx::Rect&, | |
|
sky
2014/07/14 19:15:27
Google C++ style is to always have names for argum
hansmuller
2014/07/14 22:16:42
Done.
| |
| 73 const gfx::Rect&) OVERRIDE; | |
| 74 | |
| 68 void Repaint(); | 75 void Repaint(); |
| 69 | 76 |
| 70 view_manager::ViewManager* view_manager_; | 77 view_manager::ViewManager* view_manager_; |
| 71 view_manager::View* view_; | 78 view_manager::View* view_; |
| 72 blink::WebView* web_view_; | 79 blink::WebView* web_view_; |
| 73 bool repaint_pending_; | 80 bool repaint_pending_; |
| 74 LazyInterfacePtr<navigation::NavigatorHost> navigator_host_; | 81 LazyInterfacePtr<navigation::NavigatorHost> navigator_host_; |
| 75 | 82 |
| 76 base::WeakPtrFactory<HTMLDocumentView> weak_factory_; | 83 base::WeakPtrFactory<HTMLDocumentView> weak_factory_; |
| 77 DISALLOW_COPY_AND_ASSIGN(HTMLDocumentView); | 84 DISALLOW_COPY_AND_ASSIGN(HTMLDocumentView); |
| 78 }; | 85 }; |
| 79 | 86 |
| 80 } // namespace examples | 87 } // namespace examples |
| 81 } // namespace mojo | 88 } // namespace mojo |
| 82 | 89 |
| 83 #endif // MOJO_EXAMPLES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_ | 90 #endif // MOJO_EXAMPLES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_ |
| OLD | NEW |