summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-18 22:13:03 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-18 22:13:03 +0000
commit04fc948392b6fba1e640bd97eeea2293d9ed9b7e (patch)
tree3c413c4bf8d139cdf932fdfc4b8a7e3cc812313f /webkit/glue
parente0d0014eb45448bf6bc59d905707d242f7517ba6 (diff)
downloadchromium_src-04fc948392b6fba1e640bd97eeea2293d9ed9b7e.zip
chromium_src-04fc948392b6fba1e640bd97eeea2293d9ed9b7e.tar.gz
chromium_src-04fc948392b6fba1e640bd97eeea2293d9ed9b7e.tar.bz2
Fold WebEditingClient into WebViewClient.
R=dglazkov BUG=none TEST=none Review URL: http://codereview.chromium.org/211032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26631 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r--webkit/glue/editor_client_impl.cc104
-rw-r--r--webkit/glue/editor_client_impl.h9
-rw-r--r--webkit/glue/webview.h4
-rw-r--r--webkit/glue/webview_impl.cc11
-rw-r--r--webkit/glue/webview_impl.h4
-rw-r--r--webkit/glue/webworker_impl.cc2
6 files changed, 58 insertions, 76 deletions
diff --git a/webkit/glue/editor_client_impl.cc b/webkit/glue/editor_client_impl.cc
index 1502a3c..e64cc20 100644
--- a/webkit/glue/editor_client_impl.cc
+++ b/webkit/glue/editor_client_impl.cc
@@ -24,7 +24,6 @@
#undef LOG
#include "webkit/api/public/WebEditingAction.h"
-#include "webkit/api/public/WebEditingClient.h"
#include "webkit/api/public/WebKit.h"
#include "webkit/api/public/WebNode.h"
#include "webkit/api/public/WebRange.h"
@@ -38,7 +37,6 @@
#include "webkit/glue/webview_impl.h"
using WebKit::WebEditingAction;
-using WebKit::WebEditingClient;
using WebKit::WebString;
using WebKit::WebTextAffinity;
using webkit_glue::AutofillForm;
@@ -53,10 +51,8 @@ static const size_t kMaximumUndoStackDepth = 1000;
// (so to avoid sending long strings through IPC).
static const size_t kMaximumTextSizeForAutofill = 1000;
-EditorClientImpl::EditorClientImpl(WebViewImpl* web_view,
- WebEditingClient* editing_client)
- : web_view_(web_view),
- editing_client_(editing_client),
+EditorClientImpl::EditorClientImpl(WebViewImpl* webview)
+ : webview_(webview),
in_redo_(false),
backspace_or_delete_pressed_(false),
spell_check_this_field_status_(SPELLCHECK_AUTOMATIC),
@@ -68,9 +64,7 @@ EditorClientImpl::~EditorClientImpl() {
}
void EditorClientImpl::pageDestroyed() {
- // Our lifetime is bound to the WebViewImpl. This is our signal that we
- // should no longer notify the consumer.
- editing_client_ = NULL;
+ // Our lifetime is bound to the WebViewImpl.
}
bool EditorClientImpl::shouldShowDeleteInterface(WebCore::HTMLElement* elem) {
@@ -82,14 +76,14 @@ bool EditorClientImpl::shouldShowDeleteInterface(WebCore::HTMLElement* elem) {
}
bool EditorClientImpl::smartInsertDeleteEnabled() {
- if (editing_client_)
- return editing_client_->isSmartInsertDeleteEnabled();
+ if (webview_->client())
+ return webview_->client()->isSmartInsertDeleteEnabled();
return true;
}
bool EditorClientImpl::isSelectTrailingWhitespaceEnabled() {
- if (editing_client_)
- return editing_client_->isSelectTrailingWhitespaceEnabled();
+ if (webview_->client())
+ return webview_->client()->isSelectTrailingWhitespaceEnabled();
#if defined(OS_WIN)
return true;
@@ -101,7 +95,7 @@ bool EditorClientImpl::isSelectTrailingWhitespaceEnabled() {
bool EditorClientImpl::ShouldSpellcheckByDefault() {
// Spellcheck should be enabled for all editable areas (such as textareas,
// contentEditable regions, and designMode docs), except text inputs.
- const WebCore::Frame* frame = web_view_->GetFocusedWebCoreFrame();
+ const WebCore::Frame* frame = webview_->GetFocusedWebCoreFrame();
if (!frame)
return false;
const WebCore::Editor* editor = frame->editor();
@@ -161,16 +155,16 @@ bool EditorClientImpl::isEditable() {
}
bool EditorClientImpl::shouldBeginEditing(WebCore::Range* range) {
- if (editing_client_) {
- return editing_client_->shouldBeginEditing(
+ if (webview_->client()) {
+ return webview_->client()->shouldBeginEditing(
webkit_glue::RangeToWebRange(range));
}
return true;
}
bool EditorClientImpl::shouldEndEditing(WebCore::Range* range) {
- if (editing_client_) {
- return editing_client_->shouldEndEditing(
+ if (webview_->client()) {
+ return webview_->client()->shouldEndEditing(
webkit_glue::RangeToWebRange(range));
}
return true;
@@ -179,8 +173,8 @@ bool EditorClientImpl::shouldEndEditing(WebCore::Range* range) {
bool EditorClientImpl::shouldInsertNode(WebCore::Node* node,
WebCore::Range* range,
WebCore::EditorInsertAction action) {
- if (editing_client_) {
- return editing_client_->shouldInsertNode(
+ if (webview_->client()) {
+ return webview_->client()->shouldInsertNode(
webkit_glue::NodeToWebNode(node),
webkit_glue::RangeToWebRange(range),
static_cast<WebEditingAction>(action));
@@ -191,8 +185,8 @@ bool EditorClientImpl::shouldInsertNode(WebCore::Node* node,
bool EditorClientImpl::shouldInsertText(const WebCore::String& text,
WebCore::Range* range,
WebCore::EditorInsertAction action) {
- if (editing_client_) {
- return editing_client_->shouldInsertText(
+ if (webview_->client()) {
+ return webview_->client()->shouldInsertText(
webkit_glue::StringToWebString(text),
webkit_glue::RangeToWebRange(range),
static_cast<WebEditingAction>(action));
@@ -202,8 +196,8 @@ bool EditorClientImpl::shouldInsertText(const WebCore::String& text,
bool EditorClientImpl::shouldDeleteRange(WebCore::Range* range) {
- if (editing_client_) {
- return editing_client_->shouldDeleteRange(
+ if (webview_->client()) {
+ return webview_->client()->shouldDeleteRange(
webkit_glue::RangeToWebRange(range));
}
return true;
@@ -213,8 +207,8 @@ bool EditorClientImpl::shouldChangeSelectedRange(WebCore::Range* from_range,
WebCore::Range* to_range,
WebCore::EAffinity affinity,
bool still_selecting) {
- if (editing_client_) {
- return editing_client_->shouldChangeSelectedRange(
+ if (webview_->client()) {
+ return webview_->client()->shouldChangeSelectedRange(
webkit_glue::RangeToWebRange(from_range),
webkit_glue::RangeToWebRange(to_range),
static_cast<WebTextAffinity>(affinity),
@@ -225,9 +219,9 @@ bool EditorClientImpl::shouldChangeSelectedRange(WebCore::Range* from_range,
bool EditorClientImpl::shouldApplyStyle(WebCore::CSSStyleDeclaration* style,
WebCore::Range* range) {
- if (editing_client_) {
+ if (webview_->client()) {
// TODO(darin): Pass a reference to the CSSStyleDeclaration somehow.
- return editing_client_->shouldApplyStyle(
+ return webview_->client()->shouldApplyStyle(
WebString(),
webkit_glue::RangeToWebRange(range));
}
@@ -241,26 +235,26 @@ bool EditorClientImpl::shouldMoveRangeAfterDelete(
}
void EditorClientImpl::didBeginEditing() {
- if (editing_client_)
- editing_client_->didBeginEditing();
+ if (webview_->client())
+ webview_->client()->didBeginEditing();
}
void EditorClientImpl::respondToChangedSelection() {
- if (editing_client_) {
- WebCore::Frame* frame = web_view_->GetFocusedWebCoreFrame();
+ if (webview_->client()) {
+ WebCore::Frame* frame = webview_->GetFocusedWebCoreFrame();
if (frame)
- editing_client_->didChangeSelection(!frame->selection()->isRange());
+ webview_->client()->didChangeSelection(!frame->selection()->isRange());
}
}
void EditorClientImpl::respondToChangedContents() {
- if (editing_client_)
- editing_client_->didChangeContents();
+ if (webview_->client())
+ webview_->client()->didChangeContents();
}
void EditorClientImpl::didEndEditing() {
- if (editing_client_)
- editing_client_->didEndEditing();
+ if (webview_->client())
+ webview_->client()->didEndEditing();
}
void EditorClientImpl::didWriteSelectionToPasteboard() {
@@ -564,8 +558,8 @@ bool EditorClientImpl::handleEditingKeyboardEvent(
if (command.isTextInsertion() || command_name.isEmpty())
return false;
if (command.execute(evt)) {
- if (editing_client_) {
- editing_client_->didExecuteCommand(
+ if (webview_->client()) {
+ webview_->client()->didExecuteCommand(
webkit_glue::StringToWebString(command_name));
}
return true;
@@ -574,8 +568,8 @@ bool EditorClientImpl::handleEditingKeyboardEvent(
}
if (command.execute(evt)) {
- if (editing_client_) {
- editing_client_->didExecuteCommand(
+ if (webview_->client()) {
+ webview_->client()->didExecuteCommand(
webkit_glue::StringToWebString(command_name));
}
return true;
@@ -639,7 +633,7 @@ void EditorClientImpl::handleKeyboardEvent(WebCore::KeyboardEvent* evt) {
// Calls WebViewDelegate's HandleCurrentKeyboardEvent() first to give it a
// chance to handle the keyboard event. Bypass handleEditingKeyboardEvent(),
// if WebViewDelegate handles the event.
- WebViewDelegate* d = web_view_->delegate();
+ WebViewDelegate* d = webview_->delegate();
if ((d && d->HandleCurrentKeyboardEvent()) || handleEditingKeyboardEvent(evt))
evt->setDefaultHandled();
}
@@ -660,9 +654,9 @@ void EditorClientImpl::textFieldDidEndEditing(WebCore::Element* element) {
autofill_timer_.stop();
// Hide any showing popup.
- web_view_->HideAutoCompletePopup();
+ webview_->HideAutoCompletePopup();
- if (!editing_client_)
+ if (!webview_->client())
return; // The page is getting closed, don't fill the password.
// Notify any password-listener of the focus change.
@@ -752,7 +746,7 @@ void EditorClientImpl::DoAutofill(WebCore::Timer<EditorClientImpl>* timer) {
true; // When |require_caret_at_end| is false, just pretend we are at
// the end.
if ((!args->autofill_on_empty_value && value.empty()) || !is_caret_at_end) {
- web_view_->HideAutoCompletePopup();
+ webview_->HideAutoCompletePopup();
return;
}
@@ -776,8 +770,8 @@ void EditorClientImpl::DoAutofill(WebCore::Timer<EditorClientImpl>* timer) {
std::wstring name = AutofillForm::GetNameForInputElement(input_element);
ASSERT(static_cast<int>(name.length()) > 0);
- if (web_view_->delegate())
- web_view_->delegate()->QueryFormFieldAutofill(name, value,
+ if (webview_->delegate())
+ webview_->delegate()->QueryFormFieldAutofill(name, value,
reinterpret_cast<int64>(input_element));
}
@@ -836,7 +830,7 @@ void EditorClientImpl::checkSpellingOfString(const UChar* str, int length,
// caller expects if the word is spelled correctly.
int spell_location = -1;
int spell_length = 0;
- WebViewDelegate* d = web_view_->delegate();
+ WebViewDelegate* d = webview_->delegate();
// Check to see if the provided str is spelled correctly.
if (isContinuousSpellCheckingEnabled() && d) {
@@ -858,7 +852,7 @@ void EditorClientImpl::checkSpellingOfString(const UChar* str, int length,
WebCore::String EditorClientImpl::getAutoCorrectSuggestionForMisspelledWord(
const WebCore::String& misspelledWord) {
- WebViewDelegate* d = web_view_->delegate();
+ WebViewDelegate* d = webview_->delegate();
if (!(isContinuousSpellCheckingEnabled() && d))
return WebCore::String();
@@ -894,25 +888,25 @@ void EditorClientImpl::updateSpellingUIWithGrammarString(const WebCore::String&,
void EditorClientImpl::updateSpellingUIWithMisspelledWord(
const WebCore::String& misspelled_word) {
std::wstring word = webkit_glue::StringToStdWString(misspelled_word);
- WebViewDelegate* d = web_view_->delegate();
+ WebViewDelegate* d = webview_->delegate();
if (d) {
d->UpdateSpellingUIWithMisspelledWord(word);
}
}
void EditorClientImpl::showSpellingUI(bool show) {
- WebViewDelegate* d = web_view_->delegate();
+ WebViewDelegate* d = webview_->delegate();
if (d) {
d->ShowSpellingUI(show);
}
}
bool EditorClientImpl::spellingUIIsShowing() {
- // SpellingPanel visibility is stored in the web_view_ every time a toggle
+ // SpellingPanel visibility is stored in the webview_ every time a toggle
// message is sent from the browser. If we were to send a message to the
// browser and ask for the visibility, then we run into problems accessing
// cocoa methods on the UI thread.
- return web_view_->GetSpellingPanelVisibility();
+ return webview_->GetSpellingPanelVisibility();
}
void EditorClientImpl::getGuessesForWord(const WebCore::String&,
@@ -921,6 +915,6 @@ void EditorClientImpl::getGuessesForWord(const WebCore::String&,
}
void EditorClientImpl::setInputMethodState(bool enabled) {
- if (editing_client_)
- editing_client_->setInputMethodEnabled(enabled);
+ if (webview_->client())
+ webview_->client()->setInputMethodEnabled(enabled);
}
diff --git a/webkit/glue/editor_client_impl.h b/webkit/glue/editor_client_impl.h
index c2712a9..9d93711 100644
--- a/webkit/glue/editor_client_impl.h
+++ b/webkit/glue/editor_client_impl.h
@@ -16,16 +16,12 @@ class HTMLInputElement;
class Node;
class PlatformKeyboardEvent;
}
-namespace WebKit {
-class WebEditingClient;
-}
class WebViewImpl;
class EditorClientImpl : public WebCore::EditorClient {
public:
- EditorClientImpl(WebViewImpl* web_view,
- WebKit::WebEditingClient* editing_client);
+ EditorClientImpl(WebViewImpl* webview);
virtual ~EditorClientImpl();
virtual void pageDestroyed();
@@ -156,8 +152,7 @@ class EditorClientImpl : public WebCore::EditorClient {
// for text fields and create a flag to over-write the default behavior.
bool ShouldSpellcheckByDefault();
- WebViewImpl* web_view_;
- WebKit::WebEditingClient* editing_client_;
+ WebViewImpl* webview_;
bool in_redo_;
typedef Deque< RefPtr<WebCore::EditCommand> > EditCommandStack;
diff --git a/webkit/glue/webview.h b/webkit/glue/webview.h
index 7968aa4..53ab714 100644
--- a/webkit/glue/webview.h
+++ b/webkit/glue/webview.h
@@ -14,7 +14,6 @@
namespace WebKit {
class WebDragData;
-class WebEditingClient;
class WebFrameClient;
class WebFrame;
class WebSettings;
@@ -55,8 +54,7 @@ class WebView : public WebKit::WebWidget {
// to call InitializeMainFrame to finish the initialization. You may pass
// NULL for the editing_client parameter if you are not interested in those
// notifications.
- static WebView* Create(
- WebViewDelegate* delegate, WebKit::WebEditingClient* editing_client);
+ static WebView* Create(WebViewDelegate* delegate);
// After creating a WebView, you should immediately call this function. You
// can optionally modify the settings (via GetSettings()) in between. The
diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc
index 5bb7b72..278b115 100644
--- a/webkit/glue/webview_impl.cc
+++ b/webkit/glue/webview_impl.cc
@@ -99,7 +99,6 @@ using WebKit::WebDragOperation;
using WebKit::WebDragOperationCopy;
using WebKit::WebDragOperationNone;
using WebKit::WebDragOperationsMask;
-using WebKit::WebEditingClient;
using WebKit::WebFrame;
using WebKit::WebFrameClient;
using WebKit::WebInputEvent;
@@ -333,9 +332,8 @@ static const WebCore::PopupContainerSettings kAutocompletePopupSettings = {
// WebView ----------------------------------------------------------------
/*static*/
-WebView* WebView::Create(WebViewDelegate* delegate,
- WebEditingClient* editing_client) {
- WebViewImpl* instance = new WebViewImpl(delegate, editing_client);
+WebView* WebView::Create(WebViewDelegate* delegate) {
+ WebViewImpl* instance = new WebViewImpl(delegate);
instance->AddRef();
return instance;
}
@@ -373,14 +371,13 @@ void WebView::ResetVisitedLinkState() {
}
-WebViewImpl::WebViewImpl(WebViewDelegate* delegate,
- WebEditingClient* editing_client)
+WebViewImpl::WebViewImpl(WebViewDelegate* delegate)
: delegate_(delegate),
ALLOW_THIS_IN_INITIALIZER_LIST(back_forward_list_client_impl_(this)),
ALLOW_THIS_IN_INITIALIZER_LIST(chrome_client_impl_(this)),
ALLOW_THIS_IN_INITIALIZER_LIST(context_menu_client_impl_(this)),
ALLOW_THIS_IN_INITIALIZER_LIST(drag_client_impl_(this)),
- ALLOW_THIS_IN_INITIALIZER_LIST(editor_client_impl_(this, editing_client)),
+ ALLOW_THIS_IN_INITIALIZER_LIST(editor_client_impl_(this)),
ALLOW_THIS_IN_INITIALIZER_LIST(inspector_client_impl_(this)),
observed_new_navigation_(false),
#ifndef NDEBUG
diff --git a/webkit/glue/webview_impl.h b/webkit/glue/webview_impl.h
index cc947e9..5687590 100644
--- a/webkit/glue/webview_impl.h
+++ b/webkit/glue/webview_impl.h
@@ -42,7 +42,6 @@ class Widget;
}
namespace WebKit {
-class WebEditingClient;
class WebKeyboardEvent;
class WebMouseEvent;
class WebMouseWheelEvent;
@@ -264,8 +263,7 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> {
void OnImageFetchComplete(webkit_glue::ImageResourceFetcher* fetcher,
const SkBitmap& bitmap);
- WebViewImpl(
- WebViewDelegate* delegate, WebKit::WebEditingClient* editing_client);
+ WebViewImpl(WebViewDelegate* delegate);
~WebViewImpl();
void ModifySelection(uint32 message,
diff --git a/webkit/glue/webworker_impl.cc b/webkit/glue/webworker_impl.cc
index b5a7861..f306c91 100644
--- a/webkit/glue/webworker_impl.cc
+++ b/webkit/glue/webworker_impl.cc
@@ -137,7 +137,7 @@ void WebWorkerImpl::startWorkerContext(const WebURL& script_url,
// loading requests from the worker context to the rest of WebKit and Chromium
// infrastructure.
DCHECK(!web_view_);
- web_view_ = WebView::Create(NULL, NULL);
+ web_view_ = WebView::Create(NULL);
WebPreferences().Apply(web_view_);
web_view_->InitializeMainFrame(WorkerWebFrameClient::GetSharedInstance());