OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 #include "sky/engine/public/web/WebNode.h" | 76 #include "sky/engine/public/web/WebNode.h" |
77 #include "sky/engine/public/web/WebRange.h" | 77 #include "sky/engine/public/web/WebRange.h" |
78 #include "sky/engine/public/web/WebTextInputInfo.h" | 78 #include "sky/engine/public/web/WebTextInputInfo.h" |
79 #include "sky/engine/public/web/WebViewClient.h" | 79 #include "sky/engine/public/web/WebViewClient.h" |
80 #include "sky/engine/web/CompositionUnderlineVectorBuilder.h" | 80 #include "sky/engine/web/CompositionUnderlineVectorBuilder.h" |
81 #include "sky/engine/web/WebLocalFrameImpl.h" | 81 #include "sky/engine/web/WebLocalFrameImpl.h" |
82 #include "sky/engine/web/WebSettingsImpl.h" | 82 #include "sky/engine/web/WebSettingsImpl.h" |
83 #include "sky/engine/wtf/CurrentTime.h" | 83 #include "sky/engine/wtf/CurrentTime.h" |
84 #include "sky/engine/wtf/RefPtr.h" | 84 #include "sky/engine/wtf/RefPtr.h" |
85 #include "sky/engine/wtf/TemporaryChange.h" | 85 #include "sky/engine/wtf/TemporaryChange.h" |
| 86 #include "url/gurl.h" |
86 | 87 |
87 // Get rid of WTF's pow define so we can use std::pow. | 88 // Get rid of WTF's pow define so we can use std::pow. |
88 #undef pow | 89 #undef pow |
89 #include <cmath> // for std::pow | 90 #include <cmath> // for std::pow |
90 | 91 |
91 namespace blink { | 92 namespace blink { |
92 | 93 |
93 // WebView ---------------------------------------------------------------- | 94 // WebView ---------------------------------------------------------------- |
94 | 95 |
| 96 bool WebView::shouldUseWebView(const GURL& url) |
| 97 { |
| 98 std::string filename = url.ExtractFileName(); |
| 99 int hashStart = filename.find('#'); |
| 100 if (hashStart != -1) |
| 101 filename.resize(hashStart); |
| 102 int queryStart = filename.find('?'); |
| 103 if (queryStart != -1) |
| 104 filename.resize(queryStart); |
| 105 // For now .dart indicates we should use SkyView. Eventually we'll |
| 106 // use SkyView for all urls regardless of file extension. |
| 107 return !EndsWith(filename, ".dart", false); |
| 108 } |
| 109 |
95 WebView* WebView::create(WebViewClient* client) | 110 WebView* WebView::create(WebViewClient* client) |
96 { | 111 { |
97 // Pass the WebViewImpl's self-reference to the caller. | 112 // Pass the WebViewImpl's self-reference to the caller. |
98 return WebViewImpl::create(client); | 113 return WebViewImpl::create(client); |
99 } | 114 } |
100 | 115 |
101 WebViewImpl* WebViewImpl::create(WebViewClient* client) | 116 WebViewImpl* WebViewImpl::create(WebViewClient* client) |
102 { | 117 { |
103 // Pass the WebViewImpl's self-reference to the caller. | 118 // Pass the WebViewImpl's self-reference to the caller. |
104 return adoptRef(new WebViewImpl(client)).leakRef(); | 119 return adoptRef(new WebViewImpl(client)).leakRef(); |
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState, | 820 void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState, |
806 bool isInitialState) { | 821 bool isInitialState) { |
807 if (!page()) | 822 if (!page()) |
808 return; | 823 return; |
809 | 824 |
810 ASSERT(visibilityState == WebPageVisibilityStateVisible || visibilityState =
= WebPageVisibilityStateHidden); | 825 ASSERT(visibilityState == WebPageVisibilityStateVisible || visibilityState =
= WebPageVisibilityStateHidden); |
811 m_page->setVisibilityState(static_cast<PageVisibilityState>(static_cast<int>
(visibilityState)), isInitialState); | 826 m_page->setVisibilityState(static_cast<PageVisibilityState>(static_cast<int>
(visibilityState)), isInitialState); |
812 } | 827 } |
813 | 828 |
814 } // namespace blink | 829 } // namespace blink |
OLD | NEW |