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

Side by Side Diff: sky/viewer/internals.cc

Issue 1222483002: Remove the ability to load ".sky" files (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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
« sky/engine/web/WebViewImpl.cpp ('K') | « sky/viewer/document_view.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "sky/viewer/internals.h" 5 #include "sky/viewer/internals.h"
6 6
7 #include "mojo/public/cpp/application/connect.h" 7 #include "mojo/public/cpp/application/connect.h"
8 #include "mojo/public/cpp/bindings/array.h" 8 #include "mojo/public/cpp/bindings/array.h"
9 #include "sky/engine/public/web/WebDocument.h"
10 #include "sky/engine/public/web/WebFrame.h"
11 #include "sky/engine/public/web/WebView.h"
12 #include "sky/engine/tonic/dart_builtin.h" 9 #include "sky/engine/tonic/dart_builtin.h"
13 #include "sky/engine/tonic/dart_converter.h" 10 #include "sky/engine/tonic/dart_converter.h"
14 #include "sky/engine/tonic/dart_error.h" 11 #include "sky/engine/tonic/dart_error.h"
15 #include "sky/viewer/document_view.h" 12 #include "sky/viewer/document_view.h"
16 #include "sky/viewer/runtime_flags.h" 13 #include "sky/viewer/runtime_flags.h"
17 #include <limits> 14 #include <limits>
18 15
19 using namespace blink; 16 using namespace blink;
20 17
21 namespace sky { 18 namespace sky {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 Internals::Internals(DocumentView* document_view) 102 Internals::Internals(DocumentView* document_view)
106 : document_view_(document_view->GetWeakPtr()), 103 : document_view_(document_view->GetWeakPtr()),
107 shell_binding_(this) { 104 shell_binding_(this) {
108 test_harness_ = document_view_->TakeTestHarness(); 105 test_harness_ = document_view_->TakeTestHarness();
109 } 106 }
110 107
111 Internals::~Internals() { 108 Internals::~Internals() {
112 } 109 }
113 110
114 std::string Internals::RenderTreeAsText() { 111 std::string Internals::RenderTreeAsText() {
115 if (!document_view_) 112 return std::string();
116 return std::string();
117 return document_view_->web_view()->mainFrame()->renderTreeAsText().utf8();
118 } 113 }
119 114
120 std::string Internals::ContentAsText() { 115 std::string Internals::ContentAsText() {
121 if (!document_view_) 116 return std::string();
122 return std::string();
123 return document_view_->web_view()->mainFrame()->contentAsText(
124 1024*1024).utf8();
125 } 117 }
126 118
127 void Internals::NotifyTestComplete(const std::string& test_result) { 119 void Internals::NotifyTestComplete(const std::string& test_result) {
128 if (!RuntimeFlags::Get().testing()) 120 if (!RuntimeFlags::Get().testing())
129 return; 121 return;
130 std::vector<unsigned char> pixels; 122 std::vector<unsigned char> pixels;
131 document_view_->GetPixelsForTesting(&pixels); 123 document_view_->GetPixelsForTesting(&pixels);
132 if (test_harness_) { 124 if (test_harness_) {
133 test_harness_->OnTestComplete(test_result, 125 test_harness_->OnTestComplete(test_result,
134 mojo::Array<uint8_t>::From(pixels)); 126 mojo::Array<uint8_t>::From(pixels));
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 const mojo::String& application_url, 159 const mojo::String& application_url,
168 mojo::InterfaceRequest<mojo::ServiceProvider> services, 160 mojo::InterfaceRequest<mojo::ServiceProvider> services,
169 mojo::ServiceProviderPtr exposed_services) { 161 mojo::ServiceProviderPtr exposed_services) {
170 if (document_view_) { 162 if (document_view_) {
171 document_view_->shell()->ConnectToApplication( 163 document_view_->shell()->ConnectToApplication(
172 application_url, services.Pass(), exposed_services.Pass()); 164 application_url, services.Pass(), exposed_services.Pass());
173 } 165 }
174 } 166 }
175 167
176 } // namespace sky 168 } // namespace sky
OLDNEW
« sky/engine/web/WebViewImpl.cpp ('K') | « sky/viewer/document_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698