| 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 #include "mojo/examples/html_viewer/html_document_view.h" | 5 #include "mojo/services/html_viewer/html_document_view.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| 11 #include "mojo/examples/html_viewer/blink_input_events_type_converters.h" | 11 #include "mojo/services/html_viewer/blink_input_events_type_converters.h" |
| 12 #include "mojo/examples/html_viewer/webstoragenamespace_impl.h" | 12 #include "mojo/services/html_viewer/webstoragenamespace_impl.h" |
| 13 #include "mojo/examples/html_viewer/weburlloader_impl.h" | 13 #include "mojo/services/html_viewer/weburlloader_impl.h" |
| 14 #include "mojo/services/public/cpp/view_manager/node.h" | 14 #include "mojo/services/public/cpp/view_manager/node.h" |
| 15 #include "mojo/services/public/cpp/view_manager/view.h" | 15 #include "mojo/services/public/cpp/view_manager/view.h" |
| 16 #include "mojo/services/public/cpp/view_manager/view_observer.h" | 16 #include "mojo/services/public/cpp/view_manager/view_observer.h" |
| 17 #include "skia/ext/refptr.h" | 17 #include "skia/ext/refptr.h" |
| 18 #include "third_party/WebKit/public/web/WebConsoleMessage.h" | 18 #include "third_party/WebKit/public/web/WebConsoleMessage.h" |
| 19 #include "third_party/WebKit/public/web/WebDocument.h" | 19 #include "third_party/WebKit/public/web/WebDocument.h" |
| 20 #include "third_party/WebKit/public/web/WebElement.h" | 20 #include "third_party/WebKit/public/web/WebElement.h" |
| 21 #include "third_party/WebKit/public/web/WebInputEvent.h" | 21 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 22 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 22 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 23 #include "third_party/WebKit/public/web/WebScriptSource.h" | 23 #include "third_party/WebKit/public/web/WebScriptSource.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 nav_details.Pass()); | 158 nav_details.Pass()); |
| 159 | 159 |
| 160 return blink::WebNavigationPolicyIgnore; | 160 return blink::WebNavigationPolicyIgnore; |
| 161 } | 161 } |
| 162 | 162 |
| 163 void HTMLDocumentView::didAddMessageToConsole( | 163 void HTMLDocumentView::didAddMessageToConsole( |
| 164 const blink::WebConsoleMessage& message, | 164 const blink::WebConsoleMessage& message, |
| 165 const blink::WebString& source_name, | 165 const blink::WebString& source_name, |
| 166 unsigned source_line, | 166 unsigned source_line, |
| 167 const blink::WebString& stack_trace) { | 167 const blink::WebString& stack_trace) { |
| 168 printf("### console: %s\n", std::string(message.text.utf8()).c_str()); | |
| 169 } | 168 } |
| 170 | 169 |
| 171 void HTMLDocumentView::didNavigateWithinPage( | 170 void HTMLDocumentView::didNavigateWithinPage( |
| 172 blink::WebLocalFrame* frame, const blink::WebHistoryItem& history_item, | 171 blink::WebLocalFrame* frame, const blink::WebHistoryItem& history_item, |
| 173 blink::WebHistoryCommitType commit_type) { | 172 blink::WebHistoryCommitType commit_type) { |
| 174 navigator_host_->DidNavigateLocally(view_->node()->id(), | 173 navigator_host_->DidNavigateLocally(view_->node()->id(), |
| 175 history_item.urlString().utf8()); | 174 history_item.urlString().utf8()); |
| 176 } | 175 } |
| 177 | 176 |
| 178 void HTMLDocumentView::OnViewInputEvent(view_manager::View* view, | 177 void HTMLDocumentView::OnViewInputEvent(view_manager::View* view, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 196 skia::RefPtr<SkCanvas> canvas = skia::AdoptRef(SkCanvas::NewRaster( | 195 skia::RefPtr<SkCanvas> canvas = skia::AdoptRef(SkCanvas::NewRaster( |
| 197 SkImageInfo::MakeN32(width, height, kOpaque_SkAlphaType))); | 196 SkImageInfo::MakeN32(width, height, kOpaque_SkAlphaType))); |
| 198 | 197 |
| 199 web_view_->paint(canvas.get(), gfx::Rect(0, 0, width, height)); | 198 web_view_->paint(canvas.get(), gfx::Rect(0, 0, width, height)); |
| 200 | 199 |
| 201 view_->SetContents(canvas->getDevice()->accessBitmap(false)); | 200 view_->SetContents(canvas->getDevice()->accessBitmap(false)); |
| 202 } | 201 } |
| 203 | 202 |
| 204 } // namespace examples | 203 } // namespace examples |
| 205 } // namespace mojo | 204 } // namespace mojo |
| OLD | NEW |