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

Side by Side Diff: webkit/glue/editor_client_impl.h

Issue 11479: New take at implementing autofill using the editor client API (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « webkit/glue/dom_operations.cc ('k') | webkit/glue/editor_client_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #ifndef WEBKIT_GLUE_EDITOR_CLIENT_IMPL_H__ 5 #ifndef WEBKIT_GLUE_EDITOR_CLIENT_IMPL_H__
6 #define WEBKIT_GLUE_EDITOR_CLIENT_IMPL_H__ 6 #define WEBKIT_GLUE_EDITOR_CLIENT_IMPL_H__
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/task.h"
9 10
10 #include "build/build_config.h" 11 #include "build/build_config.h"
11 12
12 #include <deque> 13 #include <deque>
13 14
14 MSVC_PUSH_WARNING_LEVEL(0); 15 MSVC_PUSH_WARNING_LEVEL(0);
15 #include "EditorClient.h" 16 #include "EditorClient.h"
16 MSVC_POP_WARNING(); 17 MSVC_POP_WARNING();
17 18
18 namespace WebCore { 19 namespace WebCore {
19 class Frame; 20 class Frame;
21 class HTMLInputElement;
20 class Node; 22 class Node;
21 class PlatformKeyboardEvent; 23 class PlatformKeyboardEvent;
22 } 24 }
23 25
24 class WebView; 26 class WebView;
25 class WebViewImpl; 27 class WebViewImpl;
26 28
27 class EditorClientImpl : public WebCore::EditorClient { 29 class EditorClientImpl : public WebCore::EditorClient {
28 public: 30 public:
29 EditorClientImpl(WebView* web_view); 31 EditorClientImpl(WebView* web_view);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 virtual void updateSpellingUIWithGrammarString(const WebCore::String&, 98 virtual void updateSpellingUIWithGrammarString(const WebCore::String&,
97 const WebCore::GrammarDetail& d etail); 99 const WebCore::GrammarDetail& d etail);
98 virtual void updateSpellingUIWithMisspelledWord(const WebCore::String&); 100 virtual void updateSpellingUIWithMisspelledWord(const WebCore::String&);
99 virtual void showSpellingUI(bool show); 101 virtual void showSpellingUI(bool show);
100 virtual bool spellingUIIsShowing(); 102 virtual bool spellingUIIsShowing();
101 virtual void getGuessesForWord(const WebCore::String&, 103 virtual void getGuessesForWord(const WebCore::String&,
102 WTF::Vector<WebCore::String>& guesses); 104 WTF::Vector<WebCore::String>& guesses);
103 virtual void setInputMethodState(bool enabled); 105 virtual void setInputMethodState(bool enabled);
104 106
105 void SetUseEditorDelegate(bool value) { use_editor_delegate_ = value; } 107 void SetUseEditorDelegate(bool value) { use_editor_delegate_ = value; }
106 // HACK for webkit bug #16976.
107 // TODO (timsteele): Clean this up once webkit bug 16976 is fixed.
108 void PreserveSelection();
109 108
110 // It would be better to add these methods to the objects they describe, but 109 // It would be better to add these methods to the objects they describe, but
111 // those are in WebCore and therefore inaccessible. 110 // those are in WebCore and therefore inaccessible.
112 virtual std::wstring DescribeOrError(int number, 111 virtual std::wstring DescribeOrError(int number,
113 WebCore::ExceptionCode ec); 112 WebCore::ExceptionCode ec);
114 virtual std::wstring DescribeOrError(WebCore::Node* node, 113 virtual std::wstring DescribeOrError(WebCore::Node* node,
115 WebCore::ExceptionCode ec); 114 WebCore::ExceptionCode ec);
116 virtual std::wstring Describe(WebCore::Range* range); 115 virtual std::wstring Describe(WebCore::Range* range);
117 virtual std::wstring Describe(WebCore::Node* node); 116 virtual std::wstring Describe(WebCore::Node* node);
118 virtual std::wstring Describe(WebCore::EditorInsertAction action); 117 virtual std::wstring Describe(WebCore::EditorInsertAction action);
119 virtual std::wstring Describe(WebCore::EAffinity affinity); 118 virtual std::wstring Describe(WebCore::EAffinity affinity);
120 virtual std::wstring Describe(WebCore::CSSStyleDeclaration* style); 119 virtual std::wstring Describe(WebCore::CSSStyleDeclaration* style);
121 120
122 private: 121 private:
123 void ModifySelection(WebCore::Frame* frame, 122 void ModifySelection(WebCore::Frame* frame,
124 WebCore::KeyboardEvent* event); 123 WebCore::KeyboardEvent* event);
125 124
125 void DoAutofill(WebCore::HTMLInputElement* input_element, bool backspace);
126
126 protected: 127 protected:
127 WebViewImpl* web_view_; 128 WebViewImpl* web_view_;
128 bool use_editor_delegate_; 129 bool use_editor_delegate_;
129 bool in_redo_; 130 bool in_redo_;
130 131
131 // Should preserve the selection in next call to shouldChangeSelectedRange.
132 bool preserve_;
133
134 // Points to an HTMLInputElement that was just autocompleted (else NULL),
135 // for use by respondToChangedContents().
136 WebCore::Element* pending_inline_autocompleted_element_;
137
138 typedef std::deque<WTF::RefPtr<WebCore::EditCommand> > EditCommandStack; 132 typedef std::deque<WTF::RefPtr<WebCore::EditCommand> > EditCommandStack;
139 EditCommandStack undo_stack_; 133 EditCommandStack undo_stack_;
140 EditCommandStack redo_stack_; 134 EditCommandStack redo_stack_;
135
136 private:
137 // Whether the last entered key was a backspace.
138 bool backspace_pressed_;
139
140 // The method factory used to post autofill related tasks.
141 ScopedRunnableMethodFactory<EditorClientImpl> autofill_factory_;
141 }; 142 };
142 143
143 #endif // WEBKIT_GLUE_EDITOR_CLIENT_IMPL_H__ 144 #endif // WEBKIT_GLUE_EDITOR_CLIENT_IMPL_H__
144 145
OLDNEW
« no previous file with comments | « webkit/glue/dom_operations.cc ('k') | webkit/glue/editor_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698