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 2855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2866 if (!m_page->mainFrame()->isLocalFrame()) | 2866 if (!m_page->mainFrame()->isLocalFrame()) |
2867 return WebString(); | 2867 return WebString(); |
2868 | 2868 |
2869 // FIXME: Is this check needed? | 2869 // FIXME: Is this check needed? |
2870 if (!m_page->deprecatedLocalMainFrame()->document()->loader()) | 2870 if (!m_page->deprecatedLocalMainFrame()->document()->loader()) |
2871 return WebString(); | 2871 return WebString(); |
2872 | 2872 |
2873 return m_page->deprecatedLocalMainFrame()->document()->encodingName(); | 2873 return m_page->deprecatedLocalMainFrame()->document()->encodingName(); |
2874 } | 2874 } |
2875 | 2875 |
2876 void WebViewImpl::setPageEncoding(const WebString& encodingName) | |
2877 { | |
2878 if (!m_page) | |
2879 return; | |
2880 | |
2881 // Only change override encoding, don't change default encoding. | |
2882 // Note that the new encoding must be 0 if it isn't supposed to be set. | |
2883 AtomicString newEncodingName; | |
2884 if (!encodingName.isEmpty()) | |
2885 newEncodingName = encodingName; | |
2886 m_page->frameHost().setOverrideEncoding(newEncodingName); | |
2887 | |
2888 if (m_page->mainFrame()->isLocalFrame()) { | |
2889 if (!m_page->deprecatedLocalMainFrame()->loader().currentItem()) | |
2890 return; | |
2891 FrameLoadRequest request = FrameLoadRequest( | |
2892 nullptr, | |
2893 m_page->deprecatedLocalMainFrame()->loader().resourceRequestForReloa
d( | |
2894 FrameLoadTypeReload, KURL(), ClientRedirectPolicy::ClientRedirec
t)); | |
2895 request.setClientRedirect(ClientRedirectPolicy::ClientRedirect); | |
2896 m_page->deprecatedLocalMainFrame()->loader().load(request, FrameLoadType
Reload); | |
2897 } | |
2898 } | |
2899 | |
2900 WebFrame* WebViewImpl::mainFrame() | 2876 WebFrame* WebViewImpl::mainFrame() |
2901 { | 2877 { |
2902 return WebFrame::fromFrame(m_page ? m_page->mainFrame() : nullptr); | 2878 return WebFrame::fromFrame(m_page ? m_page->mainFrame() : nullptr); |
2903 } | 2879 } |
2904 | 2880 |
2905 WebFrame* WebViewImpl::findFrameByName( | 2881 WebFrame* WebViewImpl::findFrameByName( |
2906 const WebString& name, WebFrame* relativeToFrame) | 2882 const WebString& name, WebFrame* relativeToFrame) |
2907 { | 2883 { |
2908 // FIXME: Either this should only deal with WebLocalFrames or it should move
to WebFrame. | 2884 // FIXME: Either this should only deal with WebLocalFrames or it should move
to WebFrame. |
2909 if (!relativeToFrame) | 2885 if (!relativeToFrame) |
(...skipping 1684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4594 return nullptr; | 4570 return nullptr; |
4595 return focusedFrame; | 4571 return focusedFrame; |
4596 } | 4572 } |
4597 | 4573 |
4598 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const | 4574 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const |
4599 { | 4575 { |
4600 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; | 4576 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; |
4601 } | 4577 } |
4602 | 4578 |
4603 } // namespace blink | 4579 } // namespace blink |
OLD | NEW |