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

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

Issue 393983004: Move mojo/examples/html_viewer to mojo/services/html_viewer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nuke 'examples' namespace Created 6 years, 5 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 | Annotate | Revision Log
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 #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"
24 #include "third_party/WebKit/public/web/WebSettings.h" 24 #include "third_party/WebKit/public/web/WebSettings.h"
25 #include "third_party/WebKit/public/web/WebView.h" 25 #include "third_party/WebKit/public/web/WebView.h"
26 #include "third_party/skia/include/core/SkCanvas.h" 26 #include "third_party/skia/include/core/SkCanvas.h"
27 #include "third_party/skia/include/core/SkColor.h" 27 #include "third_party/skia/include/core/SkColor.h"
28 #include "third_party/skia/include/core/SkDevice.h" 28 #include "third_party/skia/include/core/SkDevice.h"
29 29
30 namespace mojo { 30 namespace mojo {
31 namespace examples {
32 namespace { 31 namespace {
33 32
34 void ConfigureSettings(blink::WebSettings* settings) { 33 void ConfigureSettings(blink::WebSettings* settings) {
35 settings->setAcceleratedCompositingEnabled(false); 34 settings->setAcceleratedCompositingEnabled(false);
36 settings->setDefaultFixedFontSize(13); 35 settings->setDefaultFixedFontSize(13);
37 settings->setDefaultFontSize(16); 36 settings->setDefaultFontSize(16);
38 settings->setLoadsImagesAutomatically(true); 37 settings->setLoadsImagesAutomatically(true);
39 settings->setJavaScriptEnabled(true); 38 settings->setJavaScriptEnabled(true);
40 } 39 }
41 40
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 nav_details.Pass()); 157 nav_details.Pass());
159 158
160 return blink::WebNavigationPolicyIgnore; 159 return blink::WebNavigationPolicyIgnore;
161 } 160 }
162 161
163 void HTMLDocumentView::didAddMessageToConsole( 162 void HTMLDocumentView::didAddMessageToConsole(
164 const blink::WebConsoleMessage& message, 163 const blink::WebConsoleMessage& message,
165 const blink::WebString& source_name, 164 const blink::WebString& source_name,
166 unsigned source_line, 165 unsigned source_line,
167 const blink::WebString& stack_trace) { 166 const blink::WebString& stack_trace) {
168 printf("### console: %s\n", std::string(message.text.utf8()).c_str());
169 } 167 }
170 168
171 void HTMLDocumentView::didNavigateWithinPage( 169 void HTMLDocumentView::didNavigateWithinPage(
172 blink::WebLocalFrame* frame, const blink::WebHistoryItem& history_item, 170 blink::WebLocalFrame* frame, const blink::WebHistoryItem& history_item,
173 blink::WebHistoryCommitType commit_type) { 171 blink::WebHistoryCommitType commit_type) {
174 navigator_host_->DidNavigateLocally(view_->node()->id(), 172 navigator_host_->DidNavigateLocally(view_->node()->id(),
175 history_item.urlString().utf8()); 173 history_item.urlString().utf8());
176 } 174 }
177 175
178 void HTMLDocumentView::OnViewInputEvent(view_manager::View* view, 176 void HTMLDocumentView::OnViewInputEvent(view_manager::View* view,
(...skipping 15 matching lines...) Expand all
194 int height = web_view_->size().height; 192 int height = web_view_->size().height;
195 193
196 skia::RefPtr<SkCanvas> canvas = skia::AdoptRef(SkCanvas::NewRaster( 194 skia::RefPtr<SkCanvas> canvas = skia::AdoptRef(SkCanvas::NewRaster(
197 SkImageInfo::MakeN32(width, height, kOpaque_SkAlphaType))); 195 SkImageInfo::MakeN32(width, height, kOpaque_SkAlphaType)));
198 196
199 web_view_->paint(canvas.get(), gfx::Rect(0, 0, width, height)); 197 web_view_->paint(canvas.get(), gfx::Rect(0, 0, width, height));
200 198
201 view_->SetContents(canvas->getDevice()->accessBitmap(false)); 199 view_->SetContents(canvas->getDevice()->accessBitmap(false));
202 } 200 }
203 201
204 } // namespace examples
205 } // namespace mojo 202 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/html_viewer/html_document_view.h ('k') | mojo/services/html_viewer/html_viewer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698