OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007 Apple, Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 Apple, Inc. All rights reserved. |
3 * Copyright (C) 2012 Google, Inc. All rights reserved. | 3 * Copyright (C) 2012 Google, Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "config.h" | 27 #include "config.h" |
28 #include "web/EditorClientImpl.h" | 28 #include "web/EditorClientImpl.h" |
29 | 29 |
30 #include "core/editing/SelectionType.h" | 30 #include "core/editing/SelectionType.h" |
31 #include "public/web/WebFrameClient.h" | 31 #include "public/web/WebFrameClient.h" |
32 #include "public/web/WebPermissionClient.h" | 32 #include "public/web/WebPermissionClient.h" |
33 #include "public/web/WebViewClient.h" | 33 #include "public/web/WebViewClient.h" |
34 #include "web/WebLocalFrameImpl.h" | 34 #include "web/WebLocalFrameImpl.h" |
35 #include "web/WebViewImpl.h" | 35 #include "web/WebViewImpl.h" |
36 | 36 |
37 using namespace blink; | |
38 | |
39 namespace blink { | 37 namespace blink { |
40 | 38 |
41 EditorClientImpl::EditorClientImpl(WebViewImpl* webview) | 39 EditorClientImpl::EditorClientImpl(WebViewImpl* webview) |
42 : m_webView(webview) | 40 : m_webView(webview) |
43 { | 41 { |
44 } | 42 } |
45 | 43 |
46 EditorClientImpl::~EditorClientImpl() | 44 EditorClientImpl::~EditorClientImpl() |
47 { | 45 { |
48 } | 46 } |
49 | 47 |
50 void EditorClientImpl::respondToChangedSelection(LocalFrame* frame, blink::Selec
tionType selectionType) | 48 void EditorClientImpl::respondToChangedSelection(LocalFrame* frame, SelectionTyp
e selectionType) |
51 { | 49 { |
52 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(frame); | 50 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(frame); |
53 if (webFrame->client()) | 51 if (webFrame->client()) |
54 webFrame->client()->didChangeSelection(selectionType != blink::RangeSele
ction); | 52 webFrame->client()->didChangeSelection(selectionType != RangeSelection); |
55 } | 53 } |
56 | 54 |
57 void EditorClientImpl::respondToChangedContents() | 55 void EditorClientImpl::respondToChangedContents() |
58 { | 56 { |
59 if (m_webView->client()) | 57 if (m_webView->client()) |
60 m_webView->client()->didChangeContents(); | 58 m_webView->client()->didChangeContents(); |
61 } | 59 } |
62 | 60 |
63 bool EditorClientImpl::canCopyCut(LocalFrame* frame, bool defaultValue) const | 61 bool EditorClientImpl::canCopyCut(LocalFrame* frame, bool defaultValue) const |
64 { | 62 { |
65 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(frame); | 63 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(frame); |
66 if (!webFrame->permissionClient()) | 64 if (!webFrame->permissionClient()) |
67 return defaultValue; | 65 return defaultValue; |
68 return webFrame->permissionClient()->allowWriteToClipboard(defaultValue); | 66 return webFrame->permissionClient()->allowWriteToClipboard(defaultValue); |
69 } | 67 } |
70 | 68 |
71 bool EditorClientImpl::canPaste(LocalFrame* frame, bool defaultValue) const | 69 bool EditorClientImpl::canPaste(LocalFrame* frame, bool defaultValue) const |
72 { | 70 { |
73 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(frame); | 71 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(frame); |
74 if (!webFrame->permissionClient()) | 72 if (!webFrame->permissionClient()) |
75 return defaultValue; | 73 return defaultValue; |
76 return webFrame->permissionClient()->allowReadFromClipboard(defaultValue); | 74 return webFrame->permissionClient()->allowReadFromClipboard(defaultValue); |
77 } | 75 } |
78 | 76 |
79 bool EditorClientImpl::handleKeyboardEvent() | 77 bool EditorClientImpl::handleKeyboardEvent() |
80 { | 78 { |
81 return m_webView->client() && m_webView->client()->handleCurrentKeyboardEven
t(); | 79 return m_webView->client() && m_webView->client()->handleCurrentKeyboardEven
t(); |
82 } | 80 } |
83 | 81 |
84 } // namesace blink | 82 } // namespace blink |
OLD | NEW |