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

Side by Side Diff: Source/WebCore/platform/mac/SearchPopupMenuMac.mm

Issue 13713003: Remove all of WebCore/platform/mac which is not mentioned in WebCore.gypi. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added back a couple needed headers Created 7 years, 8 months 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
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2006 Apple Computer, Inc.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21 #import "config.h"
22 #import "SearchPopupMenuMac.h"
23
24 #include <wtf/text/AtomicString.h>
25
26 namespace WebCore {
27
28 SearchPopupMenuMac::SearchPopupMenuMac(PopupMenuClient* client)
29 : m_popup(adoptRef(new PopupMenuMac(client)))
30 {
31 }
32
33 static NSString* autosaveKey(const String& name)
34 {
35 return [@"com.apple.WebKit.searchField:" stringByAppendingString:name];
36 }
37
38 PopupMenu* SearchPopupMenuMac::popupMenu()
39 {
40 return m_popup.get();
41 }
42
43 bool SearchPopupMenuMac::enabled()
44 {
45 return true;
46 }
47
48 void SearchPopupMenuMac::saveRecentSearches(const AtomicString& name, const Vect or<String>& searchItems)
49 {
50 if (name.isEmpty())
51 return;
52
53 size_t size = searchItems.size();
54 if (size == 0)
55 [[NSUserDefaults standardUserDefaults] removeObjectForKey:autosaveKey(na me)];
56 else {
57 NSMutableArray* items = [[NSMutableArray alloc] initWithCapacity:size];
58 for (size_t i = 0; i < size; ++i)
59 [items addObject:searchItems[i]];
60 [[NSUserDefaults standardUserDefaults] setObject:items forKey:autosaveKe y(name)];
61 [items release];
62 }
63 }
64
65 void SearchPopupMenuMac::loadRecentSearches(const AtomicString& name, Vector<Str ing>& searchItems)
66 {
67 if (name.isEmpty())
68 return;
69
70 searchItems.clear();
71 NSArray* items = [[NSUserDefaults standardUserDefaults] arrayForKey:autosave Key(name)];
72 size_t size = [items count];
73 for (size_t i = 0; i < size; ++i) {
74 NSString* item = [items objectAtIndex:i];
75 if ([item isKindOfClass:[NSString class]])
76 searchItems.append(item);
77 }
78 }
79
80 }
OLDNEW
« no previous file with comments | « Source/WebCore/platform/mac/SearchPopupMenuMac.h ('k') | Source/WebCore/platform/mac/SharedTimerMac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698