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 #include "mojo/services/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/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 // Otherwise we don't know if we're the right app to handle this request. Ask | 74 // Otherwise we don't know if we're the right app to handle this request. Ask |
| 75 // host to do the navigation for us. | 75 // host to do the navigation for us. |
| 76 return false; | 76 return false; |
| 77 } | 77 } |
| 78 | 78 |
| 79 } // namespace | 79 } // namespace |
| 80 | 80 |
| 81 HTMLDocumentView::HTMLDocumentView(ServiceProvider* service_provider, | 81 HTMLDocumentView::HTMLDocumentView(ServiceProvider* service_provider, |
| 82 ViewManager* view_manager) | 82 ViewManager* view_manager) |
| 83 : view_manager_(view_manager), | 83 : view_manager_(view_manager), |
| 84 navigator_host_(service_provider), | |
| 84 web_view_(NULL), | 85 web_view_(NULL), |
| 85 root_(NULL), | 86 root_(NULL), |
| 86 repaint_pending_(false), | 87 repaint_pending_(false), |
| 87 navigator_host_(service_provider), | |
| 88 weak_factory_(this) { | 88 weak_factory_(this) { |
| 89 } | 89 } |
| 90 | 90 |
| 91 HTMLDocumentView::~HTMLDocumentView() { | 91 HTMLDocumentView::~HTMLDocumentView() { |
| 92 if (web_view_) | 92 if (web_view_) |
| 93 web_view_->close(); | 93 web_view_->close(); |
| 94 if (root_) | 94 if (root_) |
| 95 root_->RemoveObserver(this); | 95 root_->RemoveObserver(this); |
| 96 } | 96 } |
| 97 | 97 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 | 138 |
| 139 bool HTMLDocumentView::allowsBrokenNullLayerTreeView() const { | 139 bool HTMLDocumentView::allowsBrokenNullLayerTreeView() const { |
| 140 // TODO(darin): Switch to using compositor bindings. | 140 // TODO(darin): Switch to using compositor bindings. |
| 141 // | 141 // |
| 142 // NOTE: Note to Blink maintainers, feel free to break this code if it is the | 142 // NOTE: Note to Blink maintainers, feel free to break this code if it is the |
| 143 // last NOT using compositor bindings and you want to delete this code path. | 143 // last NOT using compositor bindings and you want to delete this code path. |
| 144 // | 144 // |
| 145 return true; | 145 return true; |
| 146 } | 146 } |
| 147 | 147 |
| 148 blink::WebFrame* HTMLDocumentView::createChildFrame( | |
| 149 blink::WebLocalFrame* parent, | |
| 150 const blink::WebString& frameName) { | |
| 151 blink::WebLocalFrame* web_frame = blink::WebLocalFrame::create(this); | |
| 152 parent->appendChild(web_frame); | |
| 153 return web_frame; | |
| 154 } | |
| 155 | |
| 156 void HTMLDocumentView::didDisownOpener(blink::WebLocalFrame* frame) { | |
|
darin (slow to review)
2014/08/15 03:26:53
I suppose these empty methods don't really need to
| |
| 157 } | |
| 158 | |
| 159 void HTMLDocumentView::frameDetached(blink::WebFrame* frame) { | |
| 160 if (frame->parent()) | |
| 161 frame->parent()->removeChild(frame); | |
| 162 | |
| 163 // |frame| is invalid after here. | |
| 164 frame->close(); | |
| 165 } | |
| 166 | |
| 167 void HTMLDocumentView::frameFocused() { | |
| 168 } | |
| 169 | |
| 170 void HTMLDocumentView::willClose(blink::WebFrame* frame) { | |
| 171 } | |
| 172 | |
| 148 blink::WebCookieJar* HTMLDocumentView::cookieJar(blink::WebLocalFrame* frame) { | 173 blink::WebCookieJar* HTMLDocumentView::cookieJar(blink::WebLocalFrame* frame) { |
| 149 // TODO(darin): Blink does not fallback to the Platform provided WebCookieJar. | 174 // TODO(darin): Blink does not fallback to the Platform provided WebCookieJar. |
| 150 // Either it should, as it once did, or we should find another solution here. | 175 // Either it should, as it once did, or we should find another solution here. |
| 151 return blink::Platform::current()->cookieJar(); | 176 return blink::Platform::current()->cookieJar(); |
| 152 } | 177 } |
| 153 | 178 |
| 154 blink::WebNavigationPolicy HTMLDocumentView::decidePolicyForNavigation( | 179 blink::WebNavigationPolicy HTMLDocumentView::decidePolicyForNavigation( |
| 155 blink::WebLocalFrame* frame, blink::WebDataSource::ExtraData* data, | 180 blink::WebLocalFrame* frame, blink::WebDataSource::ExtraData* data, |
| 156 const blink::WebURLRequest& request, blink::WebNavigationType nav_type, | 181 const blink::WebURLRequest& request, blink::WebNavigationType nav_type, |
| 157 blink::WebNavigationPolicy default_policy, bool is_redirect) { | 182 blink::WebNavigationPolicy default_policy, bool is_redirect) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 | 240 |
| 216 skia::RefPtr<SkCanvas> canvas = skia::AdoptRef(SkCanvas::NewRaster( | 241 skia::RefPtr<SkCanvas> canvas = skia::AdoptRef(SkCanvas::NewRaster( |
| 217 SkImageInfo::MakeN32(width, height, kOpaque_SkAlphaType))); | 242 SkImageInfo::MakeN32(width, height, kOpaque_SkAlphaType))); |
| 218 | 243 |
| 219 web_view_->paint(canvas.get(), gfx::Rect(0, 0, width, height)); | 244 web_view_->paint(canvas.get(), gfx::Rect(0, 0, width, height)); |
| 220 | 245 |
| 221 root_->SetContents(canvas->getDevice()->accessBitmap(false)); | 246 root_->SetContents(canvas->getDevice()->accessBitmap(false)); |
| 222 } | 247 } |
| 223 | 248 |
| 224 } // namespace mojo | 249 } // namespace mojo |
| OLD | NEW |