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

Side by Side Diff: webkit/glue/webview_impl.cc

Issue 8885: Implementation of the UI part of the autofill (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/webview_impl.h ('k') | webkit/port/page/chromium/ChromeClientChromium.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2007 Google Inc. All Rights Reserved. 2 * Copyright 2007 Google Inc. All Rights Reserved.
3 * 3 *
4 * Portions Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 4 * Portions Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
5 * 5 *
6 * ***** BEGIN LICENSE BLOCK ***** 6 * ***** BEGIN LICENSE BLOCK *****
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
(...skipping 17 matching lines...) Expand all
28 * 28 *
29 * ***** END LICENSE BLOCK ***** 29 * ***** END LICENSE BLOCK *****
30 * 30 *
31 */ 31 */
32 32
33 #include "config.h" 33 #include "config.h"
34 #include "build/build_config.h" 34 #include "build/build_config.h"
35 35
36 #include "base/compiler_specific.h" 36 #include "base/compiler_specific.h"
37 MSVC_PUSH_WARNING_LEVEL(0); 37 MSVC_PUSH_WARNING_LEVEL(0);
38 #include "CSSStyleSelector.h"
38 #if defined(OS_WIN) 39 #if defined(OS_WIN)
39 #include "Cursor.h" 40 #include "Cursor.h"
40 #endif 41 #endif
41 #include "Document.h" 42 #include "Document.h"
42 #include "DocumentLoader.h" 43 #include "DocumentLoader.h"
43 #include "DragController.h" 44 #include "DragController.h"
44 #include "DragData.h" 45 #include "DragData.h"
45 #include "Editor.h" 46 #include "Editor.h"
46 #include "EventHandler.h" 47 #include "EventHandler.h"
47 #include "FocusController.h" 48 #include "FocusController.h"
48 #include "FontDescription.h" 49 #include "FontDescription.h"
49 #include "FrameLoader.h" 50 #include "FrameLoader.h"
50 #include "FrameTree.h" 51 #include "FrameTree.h"
51 #include "FrameView.h" 52 #include "FrameView.h"
52 #include "GraphicsContext.h" 53 #include "GraphicsContext.h"
54 #include "HTMLNames.h"
55 #include "HTMLInputElement.h"
53 #include "HitTestResult.h" 56 #include "HitTestResult.h"
54 #include "Image.h" 57 #include "Image.h"
55 #include "InspectorController.h" 58 #include "InspectorController.h"
56 #include "IntRect.h" 59 #include "IntRect.h"
57 #include "KeyboardEvent.h" 60 #include "KeyboardEvent.h"
58 #include "MIMETypeRegistry.h" 61 #include "MIMETypeRegistry.h"
59 #include "Page.h" 62 #include "Page.h"
60 #include "PlatformKeyboardEvent.h" 63 #include "PlatformKeyboardEvent.h"
61 #include "PlatformMouseEvent.h" 64 #include "PlatformMouseEvent.h"
62 #include "PlatformWheelEvent.h" 65 #include "PlatformWheelEvent.h"
63 #include "PluginInfoStore.h" 66 #include "PluginInfoStore.h"
67 #include "PopupMenuClient.h"
64 #if defined(OS_WIN) 68 #if defined(OS_WIN)
65 #include "RenderThemeWin.h" 69 #include "RenderThemeWin.h"
66 #endif 70 #endif
71 #include "RenderView.h"
67 #include "ResourceHandle.h" 72 #include "ResourceHandle.h"
68 #include "SelectionController.h" 73 #include "SelectionController.h"
69 #include "Settings.h" 74 #include "Settings.h"
70 #include "TypingCommand.h" 75 #include "TypingCommand.h"
71 #include "event_conversion.h" 76 #include "event_conversion.h"
72 MSVC_POP_WARNING(); 77 MSVC_POP_WARNING();
73 #undef LOG 78 #undef LOG
74 79
75 #include "base/gfx/rect.h" 80 #include "base/gfx/rect.h"
76 #include "base/logging.h" 81 #include "base/logging.h"
(...skipping 10 matching lines...) Expand all
87 #include "webkit/glue/inspector_client_impl.h" 92 #include "webkit/glue/inspector_client_impl.h"
88 #include "webkit/glue/searchable_form_data.h" 93 #include "webkit/glue/searchable_form_data.h"
89 #include "webkit/glue/webdropdata.h" 94 #include "webkit/glue/webdropdata.h"
90 #include "webkit/glue/webhistoryitem_impl.h" 95 #include "webkit/glue/webhistoryitem_impl.h"
91 #include "webkit/glue/webinputevent.h" 96 #include "webkit/glue/webinputevent.h"
92 #include "webkit/glue/webkit_glue.h" 97 #include "webkit/glue/webkit_glue.h"
93 #include "webkit/glue/webpreferences.h" 98 #include "webkit/glue/webpreferences.h"
94 #include "webkit/glue/webview_delegate.h" 99 #include "webkit/glue/webview_delegate.h"
95 #include "webkit/glue/webview_impl.h" 100 #include "webkit/glue/webview_impl.h"
96 #include "webkit/glue/webwidget_impl.h" 101 #include "webkit/glue/webwidget_impl.h"
102 #include "webkit/port/platform/chromium/PopupMenuChromium.h"
97 #include "webkit/port/platform/graphics/PlatformContextSkia.h" 103 #include "webkit/port/platform/graphics/PlatformContextSkia.h"
98 104
99 // Get rid of WTF's pow define so we can use std::pow. 105 // Get rid of WTF's pow define so we can use std::pow.
100 #undef pow 106 #undef pow
101 #include <cmath> // for std::pow 107 #include <cmath> // for std::pow
102 108
103 using namespace WebCore; 109 using namespace WebCore;
104 110
105 // Change the text zoom level by kTextSizeMultiplierRatio each time the user 111 // Change the text zoom level by kTextSizeMultiplierRatio each time the user
106 // zooms text in or out (ie., change by 20%). The min and max values limit 112 // zooms text in or out (ie., change by 20%). The min and max values limit
107 // text zoom to half and 3x the original text size. These three values match 113 // text zoom to half and 3x the original text size. These three values match
108 // those in Apple's port in WebKit/WebKit/WebView/WebView.mm 114 // those in Apple's port in WebKit/WebKit/WebView/WebView.mm
109 static const double kTextSizeMultiplierRatio = 1.2; 115 static const double kTextSizeMultiplierRatio = 1.2;
110 static const double kMinTextSizeMultiplier = 0.5; 116 static const double kMinTextSizeMultiplier = 0.5;
111 static const double kMaxTextSizeMultiplier = 3.0; 117 static const double kMaxTextSizeMultiplier = 3.0;
112 118
113 // The webcore drag operation type when something is trying to be dropped on 119 // The webcore drag operation type when something is trying to be dropped on
114 // the webview. These values are taken from Apple's windows port. 120 // the webview. These values are taken from Apple's windows port.
115 static const WebCore::DragOperation kDropTargetOperation = 121 static const WebCore::DragOperation kDropTargetOperation =
116 static_cast<WebCore::DragOperation>(DragOperationCopy | DragOperationLink); 122 static_cast<WebCore::DragOperation>(DragOperationCopy | DragOperationLink);
117 123
124 // AutocompletePopupMenuClient
125 class AutocompletePopupMenuClient
126 : public RefCounted<AutocompletePopupMenuClient>,
127 public WebCore::PopupMenuClient {
128 public:
129 AutocompletePopupMenuClient(WebViewImpl* webview,
130 WebCore::HTMLInputElement* text_field,
131 const std::vector<std::wstring>& suggestions,
132 int default_suggestion_index)
133 : text_field_(text_field),
134 selected_index_(default_suggestion_index),
135 webview_(webview) {
136 for (std::vector<std::wstring>::const_iterator iter = suggestions.begin();
137 iter != suggestions.end(); ++iter) {
138 suggestions_.push_back(webkit_glue::StdWStringToString(*iter));
139 }
140 }
141 virtual ~AutocompletePopupMenuClient() {
142 }
143
144 virtual void valueChanged(unsigned listIndex, bool fireEvents = true) {
145 text_field_->setValue(suggestions_[listIndex]);
146 }
147
148 virtual WebCore::String itemText(unsigned list_index) const {
149 return suggestions_[list_index];
150 }
151
152 virtual bool itemIsEnabled(unsigned listIndex) const {
153 return true;
154 }
155
156 virtual PopupMenuStyle itemStyle(unsigned listIndex) const {
157 return menuStyle();
158 }
159
160 virtual PopupMenuStyle menuStyle() const {
161 RenderStyle* style = text_field_->renderStyle() ?
162 text_field_->renderStyle() :
163 text_field_->computedStyle();
164 return PopupMenuStyle(style->color(), Color::white, style->font(),
165 style->visibility() == VISIBLE);
166 }
167
168 virtual int clientInsetLeft() const {
169 return 0;
170 }
171 virtual int clientInsetRight() const {
172 return 0;
173 }
174 virtual int clientPaddingLeft() const {
175 #if defined(OS_WIN)
176 return theme()->popupInternalPaddingLeft(text_field_->computedStyle());
177 #else
178 NOTIMPLEMENTED();
179 return 0;
180 #endif
181 }
182 virtual int clientPaddingRight() const {
183 #if defined(OS_WIN)
184 return theme()->popupInternalPaddingRight(text_field_->computedStyle());
185 #else
186 NOTIMPLEMENTED();
187 return 0;
188 #endif
189 }
190 virtual int listSize() const {
191 return suggestions_.size();
192 }
193 virtual int selectedIndex() const {
194 return selected_index_;
195 }
196 virtual void hidePopup() {
197 webview_->HideAutoCompletePopup();
198 }
199 virtual bool itemIsSeparator(unsigned listIndex) const {
200 return false;
201 }
202 virtual bool itemIsLabel(unsigned listIndex) const {
203 return false;
204 }
205 virtual bool itemIsSelected(unsigned listIndex) const {
206 return false;
207 }
208 virtual bool shouldPopOver() const {
209 return false;
210 }
211 virtual bool valueShouldChangeOnHotTrack() const {
212 return false;
213 }
214
215 virtual FontSelector* fontSelector() const {
216 return text_field_->document()->styleSelector()->fontSelector();
217 }
218
219 virtual void setTextFromItem(unsigned listIndex) {
220 text_field_->setValue(suggestions_[listIndex]);
221 }
222
223 virtual HostWindow* hostWindow() const {
224 return text_field_->document()->view()->hostWindow();
225 }
226
227 virtual PassRefPtr<Scrollbar> createScrollbar(
228 ScrollbarClient* client,
229 ScrollbarOrientation orientation,
230 ScrollbarControlSize size) {
231 RefPtr<Scrollbar> widget = Scrollbar::createNativeScrollbar(client,
232 orientation,
233 size);
234 return widget.release();
235 }
236
237 private:
238 RefPtr<WebCore::HTMLInputElement> text_field_;
239 std::vector<WebCore::String> suggestions_;
240 int selected_index_;
241 WebViewImpl* webview_;
242 };
243
118 // WebView ---------------------------------------------------------------- 244 // WebView ----------------------------------------------------------------
119 245
120 /*static*/ 246 /*static*/
121 WebView* WebView::Create(WebViewDelegate* delegate, 247 WebView* WebView::Create(WebViewDelegate* delegate,
122 const WebPreferences& prefs) { 248 const WebPreferences& prefs) {
123 WebViewImpl* instance = new WebViewImpl(); 249 WebViewImpl* instance = new WebViewImpl();
124 instance->AddRef(); 250 instance->AddRef();
125 instance->SetPreferences(prefs); 251 instance->SetPreferences(prefs);
126 instance->main_frame_->InitMainFrame(instance); 252 instance->main_frame_->InitMainFrame(instance);
127 // Set the delegate after initializing the main frame, to avoid trying to 253 // Set the delegate after initializing the main frame, to avoid trying to
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 (event.type == WebInputEvent::KEY_UP)); 411 (event.type == WebInputEvent::KEY_UP));
286 412
287 // Please refer to the comments explaining the suppress_next_keypress_event_ 413 // Please refer to the comments explaining the suppress_next_keypress_event_
288 // member. 414 // member.
289 // The suppress_next_keypress_event_ is set if the KeyDown is handled by 415 // The suppress_next_keypress_event_ is set if the KeyDown is handled by
290 // Webkit. A keyDown event is typically associated with a keyPress(char) 416 // Webkit. A keyDown event is typically associated with a keyPress(char)
291 // event and a keyUp event. We reset this flag here as this is a new keyDown 417 // event and a keyUp event. We reset this flag here as this is a new keyDown
292 // event. 418 // event.
293 suppress_next_keypress_event_ = false; 419 suppress_next_keypress_event_ = false;
294 420
421 // Give autocomplete a chance to consume the key events it is interested in.
422 if (autocomplete_popup_ &&
423 autocomplete_popup_->isInterestedInEventForKey(event.key_code)) {
424 if (autocomplete_popup_->handleKeyEvent(MakePlatformKeyboardEvent(event)))
425 return true;
426 return false;
427 }
428
429 // A new key being pressed should hide the popup.
430 if (event.type == WebInputEvent::KEY_DOWN)
431 HideAutoCompletePopup();
432
295 Frame* frame = GetFocusedWebCoreFrame(); 433 Frame* frame = GetFocusedWebCoreFrame();
296 if (!frame) 434 if (!frame)
297 return false; 435 return false;
298 436
299 EventHandler* handler = frame->eventHandler(); 437 EventHandler* handler = frame->eventHandler();
300 if (!handler) 438 if (!handler)
301 return KeyEventDefault(event); 439 return KeyEventDefault(event);
302 440
303 #if defined(OS_WIN) 441 #if defined(OS_WIN)
304 // TODO(pinkerton): figure out these keycodes on non-windows 442 // TODO(pinkerton): figure out these keycodes on non-windows
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 // TODO(eseidel): g_current_input_event should be removed once 845 // TODO(eseidel): g_current_input_event should be removed once
708 // ChromeClient:show() can get the current-event information from WebCore. 846 // ChromeClient:show() can get the current-event information from WebCore.
709 /* static */ 847 /* static */
710 const WebInputEvent* WebViewImpl::g_current_input_event = NULL; 848 const WebInputEvent* WebViewImpl::g_current_input_event = NULL;
711 849
712 bool WebViewImpl::HandleInputEvent(const WebInputEvent* input_event) { 850 bool WebViewImpl::HandleInputEvent(const WebInputEvent* input_event) {
713 // If we've started a drag and drop operation, ignore input events until 851 // If we've started a drag and drop operation, ignore input events until
714 // we're done. 852 // we're done.
715 if (doing_drag_and_drop_) 853 if (doing_drag_and_drop_)
716 return true; 854 return true;
717
718 // TODO(eseidel): Remove g_current_input_event. 855 // TODO(eseidel): Remove g_current_input_event.
719 // This only exists to allow ChromeClient::show() to know which mouse button 856 // This only exists to allow ChromeClient::show() to know which mouse button
720 // triggered a window.open event. 857 // triggered a window.open event.
721 // Safari must perform a similar hack, ours is in our WebKit glue layer 858 // Safari must perform a similar hack, ours is in our WebKit glue layer
722 // theirs is in the application. This should go when WebCore can be fixed 859 // theirs is in the application. This should go when WebCore can be fixed
723 // to pass more event information to ChromeClient::show() 860 // to pass more event information to ChromeClient::show()
724 g_current_input_event = input_event; 861 g_current_input_event = input_event;
725 862
726 bool handled = true; 863 bool handled = true;
727 864
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 void WebViewImpl::StopLoading() { 912 void WebViewImpl::StopLoading() {
776 main_frame_->StopLoading(); 913 main_frame_->StopLoading();
777 } 914 }
778 915
779 void WebViewImpl::SetBackForwardListSize(int size) { 916 void WebViewImpl::SetBackForwardListSize(int size) {
780 page_->backForwardList()->setCapacity(size); 917 page_->backForwardList()->setCapacity(size);
781 } 918 }
782 919
783 void WebViewImpl::SetFocus(bool enable) { 920 void WebViewImpl::SetFocus(bool enable) {
784 if (enable) { 921 if (enable) {
922 // Hide the popup menu if any.
923 // TODO(jcampan): bug #3844: we should do that when we lose focus. The
924 // reason we are not doing it is because when clicking on the autofill
925 // popup, the page first loses focus before the mouse click is sent to the
926 // popup. So if we close when the focus is lost, the mouse click does not
927 // do anything.
928 HideAutoCompletePopup();
929
785 // Getting the focused frame will have the side-effect of setting the main 930 // Getting the focused frame will have the side-effect of setting the main
786 // frame as the focused frame if it is not already focused. Otherwise, if 931 // frame as the focused frame if it is not already focused. Otherwise, if
787 // there is already a focused frame, then this does nothing. 932 // there is already a focused frame, then this does nothing.
788 GetFocusedFrame(); 933 GetFocusedFrame();
789 if (main_frame_ && main_frame_->frame()) { 934 if (main_frame_ && main_frame_->frame()) {
790 Frame* frame = main_frame_->frame(); 935 Frame* frame = main_frame_->frame();
791 if (!frame->selection()->isFocusedAndActive()) { 936 if (!frame->selection()->isFocusedAndActive()) {
792 // No one has focus yet, try to restore focus. 937 // No one has focus yet, try to restore focus.
793 RestoreFocus(); 938 RestoreFocus();
794 frame->page()->focusController()->setActive(true); 939 frame->page()->focusController()->setActive(true);
795 } 940 }
796 Frame* focused_frame = 941 Frame* focused_frame =
797 frame->page()->focusController()->focusedOrMainFrame(); 942 frame->page()->focusController()->focusedOrMainFrame();
798 frame->selection()->setFocused(frame == focused_frame); 943 frame->selection()->setFocused(frame == focused_frame);
799 } 944 }
800 ime_accept_events_ = true; 945 ime_accept_events_ = true;
801 } else { 946 } else {
802 // Clear out who last had focus. If someone has focus, the refs will be 947 // Clear out who last had focus. If someone has focus, the refs will be
803 // updated below. 948 // updated below.
804 ReleaseFocusReferences(); 949 ReleaseFocusReferences();
805 950
806 // Clear focus on the currently focused frame if any.
807
808 if (!main_frame_) 951 if (!main_frame_)
809 return; 952 return;
810 953
811 Frame* frame = main_frame_->frame(); 954 Frame* frame = main_frame_->frame();
812 if (!frame) 955 if (!frame)
813 return; 956 return;
814 957
815 RefPtr<Frame> focused = frame->page()->focusController()->focusedFrame(); 958 RefPtr<Frame> focused = frame->page()->focusController()->focusedFrame();
816 if (focused.get()) { 959 if (focused.get()) {
817 // Update the focus refs, this way we can give focus back appropriately. 960 // Update the focus refs, this way we can give focus back appropriately.
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 WebKeyboardEvent keyboard_event; 1156 WebKeyboardEvent keyboard_event;
1014 keyboard_event.type = WebInputEvent::KEY_DOWN; 1157 keyboard_event.type = WebInputEvent::KEY_DOWN;
1015 if (reverse) 1158 if (reverse)
1016 keyboard_event.modifiers = WebInputEvent::SHIFT_KEY; 1159 keyboard_event.modifiers = WebInputEvent::SHIFT_KEY;
1017 // VK_TAB which is only defined on Windows. 1160 // VK_TAB which is only defined on Windows.
1018 keyboard_event.key_code = 0x09; 1161 keyboard_event.key_code = 0x09;
1019 MakePlatformKeyboardEvent platform_event(keyboard_event); 1162 MakePlatformKeyboardEvent platform_event(keyboard_event);
1020 // We have to set the key type explicitly to avoid an assert in the 1163 // We have to set the key type explicitly to avoid an assert in the
1021 // KeyboardEvent constructor. 1164 // KeyboardEvent constructor.
1022 platform_event.SetKeyType(PlatformKeyboardEvent::RawKeyDown); 1165 platform_event.SetKeyType(PlatformKeyboardEvent::RawKeyDown);
1023 RefPtr<KeyboardEvent> webkit_event = KeyboardEvent::create(platform_event, N ULL); 1166 RefPtr<KeyboardEvent> webkit_event = KeyboardEvent::create(platform_event,
1167 NULL);
1024 page()->focusController()->setInitialFocus( 1168 page()->focusController()->setInitialFocus(
1025 reverse ? WebCore::FocusDirectionBackward : 1169 reverse ? WebCore::FocusDirectionBackward :
1026 WebCore::FocusDirectionForward, 1170 WebCore::FocusDirectionForward,
1027 webkit_event.get()); 1171 webkit_event.get());
1028 } 1172 }
1029 } 1173 }
1030 1174
1031 bool WebViewImpl::FocusedFrameNeedsSpellchecking() { 1175 bool WebViewImpl::FocusedFrameNeedsSpellchecking() {
1032 const WebCore::Frame* frame = GetFocusedWebCoreFrame(); 1176 const WebCore::Frame* frame = GetFocusedWebCoreFrame();
1033 if (!frame) 1177 if (!frame)
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 if (focused_node.get() && 1470 if (focused_node.get() &&
1327 focused_node->nodeType() == Node::ELEMENT_NODE) { 1471 focused_node->nodeType() == Node::ELEMENT_NODE) {
1328 return SearchableFormData::Create( 1472 return SearchableFormData::Create(
1329 static_cast<Element*>(focused_node.get())); 1473 static_cast<Element*>(focused_node.get()));
1330 } 1474 }
1331 } 1475 }
1332 } 1476 }
1333 return NULL; 1477 return NULL;
1334 } 1478 }
1335 1479
1480 void WebViewImpl::AutofillSuggestionsForNode(
1481 int64 node_id,
1482 const std::vector<std::wstring>& suggestions,
1483 int default_suggestion_index) {
1484 if (!main_frame_ || suggestions.empty())
1485 return;
1486
1487 DCHECK(default_suggestion_index < static_cast<int>(suggestions.size()));
1488
1489 Frame* frame = main_frame_->frame();
1490 if (!frame)
1491 return;
1492
1493 if (RefPtr<Frame> focused =
1494 frame->page()->focusController()->focusedFrame()) {
1495 RefPtr<Document> document = focused->document();
1496 if (!document.get())
1497 return;
1498
1499 RefPtr<Node> focused_node = document->focusedNode();
1500 // If the node for which we queried the autofill suggestions is not the
1501 // focused node, then we have nothing to do.
1502 // TODO(jcampan): also check the carret is at the end and that the text has
1503 // not changed.
1504 if (!focused_node.get() ||
1505 reinterpret_cast<int64>(focused_node.get()) != node_id)
1506 return;
1507
1508 if (!focused_node->hasTagName(WebCore::HTMLNames::inputTag)) {
1509 NOTREACHED();
1510 return;
1511 }
1512
1513 WebCore::HTMLInputElement* input_elem =
1514 static_cast<WebCore::HTMLInputElement*>(focused_node.get());
1515 // Hide any current autocomplete popup.
1516 HideAutoCompletePopup();
1517
1518 if (suggestions.size() > 0) {
1519 autocomplete_popup_client_ =
1520 adoptRef(new AutocompletePopupMenuClient(this, input_elem,
1521 suggestions,
1522 default_suggestion_index));
1523 // Autocomplete popup does not get focused. We need the page to still
1524 // have focus so the user can keep typing when the popup is showing.
1525 autocomplete_popup_ =
1526 WebCore::PopupContainer::create(autocomplete_popup_client_.get(),
1527 false);
1528 autocomplete_popup_->show(focused_node->getRect(), frame->view(), 0);
1529 }
1530 }
1531 }
1532
1336 void WebViewImpl::DidCommitLoad(bool* is_new_navigation) { 1533 void WebViewImpl::DidCommitLoad(bool* is_new_navigation) {
1337 if (is_new_navigation) 1534 if (is_new_navigation)
1338 *is_new_navigation = observed_new_navigation_; 1535 *is_new_navigation = observed_new_navigation_;
1339 1536
1340 #ifndef NDEBUG 1537 #ifndef NDEBUG
1341 DCHECK(!observed_new_navigation_ || 1538 DCHECK(!observed_new_navigation_ ||
1342 main_frame_->frame()->loader()->documentLoader() == new_navigation_loader_); 1539 main_frame_->frame()->loader()->documentLoader() == new_navigation_loader_);
1343 new_navigation_loader_ = NULL; 1540 new_navigation_loader_ = NULL;
1344 #endif 1541 #endif
1345 observed_new_navigation_ = false; 1542 observed_new_navigation_ = false;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1474 } 1671 }
1475 1672
1476 void WebViewImpl::DeleteImageResourceFetcher(ImageResourceFetcher* fetcher) { 1673 void WebViewImpl::DeleteImageResourceFetcher(ImageResourceFetcher* fetcher) {
1477 DCHECK(image_fetchers_.find(fetcher) != image_fetchers_.end()); 1674 DCHECK(image_fetchers_.find(fetcher) != image_fetchers_.end());
1478 image_fetchers_.erase(fetcher); 1675 image_fetchers_.erase(fetcher);
1479 1676
1480 // We're in the callback from the ImageResourceFetcher, best to delay 1677 // We're in the callback from the ImageResourceFetcher, best to delay
1481 // deletion. 1678 // deletion.
1482 MessageLoop::current()->DeleteSoon(FROM_HERE, fetcher); 1679 MessageLoop::current()->DeleteSoon(FROM_HERE, fetcher);
1483 } 1680 }
1681
1682 void WebViewImpl::HideAutoCompletePopup() {
1683 if (autocomplete_popup_) {
1684 autocomplete_popup_->hidePopup();
1685 autocomplete_popup_.clear();
1686 autocomplete_popup_client_.clear();
1687 }
1688 }
OLDNEW
« no previous file with comments | « webkit/glue/webview_impl.h ('k') | webkit/port/page/chromium/ChromeClientChromium.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698