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

Side by Side Diff: chrome/browser/spellchecker/spellcheck_host.cc

Issue 7919003: Remove refptr usages from SpellCheckHost (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fix pointer returns. Update tests. Created 9 years, 2 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/browser/spellchecker/spellcheck_host.h" 5 #include "chrome/browser/spellchecker/spellcheck_host.h"
6 6
7 #include "base/memory/scoped_ptr.h"
dcheng 2011/10/20 23:24:34 I'm surprised you need to add this as we don't eve
7 #include "base/string_split.h" 8 #include "base/string_split.h"
8 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
9 #include "chrome/browser/prefs/pref_member.h" 10 #include "chrome/browser/prefs/pref_member.h"
10 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/spellchecker/spellcheck_host_impl.h" 12 #include "chrome/browser/spellchecker/spellcheck_host_impl.h"
12 #include "chrome/browser/spellchecker/spellchecker_platform_engine.h" 13 #include "chrome/browser/spellchecker/spellchecker_platform_engine.h"
13 #include "chrome/common/pref_names.h" 14 #include "chrome/common/pref_names.h"
14 #include "chrome/common/spellcheck_common.h" 15 #include "chrome/common/spellcheck_common.h"
15 16
16 namespace { 17 namespace {
17 18
18 // An event used by browser tests to receive status events from this class and 19 // An event used by browser tests to receive status events from this class and
19 // its derived classes. 20 // its derived classes.
20 base::WaitableEvent* g_status_event = NULL; 21 base::WaitableEvent* g_status_event = NULL;
21 SpellCheckHost::EventType g_status_type = SpellCheckHost::BDICT_NOTINITIALIZED; 22 SpellCheckHost::EventType g_status_type = SpellCheckHost::BDICT_NOTINITIALIZED;
22 23
23 } // namespace 24 } // namespace
24 25
25 // static 26 // static
26 scoped_refptr<SpellCheckHost> SpellCheckHost::Create( 27 SpellCheckHost* SpellCheckHost::Create(
27 SpellCheckProfileProvider* profile, 28 SpellCheckProfileProvider* profile,
28 const std::string& language, 29 const std::string& language,
29 net::URLRequestContextGetter* request_context_getter, 30 net::URLRequestContextGetter* request_context_getter,
30 SpellCheckHostMetrics* metrics) { 31 SpellCheckHostMetrics* metrics) {
31 scoped_refptr<SpellCheckHostImpl> host = 32 SpellCheckHostImpl* host =
32 new SpellCheckHostImpl(profile, 33 new SpellCheckHostImpl(profile, language, request_context_getter,
33 language,
34 request_context_getter,
35 metrics); 34 metrics);
36 if (!host) 35 if (!host)
37 return NULL; 36 return NULL;
38 37
39 host->Initialize(); 38 host->Initialize();
40 return host; 39 return (SpellCheckHost*)host;
dcheng 2011/10/20 23:24:34 You shouldn't need this cast.
41 } 40 }
42 41
43 // static 42 // static
44 int SpellCheckHost::GetSpellCheckLanguages( 43 int SpellCheckHost::GetSpellCheckLanguages(
45 Profile* profile, 44 Profile* profile,
46 std::vector<std::string>* languages) { 45 std::vector<std::string>* languages) {
47 StringPrefMember accept_languages_pref; 46 StringPrefMember accept_languages_pref;
48 StringPrefMember dictionary_language_pref; 47 StringPrefMember dictionary_language_pref;
49 accept_languages_pref.Init(prefs::kAcceptLanguages, profile->GetPrefs(), 48 accept_languages_pref.Init(prefs::kAcceptLanguages, profile->GetPrefs(),
50 NULL); 49 NULL);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 100 }
102 101
103 // static 102 // static
104 SpellCheckHost::EventType SpellCheckHost::WaitStatusEvent() { 103 SpellCheckHost::EventType SpellCheckHost::WaitStatusEvent() {
105 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 104 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
106 105
107 if (g_status_event) 106 if (g_status_event)
108 g_status_event->Wait(); 107 g_status_event->Wait();
109 return g_status_type; 108 return g_status_type;
110 } 109 }
OLDNEW
« no previous file with comments | « chrome/browser/spellchecker/spellcheck_host.h ('k') | chrome/browser/spellchecker/spellcheck_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698