Changeset 84011 in webkit
- Timestamp:
- Apr 15, 2011 12:24:16 PM (13 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r83997 r84011 1 2011-04-15 Brady Eidson <beidson@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 <rdar://problem/9287880> and https://bugs.webkit.org/show_bug.cgi?id=58596 6 WK2: Past searches not remembered for <input type=search results="5" autosave="foo"> 7 8 Add SaveRecentSearches and LoadRecentSearches messages: 9 * UIProcess/WebPageProxy.messages.in: 10 * UIProcess/WebPageProxy.h: 11 12 Message up to the UIProcess for the save/load operations: 13 * WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp: 14 (WebKit::WebSearchPopupMenu::saveRecentSearches): 15 (WebKit::WebSearchPopupMenu::loadRecentSearches): 16 * WebProcess/WebCoreSupport/WebPopupMenu.h: 17 (WebKit::WebPopupMenu::page): 18 19 Save the values to disk CFPreference-style: 20 * UIProcess/cf/WebPageProxyCF.cpp: 21 (WebKit::autosaveKey): 22 (WebKit::WebPageProxy::saveRecentSearches): 23 (WebKit::WebPageProxy::loadRecentSearches): 24 25 Stubbed out for non-CF platforms: 26 * UIProcess/gtk/WebPageProxyGtk.cpp: 27 (WebKit::WebPageProxy::saveRecentSearches): 28 (WebKit::WebPageProxy::loadRecentSearches): 29 * UIProcess/qt/WebPageProxyQt.cpp: 30 (WebKit::WebPageProxy::saveRecentSearches): 31 (WebKit::WebPageProxy::loadRecentSearches): 32 1 33 2011-04-14 Alexey Proskuryakov <ap@apple.com> 2 34 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r83687 r84011 626 626 void internalShowContextMenu(const WebCore::IntPoint& menuLocation, const ContextMenuState&, const Vector<WebContextMenuItemData>&, CoreIPC::ArgumentDecoder*); 627 627 628 // Search popup results 629 void saveRecentSearches(const String&, const Vector<String>&); 630 void loadRecentSearches(const String&, Vector<String>&); 631 628 632 #if PLATFORM(MAC) 629 633 // Speech. -
trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in
r83460 r84011 239 239 SetGestureReachedScrollingLimit(bool limitReached) 240 240 #endif 241 242 # Search popup menus 243 SaveRecentSearches(WTF::String name, Vector<String> searchItems) 244 LoadRecentSearches(WTF::String name) -> (Vector<String> result) 241 245 } -
trunk/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp
r80829 r84011 181 181 } 182 182 183 static RetainPtr<CFStringRef> autosaveKey(const String& name) 184 { 185 String key = "com.apple.WebKit.searchField:" + name; 186 return RetainPtr<CFStringRef>(AdoptCF, key.createCFString()); 187 } 188 189 void WebPageProxy::saveRecentSearches(const String& name, const Vector<String>& searchItems) 190 { 191 // The WebProcess shouldn't have bothered to send this message if the name was empty. 192 ASSERT(!name.isEmpty()); 193 194 RetainPtr<CFMutableArrayRef> items; 195 196 if (size_t size = searchItems.size()) { 197 items.adoptCF(CFArrayCreateMutable(0, size, &kCFTypeArrayCallBacks)); 198 for (size_t i = 0; i < size; ++i) { 199 RetainPtr<CFStringRef> item(AdoptCF, searchItems[i].createCFString()); 200 CFArrayAppendValue(items.get(), item.get()); 201 } 202 } 203 204 CFPreferencesSetAppValue(autosaveKey(name).get(), items.get(), kCFPreferencesCurrentApplication); 205 CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication); 206 } 207 208 void WebPageProxy::loadRecentSearches(const String& name, Vector<String>& searchItems) 209 { 210 // The WebProcess shouldn't have bothered to send this message if the name was empty. 211 ASSERT(!name.isEmpty()); 212 213 searchItems.clear(); 214 RetainPtr<CFArrayRef> items(AdoptCF, reinterpret_cast<CFArrayRef>(CFPreferencesCopyAppValue(autosaveKey(name).get(), kCFPreferencesCurrentApplication))); 215 216 if (!items || CFGetTypeID(items.get()) != CFArrayGetTypeID()) 217 return; 218 219 size_t size = CFArrayGetCount(items.get()); 220 for (size_t i = 0; i < size; ++i) { 221 CFStringRef item = (CFStringRef)CFArrayGetValueAtIndex(items.get(), i); 222 if (CFGetTypeID(item) == CFStringGetTypeID()) 223 searchItems.append(item); 224 } 225 } 226 183 227 } // namespace WebKit -
trunk/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp
r82929 r84011 29 29 30 30 #include "NativeWebKeyboardEvent.h" 31 #include "NotImplemented.h" 31 32 #include "PageClient.h" 32 33 … … 44 45 } 45 46 47 void WebPageProxy::saveRecentSearches(const String&, const Vector<String>&) 48 { 49 notImplemented(); 50 } 51 52 void WebPageProxy::loadRecentSearches(const String&, Vector<String>&) 53 { 54 notImplemented(); 55 } 56 46 57 } // namespace WebKit -
trunk/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp
r79589 r84011 27 27 #include "WebPageProxy.h" 28 28 29 #include <WebCore/NotImplemented.h> 30 29 31 namespace WebKit { 30 32 … … 35 37 } 36 38 39 void WebPageProxy::saveRecentSearches(const String&, const Vector<String>&) 40 { 41 notImplemented(); 42 } 43 44 void WebPageProxy::loadRecentSearches(const String&, Vector<String>&) 45 { 46 notImplemented(); 47 } 48 37 49 } // namespace WebKit -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h
r74285 r84011 44 44 ~WebPopupMenu(); 45 45 46 WebPage* page() { return m_page; } 47 46 48 void disconnectFromPage() { m_page = 0; } 47 49 void didChangeSelectedIndex(int newIndex); -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp
r83909 r84011 24 24 #include "WebSearchPopupMenu.h" 25 25 26 #include "WebPage.h" 27 #include "WebPageProxyMessages.h" 28 #include "WebProcess.h" 29 #include <wtf/text/AtomicString.h> 30 26 31 using namespace WebCore; 27 32 … … 43 48 } 44 49 45 void WebSearchPopupMenu::saveRecentSearches(const AtomicString& , const Vector<String>&)50 void WebSearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) 46 51 { 52 if (name.isEmpty()) 53 return; 54 55 WebPage* page = m_popup->page(); 56 if (!page) 57 return; 58 59 WebProcess::shared().connection()->send(Messages::WebPageProxy::SaveRecentSearches(name, searchItems), page->pageID()); 47 60 } 48 61 49 void WebSearchPopupMenu::loadRecentSearches(const AtomicString& , Vector<String>&)62 void WebSearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& resultItems) 50 63 { 64 if (name.isEmpty()) 65 return; 66 67 WebPage* page = m_popup->page(); 68 if (!page) 69 return; 70 71 WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::LoadRecentSearches(name), Messages::WebPageProxy::LoadRecentSearches::Reply(resultItems), page->pageID()); 51 72 } 52 73
Note: See TracChangeset
for help on using the changeset viewer.